OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started 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. :)
-
Better ask it at Editing/Scripting: Multiplayer forum.
-
Perhaps, but the same prob occurs in single player so that really isn't the issue...
-
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? ???
-
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:
- The unit/object the action was assigned to
- The unit that activated the action
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]
-
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)