OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Wildebeest on 10 Sep 2002, 17:47:07

Title: Probs with action commands
Post by: Wildebeest on 10 Sep 2002, 17:47:07
Hi, I've got a little problem with adding action commands. I know how to add the commands like this: 'ActionName = aP AddAction ["text", "script"]', howerver, I would like the command only to appear for one guy in the game. When I add an action command in the mission every player (it's a multiplayer mission) in the game can use it. Plz help thx.  :)
Title: Re:Probs with action commands
Post by: seanver on 10 Sep 2002, 20:02:30
Better ask it at Editing/Scripting: Multiplayer forum.
Title: Re:Probs with action commands
Post by: Wildebeest on 10 Sep 2002, 21:40:00
Perhaps, but the same prob occurs in single player so that really isn't the issue...
Title: Re:Probs with action commands
Post by: seanver on 10 Sep 2002, 22:34:31
Quote
When I add an action command in the mission every player (it's a multiplayer mission) in the game can use it

In a single player mission it is impossible that "every player" in the game can use the action menu since there's only player. So am I missing something?  ???
Title: Re:Probs with action commands
Post by: Sui on 11 Sep 2002, 03:32:25
Welcome to the forums, Wildebeest

When you use a user added action (ie. when the player clicks on it) it actually passes two variables to the script.
These variables are:
So, using a line like this:

? (_this select 1) != aP: exit

You could make the script exit if any unit besides aP activates the action.

Other players could still click the action, but the script won't activate for them...

That's the best thing I can think of... as far as I know there is no way of making it so the action doesn't show up unless you are a specific player. Unless you remove the action if another player is near... but that means aP won't be able to use it either...

Anyway, hopefully that will help you out a bit ;)

[edit]I can barely type with dese fdat fingers ;D[/edit]
Title: Re:Probs with action commands
Post by: Backoff on 11 Sep 2002, 13:00:29
Hello,

In fact the script used with addaction will have THREE params passed. The two first are, as Sui nicely said, the object id on which the action was added, the player id who used the action and third the action id (the id returned with the addaction command, which is really useful).

That was for the precisions  ;)

As for the problem where other players can see the action of a specific player (wich is a normal effect in the game), you can check the player id before adding the action:

?(Player == MyPlayer): _act = MyPlayer addaction ["blabla","blabla.sqs"];

this way, only MyPlayer will have the action effectivly added.

Happy editing  8)