Jump to content
Sign in to follow this  
LaserGuidedBunnyRabbit

Execute script according to playername

Recommended Posts

in a map I have, there are 16 players, their names are p01, p02, etc.

What I want to do is, when they step into a trigger area, that it executes a script according to their playername. I tried:

(thislist select 0) addaction ["DoSomething",format("scripts\%1%2",(thislist select 0),"\DoSomething.sqs")]

But that didn't work, any ideas?

Share this post


Link to post
Share on other sites

im not totally sure what you've done here because it looks a total mess... if your trying to add an action when all 16 people are in the trigger then simply i need to know what person your wanting to add the action to. If your wanting to add the action to the player then use

player addaction ("dowhatever", "dosomething.sqs")

in the on activation field and in the condition field use

p01 and p02 and p03 and p04 etc etc

I haven't been on these forums for some time now and i haven't made missions for some time now as i concentrate on oxygen but if this doesn't work then feel free to e-mail the mission to me at SOT_wolf@yahoo.com  wink.gif

Share this post


Link to post
Share on other sites

About the AddAction command:

When the AddAction script is executed, it is automatically called with the ActionID, the unit you added the action to and the unit that performs the action as arguments, e.g. if you used

anActionID = vehicle1 AddAction ["Destroy vehicle", "destroy.sqs"]

and the player perfoms the action, the script "destroy.sqs" is called like

[anActionID, vehicle1, player] exec "destroy.sqs"

and the arguments can thus be used within the script.

For your problem, I would use one filter script for the action that determines the calling unit, i.e. add one script to all units:

"_x AddAction [""DoSomething.sqs"", ""DetermineUnit.sqs""]" ForEach thislist

and use "DetermineUnit.sqs" to call the different players scripts:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

_callingUnit = _this select 2

?_callingUnit == someGuy: [] exec "SomeScript.sqs"

?_callingUnit == anotherGuy: [] exec "AnotherScript.sqs"

.........

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Hope this helps,

Spinor

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  

×