Jump to content

Script Question


Povuholo

Recommended Posts

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?
Link to comment
Share on other sites

The typical thing is to do a doonce variable. So like:

 

If ( deadbody == 1 )
 Return
EndIf

Scriptey stuff

Set deadbody to 1

 

Basically the script will stop running as soon as the condition is met.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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