OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Garcia on 01 Jun 2008, 01:42:06
-
I want to have a player get a action, and when he uses it, I want him to do an animation (via playMove). Any good way of making it so all units see him do this action?
Problem is that many players might use the same action at the same time, and therefor I can't use global variables and pV them.
Now I'm running a script globally, and when the player uses the action, he gets a lot added to his rating. Since this is global, the script running globally checks for this high rating and then plays the animation. But I would rather do it in a better way...
-
I'm not sure about the global and local things, but I can try and help you with the addaction.
I don't know if you've already checked the COMREF, but this is some helpful stuff from the addaction:
It seems that since 1.85+(?) addAction has correctly returned action ID.
Params passed by an action to the executed script:
[(object action was attached to), (unit that activated action), (index of action)]
So an example of an action-based script goes like this:
_obj = _this select 0
_man = _this select 1
_index = _this select 2
If you want to remove the action from the object immediately after it's triggered, use this line along with the above:
_obj removeAction _index
You could use the second param passed to check who's activated the script, regardless of who it's attatched to.
-
Yeah I've got the addAction set up properly. Problem is getting from what I write in the script run by addAction to playing the animation on all clients :confused:
-
CoC NS2 (http://www.ofpec.com/forum/index.php?topic=30650.0). You can do what you need with a single line of code.