Jump to content

What did I do wrong?


Ranokoa

Recommended Posts

scn RTrigZoneScript


short triggered
ref target

begin onTrigger player

set triggered to 0;Just did this still doesn't work.
if triggered == 0
 set target to getParentRef
 target.disable
 playsound AMBStoneShift

 set triggered to 1
endif

end


begin onTrigger player;This block is suppose to make it go back if triggered again, basically forever looping its affects.

if triggered == 1
 set target to getParentRef
 target.enable
 playsound AMBStoneShift

 set triggered to 0
endif

end

 

Still doesn't work.. I don't know what I did wrong... the sound plays at least lol. I want it to be attatched to a triggerbox, when the player walks through it disable the thing. when the player walks through it again enable it. So the only way to tell it changes or disappears is by going the same way you came, going around after disable you see it is obviously gone.

 

No more specifics needed. Parented both ways. Persistant referance. I wan't to avoid needing to actually make a referance and keep target getparentref. what it is needed for would spoil the mod idea and I want to ensure to be the first that I know about to do this. lol. So.. Anyone wanna help?

Link to comment
Share on other sites

scn RTrigZoneScript


short triggered
ref target

begin OnTrigger player


if triggered == 0
set target to getParentRef
target.disable
playsound AMBStoneShift

set triggered to 1
elseif triggered == 1
target.enable
playsound AMBStoneShift

set triggered to 0
endif

end

 

Only one OnTrigger block is needed. That's probably what's been messing things up. Also, setting the triggered var to 0 every time the block runs will cause the object to get disabled every time. :)

Link to comment
Share on other sites

Hmm.. well it triggers and disables but when passed through again it doesnt enable. I might have a setting wrong though.. hmm..

 

EDIT no its right on my end. Just wont enable afterwads

Link to comment
Share on other sites

Try using a clean save. Otherwise the scripts might not get updated properly. Or I'm just missing something really obvious here...

 

[EDIT]Ah, my bad. I totally forgot that OnTrigger blocks keep running every frame until all refs leave the box. This isn't going to work then.

 

[EDIT]

scn RTrigZoneScript


short triggered
ref target

begin onTrigger player

if triggered == 0
set target to getParentRef
target.disable
playsound AMBStoneShift

set triggered to 1
elseif triggered == 2
target.enable
playsound AMBStoneShift

set triggered to 3
else
return
endif

end

begin gameMode

if triggered == 1
set triggered to 2
elseif triggered == 3
set triggered to 0
endif

end

 

Ok, here's a workaround. Not sure if it'll work though. If it doesn't, someone else should give it a try because I may be forgetting something really obvious.

Link to comment
Share on other sites

Still not working... Does the same as before. Disables first but will not enable upon retrigger and thus resetting it.

 

 

Maybe give it a tick so that at .5 seconds after disable it resets, detects if its either disabled or enabled and does the opposite. Basically only setting state to opposite of current rather than direct command dependant on trigger set.

Link to comment
Share on other sites

Oh wait, I see what went wrong. I accidentally used "else" rather than "elseif triggered == 1 || triggered == 3", causing the script to return every time the above expressions above are false, preventing the the GameBlock from updating the variable if the player leaves the triggerbox. Must have messed that up when I combined two elseifs into one. :)

 

What it should have been it:

scn RTrigZoneScript


short triggered
ref target

begin onTrigger player

if triggered == 0
set target to getParentRef
target.disable
playsound AMBStoneShift

set triggered to 1
elseif triggered == 2
target.enable
playsound AMBStoneShift

set triggered to 3
elseif triggered == 1 || triggered == 3
return
endif

end

begin gameMode

if triggered == 1
set triggered to 2
elseif triggered == 3
set triggered to 0
endif

end

Link to comment
Share on other sites

Still doesn't work right. Maybe it could be seperated into two triggerbox scripts, both detecting its current enabled state and both put in the same place, so if its enabled, one will disable it, and visa versa, rather than one script.

 

EDIT: Can someone that knows scripting well look at the above and tell me why it isn't working? I may not be able to custom write scripts for the life of me but finding bugs, seeing functionality, and seeing if it works or not usually i am good at and the above looks right in every aspect, i can't figure out how it won't work.. but it doesnt..

 

I even did a little test. I put two barrels next to eachother, and a triggerbox in front of em. One barrel is set parented to the other and enabled opposite of parent status, and the triggerbox is parented by the enabled barrel (I even did it opposite and made the barrel parent the triggerbox instead of visa versa, came with same results)

 

I went through the triggerbox and it worked right for the first part of the script. The first barrel disabled while the second one enabled. But going back through the triggerbox it did not do anything at all! It was supposed to enable the first one, thus disabling the second.. It refuses to run the second part of the script! Its like elseif doesnt exist!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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