Jump to content
doomnet

[SOLVED] how to launch a script from trigger for only the player who enter it ?

Recommended Posts

Hi,

 

Its a very noob question but i can't remember how to launch a script from a trigger for the player who enter the trigger area

 

because the script fires for every player !

 

if someone could give me an example:

 

i know its something with foreach this list

 

thanks

Share this post


Link to post
Share on other sites

Setup the trigger as normal but in condition field get rid of:

this

and replace with:

Player in thisList

Edit:

That's if you want the trigger to fire only for the player who enter the trigger.

  • Like 1

Share this post


Link to post
Share on other sites

Setup the triggers as normal but in condition field get rid of:

this

and replace with:

Player in thisList

what is the right syntax ?

 

because this is not working

Player in thisList execVM "scripts\damage.sqf";hint "Get out of the forbidden zone"

Share this post


Link to post
Share on other sites

In condition field of the trigger:

Player in thisList

In activation field:

0 = this execVM "scripts\damage.sqf";hint "Get out of the forbidden zone"

  • Like 1

Share this post


Link to post
Share on other sites

In condition field of the trigger:

Player in thisList

In activation field:

0 = this execVM "scripts\damage.sqf";hint "Get out of the forbidden zone"

 

and on deactivation field ?

 

because my script does not launch if i use it like your example above on deactivation field.

 

0 = thisList execVM "scripts\undamage.sqf";

Share this post


Link to post
Share on other sites

and on deactivation field ?

 

because my script does not launch if i use it like your example above on deactivation field.

 

0 = thisList execVM "scripts\undamage.sqf";

Without looking at the undamage.sqf I'd say make sure the trigger is set to repeatable. Silly I know but a double-check doesn't hurt.

If that ain't the problem then I'd check the required parameters for the undamage.sqf. If you can't find anything wrong post the script.

  • Like 1

Share this post


Link to post
Share on other sites

 

Use Johnny's Trigger List Changed

 

Link: 

https://forums.bistudio.com/topic/179622-script-trigger-list-changed-v21-handle-units-which-enteredleft-a-triggers-list/

thank you for that link xd but i don't know what to do with that its more complicated for me, i just need the player who get out the trigger area launch the script with on deactivation.

 

my scripts launches on activation and deactivation, but on all players, so i just need to launch the script for the player enter the trigger area

 

 

Share this post


Link to post
Share on other sites

Without looking at the undamage.sqf I'd say make sure the trigger is set to repeatable. Silly I know but a double-check doesn't hurt.

If that ain't the problem then I'd check the required parameters for the undamage.sqf. If you can't find anything wrong post the script.

yes its on repeat but it worked before i use Player inthislist so i don't know why it does not launch now

Share this post


Link to post
Share on other sites

my to little scripts damage.sqf and undamage.sqf are just camera effects and works with the triggers on activation and deactivation, but the problem is it works for every player in game

because i used :

 

on activation

null = [this] execVM "scripts\damage.sqf";hint "Get out of the forbidden zone"

on deactivation

null = [this] execVM "scripts\undamage.sqf";

so with

 

In condition field of the trigger:
Player in thisList

In activation field:
0 = this execVM "scripts\damage.sqf";hint "Get out of the forbidden zone"

 

"it works also" but not in

 

on deactivation field:

 

0 = this execVM "scripts\undamage.sqf"

  • Thanks 1

Share this post


Link to post
Share on other sites

Ah, sorry for being unclear in my first response. You can use the same code in activation and deactivation as you used before.

The only change required is to set the condition field to: player in thisList

Nothing else needs to change.

  • Like 1

Share this post


Link to post
Share on other sites

Ah, sorry for being unclear in my first response. You can use the same code in activation and deactivation as you used before.

The only thing required to make the trigger work is to set the condition field to: player in thisList

Ok nice yes thanks i go try that out !

Share this post


Link to post
Share on other sites

Ok nice worked !!!

thank you Mrcurry

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

×