Here's a simple way to use addAction that works in MP and doesn't need much scripting or coding knowledge.
You'll need a named object or (nonplayable) unit and a trigger.
In your unit/object's init field (you can use object's name or 'this', since it's the object's init):
In short, this adds a variable to remove the action, transmits a public variable when activated and also ensures you can't see the action until you're less than 3m away from the object it's assigned to (bigger the object, larger the distance you can see addAction from).
In the trigger Condition line:
Once the addAction is activated, myVariable will equal true and activate the trigger.
In the trigger Activation line:
Since the action was added everywhere (everyone loaded the same object with the same init when starting the mission) and the trigger exists everywhere, the trigger will activate and remove the action everywhere. You can add whatever else you want to do with addAction in the Activation line.
Read more:
https://community.bistudio.com/wiki/addAction
Tips:
You can use commands with global effect in the addAction's code line reliably, such as setDamage or deleteVehicle:
Above action would delete the object it was added to, removing the need to use a ID handle as the unit no longer exists.
You'll need a named object or (nonplayable) unit and a trigger.
In your unit/object's init field (you can use object's name or 'this', since it's the object's init):
Code:
actionIDhandle = objectName addAction ["<t color='#FF0000'>Your action text here</t>",{myVariable = true; publicVariable "myVariable"; },nil,1,true,true,"","_target distance _this < 3"];
In short, this adds a variable to remove the action, transmits a public variable when activated and also ensures you can't see the action until you're less than 3m away from the object it's assigned to (bigger the object, larger the distance you can see addAction from).
In the trigger Condition line:
Code:
myVariable
Once the addAction is activated, myVariable will equal true and activate the trigger.
In the trigger Activation line:
Code:
objectName removeAction actionIDhandle;
Since the action was added everywhere (everyone loaded the same object with the same init when starting the mission) and the trigger exists everywhere, the trigger will activate and remove the action everywhere. You can add whatever else you want to do with addAction in the Activation line.
Read more:
https://community.bistudio.com/wiki/addAction
Tips:
You can use commands with global effect in the addAction's code line reliably, such as setDamage or deleteVehicle:
Code:
objectName addAction ["Delete me",{deleteVehicle (_this select 0)}]
Above action would delete the object it was added to, removing the need to use a ID handle as the unit no longer exists.