Difference between revisions of "MessageBox Tutorial"

Jump to navigation Jump to search
1,046 bytes added ,  11:43, 29 August 2007
→‎Activator Disadvantages: Examples and Explanations
imported>Haama
imported>Haama
(→‎Activator Disadvantages: Examples and Explanations)
Line 252: Line 252:
====Activator Disadvantages====
====Activator Disadvantages====
* They need to be [[Loaded]], or moved to the player's cell, to use effectively
* 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
** This requires extra coding, to keep them around the player, and move them back when finished.
* They can run even when not around the player (though only for a single frame, but enough to cause problems)
 
** This requires a bit of extra coding, to prevent them from doing something unexpected
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>


===What you'll need===
===What you'll need===
Anonymous user

Navigation menu