Home   Help Search Login Register  

Author Topic: How to change the rules of the AddAction command?  (Read 2017 times)

0 Members and 1 Guest are viewing this topic.

Offline PivMan

  • Members
  • *
How to change the rules of the AddAction command?
« on: 26 Jul 2013, 19:47:59 »
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?
« Last Edit: 26 Jul 2013, 21:16:58 by PivMan »

Offline Lone~Wolf

  • Mission Tools & Mods
  • Members
  • *
  • Vladimir Dmitri Mikhail Andreevich Stamenov
Re: How to change the rules of the AddAction command?
« Reply #1 on: 28 Jul 2013, 18:32:17 »
Try putting in an "init.sqs" file (if you haven't already) and in it put the line

Code: [Select]
player addAction ["Move Campfire","campfire.sqs"]
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: [Select]
? !(this select 0 == this select 1) : exit
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.
Snarling creature, lurking in the background, still writing in .sqs