Povuholo
Feb 12 2006, 03:37 PM
Hi my mod is in the last stage: checking! And everything works fine, except one thing. When the player goes through a door to an other cell, a dead body is supposed to appear somewhere in another cell. But... if the player goes through the door multiple times, the body also appears on the spot multiple times! So what is the probably very simple line i need to add to my script to let it only happen once?
Switch
Feb 12 2006, 04:42 PM
The typical thing is to do a doonce variable. So like:
CODE
If ( deadbody == 1 )
Return
EndIf
Scriptey stuff
Set deadbody to 1
Basically the script will stop running as soon as the condition is met.
Theta Orionis
Feb 12 2006, 05:04 PM
Switch is right about the DoOnce condition, but if you still want the player to be able to enter the cell after the first time, when the body has been placed, you'll have to take that into account.
First, declare your new variable - eg
short deadbody
Then add an extra if/else/endif condition
If ( OnActivate == 1 )
If ( deadbody == 0 )
[your code about placing the body etc]
Set deadbody to 1
Else
Activate
Endif
Endif
That should only place the body once while still allowing the player to enter the cell after the first time...
Povuholo
Feb 12 2006, 05:07 PM
Thanks, it's working now. The mod is going to get released really soon