Jump to content
Baernie

Trying to addAction for Multiplayers

Recommended Posts

I'm trying to add an Action for players while they are in a vehicle and within the radius of a Vehicle Ammo Box, the script to be run needs to be client side with the vehicle they are in as a parameter and I'm having a hard time trying to figure it out so far i've managed to get the action to be added while the player is within the vehicle locally also still unable to figure out how to remove the action once out of the vehicle.

Share this post


Link to post
Share on other sites

Welcome to the forums.

If we are talking about a limited amount of players you can use this:

 

 

place a different variable for each player and use the removeAllActions NameOfUnit; command to erase the actions. This method will help with any locality issues too. The variable can be set not on the units init but in a trigger that will fire when the unit is almost near the addAction trigger. 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

It worked nicely thank you! Is there anyway to hold a check before hand to check if the player is in a vehicle?
Edit: Nevermind i managed to figure out a way to do it !

Edited by Baernie
  • Like 1

Share this post


Link to post
Share on other sites

Just to precise some points:

When you place an addAction, keep on mind the inner condition is checked:

- on each frame when on player,

- when player is looking at the object, within 50 m from it, if applied to the object (but this built-in condition is to be checked on each frame anyway)

 

That means, you must apply addAction on object each time it's possible. It's resource saving, especially for elaborated conditions.

If you apply addAction to player, you need to add condition for displaying or not the action in the menu. (like: !isNull objectParent _this   for displaying an action when inside a vehicle).

And try to avoid removeAllActions which is a Thor hammer to open a nut. You can easily remove the due action, adding in the inner code an end condition then _target removeAction _id;  where _target and _id are the declared variable in this code . See addAction BIKI.

  • Like 2
  • Haha 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×