Jump to content
Sign in to follow this  
sealed

AddAction -how to detect who activated the action?

Recommended Posts

Let's say I have 3 playble units (in MP) that all has the same action (AddAction..), but the action should only happen to the player that activated it (via player's own actionmenu of course). So is there anyway to detect who of the 3 players activated it? Thanks.

Share this post


Link to post
Share on other sites

Create a trigger like this:

Activation: None / repeatedly

Condition: alive player

On Activation: PID = player; PAID = PID addAction ["Example","yourScript.sqs",[],-1,false]

On Deactivation: PID removeAction PAID

In your script you put in the first line:

if (not local player) then {exit}

whistle.gif

Share this post


Link to post
Share on other sites

Its difficult to see whats going on without seeing the script thats executed but heres how you can check which unit is executing the script.

In your script add 3 if statements, when one of the three players activates the script only one of those if statements will be true and so it will send out a groupchat message coming from him. Modify the script to suit your needs but this is how you can do what you asked.

west1,west2,west3 are the unit names of your soldiers

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

?(player == west1): west1 groupchat "i activated the script"

?(player == west2): west2 groupchat "i activated the script"

?(player == west3): west3 groupchat "i activated the script"

Share this post


Link to post
Share on other sites

WOW.... seriously...

all of these answers are way out of the ballpark.

You need to know who actvated an action? simple:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_this select 1

That will give you the unit that activated it.

Likewise,

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_this select 0 will give you the unit the action is attached to.

A simple lookup of the command on the wiki or OFPEC would have told you that

http://community.bistudio.com/wiki/addAction

[EDIT] I must apologize a bit. I really dont mean to scare off potential helpers in answering questions. We all know we have too few these days. However, before "workaround" solutions are given to a problem, one should really check one of the other websites or research a bit instead of assuming that there isn't a command/parameter/script which already exists and solves their problem. wink_o.gif

Share this post


Link to post
Share on other sites
WOW.... seriously...

all of these answers are way out of the ballpark.

Haha, I was thinking the same thing before I saw your post.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×