Jump to content

Trigger problems


Pronam

Recommended Posts

Just like ranokoa I'm having fun with triggerboxes, I got stuck on one thing as well.

 

It's supposed to be triggered when anything is thrown down trough it, the trouble is that it either works just once, but then it counts up to the max as if you've thrown down all at once. Thrown down what? Black mudcrab-bodies. As a it'll trigger a little bonus. Creating persistent references of all mudcrabs and assigning them to a trigger seems unnecessarily stressing, but would it the only way..I doubt that? I have tried various settings and continuously ended up either with nothing or a loop where the counter goes to the max immediately.

 

I can provide the mod if wanted, as it may be area-related. Here is a screen of the setting, its not that the actors keep stuck in the triggerbox, they'll drop down...so what is faulty which makes it return and add up? I'm not that well known with the behavior of triggerboxes. Nothing else touches the triggerbox, not even the statics.

 

http://img638.imageshack.us/img638/1570/mudcrabsetting.png

 

 

scn OVChestMudrabcounter

short process
short counter

ref crabchest

Begin OnTriggerActor
if process == 0
	set process to 1
	set counter to counter + 1
endif
End

Begin GameMode
if process == 1
	set process to 0
	if counter < 7
		if counter < 1
			message "1 mudcrab cleaned up.", 3		
		elseif counter >= 1
			message "%.0f mudcrabs cleaned up.", counter, 3
			if counter == 5
				set crabchest to GetParentRef
				message "Eyes have dropped",  3
				crabchest.additem 38BA0 2
				crabchest.additem 930F 2
			elseif counter == 6
				message "All mudcrabs cleaned up.", 5
				crabchest.additem 9311 2
				crabchest.additem 931B 2
				crabchest.additem f 2000
			endif
		endif
	elseif counter >= 7
		set process to 2
	endif
endif
End

Link to comment
Share on other sites

I haven't really taken a good look at it, but my theory is that both blocks are being run, as the game is technically still in GameMode, even during the OnTrigger, causing the process variable to be set back to 0, causing the counter to be set to +1 the next frame. :P Perhaps a return in the OnTrigger block will prevent the GameMode block from running unless there's nothing triggering the thing:

scn OVChestMudrabcounter

short process
short counter

ref crabchest

Begin OnTriggerActor
if process == 0
	set process to 1
	set counter to counter + 1
       else
               return
endif
End

Begin GameMode
if process == 1
	set process to 0
	if counter < 7
		if counter < 1
			message "1 mudcrab cleaned up.", 3		
		elseif counter >= 1
			message "%.0f mudcrabs cleaned up.", counter, 3
			if counter == 5
				set crabchest to GetParentRef
				message "Eyes have dropped",  3
				crabchest.additem 38BA0 2
				crabchest.additem 930F 2
			elseif counter == 6
				message "All mudcrabs cleaned up.", 5
				crabchest.additem 9311 2
				crabchest.additem 931B 2
				crabchest.additem f 2000
			endif
		endif
	elseif counter >= 7
		set process to 2
	endif
endif
End

Link to comment
Share on other sites

I'll try. I've tried running it solely in the trigger block at the beginning as well but no avail.

===

Nope, thought it's getting better. It counts all the way from 1 to 6 and then shows the 5/6 messages accordingly instead of skipping to the end immediately.

Lets see what happens if I'll put in a little delay for the 0. first a little and if that doesn't work a returning one.

Link to comment
Share on other sites

I blanking hate triggerbox problems, but love working with them WHEN THEY WORK! My scripting ability is still very limited, and normally the solutions I come up with make the script (depending on how bad the problem is) a little messy, but I don't stop until even if it's messy it works 100%. Sometimes complex problems need you to just put in really simple answer, although when it's a complex problem that simple solution is almost always bound to be simply stupid and longer. I will give it a whack, although my scripting abilities are more than likely not up to par with things like this because I blanking hate triggerbox problems!!!!

 

scn OVChestMudrabcounter

short breakloop
short process
short counter

ref crabchest

Begin OnTriggerActor
       if process == 0
               set process to 1
               set counter to counter + 1
       else
               return
       endif
End

Begin GameMode
       if process == 1
               set process to 2
               if counter < 7
                       if counter < 1
                               message "1 mudcrab cleaned up.", 3          
                               set breakloop to 1    
                       elseif counter >= 1
                               message "%.0f mudcrabs cleaned up.", counter, 3
                               if counter == 5
                                       set crabchest to GetParentRef
                                       message "Eyes have dropped",  3
                                       crabchest.additem 38BA0 2
                                       crabchest.additem 930F 2
                                       set breakloop to 1
                               elseif counter == 6
                                       message "All mudcrabs cleaned up.", 5
                                       crabchest.additem 9311 2
                                       crabchest.additem 931B 2
                                       crabchest.additem f 2000
                                       set breakloop to 1
                               endif
                       endif
               elseif counter >= 7
                       set process to 3
                       set breakloop to 3
               endif
       endif
End

Begin GameMode
       if breakloop == 1 && process == 2
                Set Process to 0
                Set breakloop to 0
        endif
end

 

Okay my coffee isn't in me as well I think I lost myself near the end because I let my mind wonder and then stared off into space lol. Anyways, hope this works. Adding a new step that acts to restart the process and only that may help. I forgot the words I was looking for the explain exactly what was going through my mind.

 

EDIT: Okay I rememberish. Basically, it sets the process to 2, rather than back too 0 to restart. It does it's action and then it sets the breakloop to 1. Only when breakloop AND process are set does it allow it to restart, forcing it to finish it's action only once first. And I lost the correct words again.... still... might help.

Link to comment
Share on other sites

Nvm ranokoa, got it already. Thanks though, looking forward to more scripts of you.

Though for the relevance. I'll try yours to see if it works.//no, it only counts the first one.

 

As you see I've added some things as changed some so death and alive can go through.

As when they are death, they aren't seen as actors anymore....apparently.

 

Thank you both!

 

scn OVChestMudrabcounter

short process
short counter

ref crabchest
ref target

Begin OnTrigger
       if process == 0
               set target to GetActionRef
               target.kill
               set process to 2
               set counter to counter + 1
       else
               return
       endif
End

Begin GameMode
if process == 1
	set process to 0
elseif process == 2
	set process to 3
	if counter < 7
		if counter < 1
			message "1 mudcrab cleaned up.", 3              
		elseif counter >= 1
			message "%.0f mudcrabs cleaned up.", counter, 3
			if counter == 5
				set crabchest to GetParentRef
				message "Eyes have dropped",  3
				crabchest.additem 38BA0 2
				crabchest.additem 930F 2
			endif
		endif
	elseif counter >= 7
		message "All mudcrabs cleaned up.", 5
		crabchest.additem 9311 2
		crabchest.additem 931B 2
		crabchest.additem f 2000
		set process to 4
	endif
elseif process == 3
	set process to 1
endif
End

Link to comment
Share on other sites

Ah okay. Thanks then :D At least I can find out if mine was a complete bust to begin with >_< lol. BTW the maze has probably almost doubled in size since the last you might have seen it >_< so fun to add new traps that scare the hell out even me when I'm not expecting to be in the trapped location. lol.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...