Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / The :activated condition and :activate action

Author
Message
Brian In Korea
15
Years of Service
User Offline
Joined: 1st Mar 2009
Location:
Posted: 5th Mar 2009 04:19
Can an entity have more than one activation value? Can you use the action :activate=7 and later use the action activate=8 and then later check conditions with

:activated=7, activated=8:playerdrop

When I first read about this script I was thinking about the activate like flipping a switch in a long row of switches. So if you used :activate=7 you would flip the 7th switch up and then if you used :activate=8 you would flip the 8th switch up and so on. And then later you could always check if a switch was up by using the condition :activated=7 (which would return true if switch 7 was in the up position).

Or...Can an entity only be active or not active? If this is true then it would seem to keep things simpler if you just used the actions :activate=1 (when you want to activate an entity) and :activate=0 (when you want to de-activate an entity) and then use the condition :activated=1 (to perform an action when the entity has been activated) and the condition :activated=0 (to perform an action when the entity is in its inactive state).
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 5th Mar 2009 20:32
No, the activation variable is not a boolean list of flags. It is a single integer containing a single value that will be changed upon recieving a repeated activation action.

If you activate an entity with 7 and then later activate it with 8, then the activation value of that entity will be 8. Any one entity cannot have two different activation values.

I would suggest using local variables for this.

Example:

If the script is activated with a value of 1, change the localvar 1 to 1. If it was activated with a 2, then change localvar 2 to 1. Then later you can check your localvars for having been "activated".



As for your continued confusion, the activation value can be any number falling within the limits of an integer.

Keep in mind here, the activation value serves more purpose than holding a number. It determines whether a spawnable entity should begin spawning or not. In other cases, it may also contribute to determining whether an objective is completed.


The one and only,


Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 7th Mar 2009 18:54 Edited at: 7th Mar 2009 18:59
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



=================================

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



------------------------------------------------------------------

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.




------------------------------------------------------------------


Activateifused



==========================================================

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



---------------------------------------------------------------------------------------------------------

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



==========================================================

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:



Instead of the above code, you should use the following code:



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

Login to post a reply

Server time is: 2024-11-24 21:47:32
Your offset time is: 2024-11-24 21:47:32