imported>Haama |
imported>Haama |
Line 301: |
Line 301: |
| * [[MessageBox_Tutorial:_Spell_Scripts|Spells]] | | * [[MessageBox_Tutorial:_Spell_Scripts|Spells]] |
|
| |
|
| ====Extra coding for activators====
| |
| * They need to be [[Loaded]], or moved to the player's cell, to use effectively
| |
| ** This requires extra coding, to keep them around the player, and move them back when finished.
| |
|
| |
|
| To move them to the player:
| |
| <pre>begin onActivate
| |
| set Choosing to -1
| |
| if ((GetInSameCell player) == 0)
| |
| MoveTo player
| |
| endif
| |
| end</pre>
| |
|
| |
| To move them away from the player when finished you'll also need your own remote cell with your own XMarker in it (YourXMarker), and this section of script:
| |
| <pre>begin GameMode
| |
| if (Choosing == 0)
| |
| if ((GetInSameCell YourXMarker) == 0)
| |
| MoveTo YourXMarker
| |
| endif
| |
| ...</pre>
| |
|
| |
| ----
| |
|
| |
| * They can run even when not around the player (though only for a single frame, but enough to cause [[:Category:Tidbits#When_do_remote_activators_run.3F|problems]]).
| |
| ** This requires a bit of extra coding, to prevent them from doing something unexpected.
| |
|
| |
| Use an extra variable to mark that the menu has been initialized (variables set, other objects moved, etc.):
| |
| <pre>begin onActivate
| |
| set Choosing to -1
| |
| ; StopQuest InterferingQuest ;This is just an example of why you need the Reset variable
| |
| set Reset to 1
| |
| if ((GetInSameCell player) == 0)
| |
| MoveTo player
| |
| endif
| |
| end
| |
|
| |
| begin GameMode
| |
| if (Choosing == 0)
| |
| if Reset
| |
| ; StartQuest InterferingQuest ;Again, this is just an example
| |
| set Reset to 0
| |
| endif
| |
| if ((GetInSameCell YourXMarker) == 0)
| |
| MoveTo YourXMarker
| |
| endif
| |
| ...</pre>
| |
| Note that the activator will be moved away from the player regardless of needing to be reset. When it's not in use, it should be moved away to prevent unnecessary '''if''' tests on the activator from running (''if (Choosing == 0)'', ''If Reset'').
| |
|
| |
|
| ===What you'll need=== | | ===What you'll need=== |