Jump to content
Sign in to follow this  
Wobbleyheadedbob

VERY noob question about Editor placed triggers

Recommended Posts

I'm using a bit of a workaround to do respawning on a mission whereby players choose a spawn location for when they die.

It all works well except for 1 little snag. When we tried it on the dedi-server the trigger fires for everyone not just the player who spawns in it's radius.:mad:

I'm guessing this is because I'm calling a function in the "On Activation" field and passing in "player".

The trigger has the following:

Condition: this

On Act: [player] call fn_multiSpawn

//fn_multiSpawn
private ["_mySoldier"];
_mySoldier = _this select 0;

_mySoldier setPos ([myRespawnPoint, 10] call CBA_fnc_randPos);

My Question is, how do I call this function so that it only fires for the player in the trigger radius?

Share this post


Link to post
Share on other sites

Condition: this

That means the trigger will be fired based on the activation settings (blufor present etc). So, when any blufor unit, player or not, enters the area, it will fire. Passing player is correct, but it doesn't limit the activation in anyway.

Share this post


Link to post
Share on other sites

Thank you! That helps a lot. Like I said, I'm still learning. While I understand programming concepts, ARMA is proving quite a challenge.

I ran into another problem wherby I'm struggling to get a script run for each player to do some local initialisation.

At first I used this call in the init.sqf:

if (!isNull player) then { call compile preprocessFileLineNumbers "functions\common\initSpawn.sqf"; }; 

That worked, but only for players who were in the lobby at start, JIP players didn't get their variables initialised properly. I'm guessing becasue the init.sqf only gets called on mission load.

I then tried this which seemed more logical:

//In the player init field:
0 = [this] execVM "functions\common\initSpawn.sqf";

This worked great until I found that whenever a player connected this was being called for all players. So I'm now very confused as my understanding was 'this' when used in the player init. only returns the object the init line belongs to, my thought was that it would only run for that player.

What is best practice for calling a clientside script when a player connects? (JIP friendly)

Share this post


Link to post
Share on other sites

init.sqf:

waituntil {!isnull player};
[player] execvm "functions\common\initSpawn.sqf";

Another way is to create a trigger with condition:

local player

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  

×