Since this has a pretty decent topic description I thought I would add the following. Plystire if you see anything wrong with the definition and/or usage, feel free to correct me.
Activated
:state=0,activated=1:state=10
:state=10:[Perform some type of action here]
=================================
While the state equals '0'' the game engine will check to see what the current activation value is. If the activation value that was assigned by another entity's script (activateifused) is equal to '1' and if it points to the entity that contains this script then the action on this line will be performed.
USAGE
;Artificial Intelligence Script
;Header
desc = Remote Controlled Door (Open and Close)
;Triggers
L1) :state=0,activated=1:state=1,setframe=0,sound=$0
L2) :state=1:incframe=0
:state=1,frameatend=0:state=2,coloff
:state=2,activated=0:state=3,sound=$1,colon
:state=3:decframe=0
L6) :state=3,frameatstart=0:state=0,setframe=0
;End of Script
------------------------------------------------------------------
Upon each iteration of the game loop L1 will be executed until the activation level for this entity is set to 1. The activated condition will continually check to see if it is 1 and when it is finally equal to 1 then it will execute the three actions contained on that line. The first action changes the state of the script. The second action sets the animated frame of the door to 0, and the third action plays the sound of the door that is found in the doors first sound parameter. Once these actions are completed then L2 through L6 will be executed and the state will be set back to 0.
------------------------------------------------------------------
Now, let's look at an entity that uses multiple activated values.
;Artificial Intelligence Script
;Header
desc = Transport To Entity Name
;Triggers
L1) :state=0:rundecal=2,coloff
L2) :state=0,activated=9:state=1
L3) :state=1,activated=3:state=2
L4) :state=2,activated=4:state=4
L5) :state=4,plrhigher=10,plrdistwithin=50:state=10,plrsound=audiobankscifisceneryliftsteleport.wav,plrmoveifused
L6) :state=10:none
;End of Script
------------------------------------------------------------------
Activateifused
:state=0,[check for a particular condition here]:activateifused=1,state=1
:state=1:none
==========================================================
In state 0, if a particular condition is met then the script for the entity that is found in this entity's If Used parameter will be executed immediately and the activated variable will be set to 1.
USAGE
;Artificial Intelligence Script
;Header
desc = when player gets within 60 units of object activate entity specified in the If Used parameter
;Triggers
L1) :state=0,plrdistwithin=60:activateifused=1,state=1
L2) :state=1:none
;End of Script
---------------------------------------------------------------------------------------------------------
Upon each iteration of the game loop L1 will be executed until the player is within a distance of 60 units. When the player is withing that distance, then the actions on that line will be executed. The entity that is found in the If Used parameter of this script will be activated in the sense that its script will be executed immediately and that activated variable will be set to 1. The state will be changed to 1 and nothing will happen in this entity's script each time the game engine loops.
SEE ALSO
The Activate action.
Activate
L1) :state=0,[check for a particular condition here]:activate=1
L2) :state=0,activated=1:[perform some type of action here],activate=2
L3) :state=0,[check for a particular condition here]:state=10
L4) :state=0:[perform some type of action here]
L5) :state=10:[perform some type of action here]
==========================================================
This example maintains the same state in order to perform certain types of actions according to particular conditions. However, when a certain condition is met it will break out of state 0 and move on to state 10. In L1 we see that when a certain condition is met it will set the activate variable to 1. Once this variable is set to 1, L2 will then execute. If the necessary condition of L2 is not met then L3 will be executed. If the necessary condition is not met in L3 then L4 will be executed. The next time the game engine repeats it's loop then all of the lines that contain the state condition of 0 will again be executed. If ever the condition in L3 is met then it will break out of the state 0 condition and move on to L5. If ever the condition is met in L2, the the activate variable will be set to 2. Once the activate variable is set to 2, then L2 will never be executed again.
The following example would not be a good way to use this action:
:state=0,[check for a particular condition here]:activate=1
:state=0,activated=1:state=10
:state=10:[perform some type of action here]
Instead of the above code, you should use the following code:
:state=0,[check for a particular condition here]:state=10
:state=10:[perform some type of action here]
USAGE
None given.
__________________________________________________________
Make life a little easier and use
FPI Editpad for your sctripting needs.
Now with Line Numbers. V3.3.81 is now available and it is still free.
The past has a lot of memories to hold onto; but, today is chock full of new adventures, and, the future shouts out, "The best is yet to come!" -- TerryC