Editors Depot - Mission Editing and Scripting > OFP - Editing/Scripting Multiplayer

How to change the rules of the AddAction command?

(1/1)

PivMan:
Hi Ofpec. I ran into another issue.

In my mission I want any player to have control over the position of a single campfire on the map. I want the option "Set Campfire" to be always available in the action menu, and when used, to place the campfire at the player's position.

I can work moving the campfire just fine, but the properties of adding an action to the action menu aren't what I want them to be. Adding an action to a unit doesn't restrict the action option to that one unit, any player can access it if they're an unreasonable distance away. So I basically don't want to have the option at one point, get close to my friend's player character, and another one appears, doing the same thing.

I also have plans for simulating picking up crates, so knowing how to change the required distance to an object would be great too. I've searched all over for this and have come up short. I'm aware the action has other optional parameters that can be used, but I do believe those only apply to other BIS games.

Any ideas?

Lone~Wolf:
Try putting in an "init.sqs" file (if you haven't already) and in it put the line


--- Code: ---player addAction ["Move Campfire","campfire.sqs"]
--- End code ---

or whatever you've called it. It should only give the action clientside for each player. Failing that, you could just put in a line to prevent the wrong one being called if there are multiple ones due to players being near each other, such as by the line


--- Code: ---? !(this select 0 == this select 1) : exit
--- End code ---

near the beginning.

Or if you really are desperate to ensure two nearby players don't see multiple copies of the action, you could have a separate monitoring script that removes one of the actions (remember to globally name each action for easy removal) if two players are too near each other. The distance could be worked out by trial and error.

Navigation

[0] Message Index

Go to full version