Jump to content
Sign in to follow this  
NeV3rKilL

setTriggerStatements And local variables.

Recommended Posts

Hello.

I'm creating a script and i need that an activator was activated when a player enter in a car.

I have done with:


_trg setTriggerStatements["player in CarsName", "hint 'You'r IN'",""];
[/Code]

but this is unusable for me, I need that CarsName was a local variable and not a global variable.

My script is like:

[Code]_car001 = _this select 0;
_trg=createTrigger["EmptyDetector",getPos player];
_trg setTriggerStatements["player in _car001", "hint 'You are IN'",""];[/Code]

With this last form the script not works. How can I do it?

Thank you!

Share this post


Link to post
Share on other sites

_car001 setVehicleVarName format ["%1%2%3",typeof _car001,round(getpos _car001 select 0),round(getpos _car001 select 1)];
_trg setTriggerStatements[format["player in %1",_car001], "hint 'You are IN'",""];

First line is not required if the car has a name already, if not then it just assign one for it, because the trigger field won't like the game generated object name (like: O 1-1-H:1).

Share this post


Link to post
Share on other sites
_car001 setVehicleVarName format ["%1%2%3",typeof _car001,round(getpos _car001 select 0),round(getpos _car001 select 1)];
_trg setTriggerStatements[format["player in %1",_car001], "hint 'You are IN'",""];

First line is not required if the car has a name already, if not then it just assign one for it, because the trigger field won't like the game generated object name (like: O 1-1-H:1).

I don't know why what your solution don't work for me.

I have tried, for example:

_car001 setVehicleVarName foo;
_trg setTriggerStatements["player in foo", "hint 'You are IN'",""];

to do it more simple, but stills without works :(

If I put a name in the editor then runs ok.

Share this post


Link to post
Share on other sites

_car001 setVehicleVarName "foo";

Needs to be a string.

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  

×