hoax2 11 Posted October 9, 2015 I've been searching all over the place to find a solution to this, I think I'm super close, but I need help from someone more experienced. ObjectiveI'm creating a multiplayer death-match. When players leave the play-area they receive a countdown and a warning to return before they are killed. To complicate things the play-area changes location dynamically. I've found an old script I'm quite fond of by taco3866521 which works when a player enters a trigger. But having to setup multiple boundary triggers (North, East, South, West) and move them around dynamically seems overkill and super difficult for what I'm doing. So I've been trying to use a single trigger to define the play-area and do same thing but I'm struggling. Here's what I have. So far I have this Trigger: BluFor, Repeatably, Present. //Condition: not(player in thislist) //Activation: hint "OUT"; 0 = [] spawn { player Groupchat "WARNING:3"; sleep 1; player Groupchat "WARNING:2"; sleep 1; player Groupchat "WARNING:1"; sleep 1; player setDamage 1; } //Deactivation: hint "IN"; Problem I don't know how to stop the activation script once it's started, if I return to the area the activation script is already running and will continue the countdown. I feel like maybe I need to add a variable to the player somehow and check it like taco3866521's script? Or maybe somehow just pass this player to taco's script? Both of which I have no idea how to do. Any ideas? Share this post Link to post Share on other sites
spidypiet 17 Posted October 9, 2015 i would use 2 triggers on top of each other 1e for the countdown without player setDamage 1; 2e for the setdamage with a 4second timout delay and with only player setDamage 1; you stil get the countdown to 1 when you'r back in the trigger_zone but only die outside the zone Share this post Link to post Share on other sites
R3vo 2654 Posted October 9, 2015 Isn't there a module for this? Share this post Link to post Share on other sites
Stormridge 3 Posted October 9, 2015 Check out For loops and the exitWith command. Those will help you here. Try something like this. (syntax might be slightly off) hint "OUT"; 0 = [] spawn { damagePlayer = true; for [{_i=3},{_i>=0},{_i=_i-1}] do { player Groupchat "WARNING"; sleep 1; // Check if (player distance triggername > distance) exitWith {damagePlayer=false}; }; if (damagerPlayer) then {player setDamage 1;}; }; 1 Share this post Link to post Share on other sites
hoax2 11 Posted October 10, 2015 Oh thank you so much Stormridge! That was pretty much perfect (just a few typos) If anyone is interested here is my setup: Trigger named "aoe", BluFor, Repeatably, Present. Axis = 50 //Condition: not(player in thislist) //Activation: 0 = [] spawn { damagePlayer = true; for [ {_i=10} , {_i>=0} , {_i=_i-1} ] do { player Groupchat (format ["WARNING: %1",_i]); sleep 1; if (player distance aoe < 50) exitWith {damagePlayer=false}; }; if (damagePlayer) then {player setDamage 1;}; }; Thanks others for your ideas.@spidypiet that sounds like it might work but not ideally. @R3vo, maybe? What's it called? Share this post Link to post Share on other sites
terox 316 Posted October 10, 2015 I have another solution. This one bounces the player back into the A.O. without killing them, it simply stops them from leaving the A.O period. They end up moving at the same velocity they entered the trigger but 180 degrees to their initial direction. It's a bit disorientating for them, but i find this a much better solution than a countdown timer to a kill // AUTHOR : Original Mike (MK4) // MP MACHINE : ALL // Called from : Trigger On activation field // Called using : nul = [0] spawn Txu_fBorderControl; // Time Called : Trigger activatiion // Description : // // COMMENTS : // // Create a trigger with the following settings: // - Repeatedly // - Activation by (side you wish to impose the LOA on) // - Cond: (vehicle player in thisList) // - On Act: nul = [] spawn Txu_fBorderControl; // - On Deact: // // To exclude a player or a vehicle from the LOA, put this in its init line: // this setVariable ["Txu_NoLOA", false]; // // private[ "_distance", "_msg", "_vel", "_velX", "_velY", "_velZ", "_dir", "_pos", "_posX", "_posY", "_posZ", "_eh", "_key", "_disabledKeys" ]; _veh = vehicle player; _distance = 8; // preferred bumping distance if ( format["%1",_veh getVariable "Txu_NoLOA"] != "false" ) then { // send the player a message (standard msg when none was given) _msg = if (count _this > 0) then { _this select 0 } else { format["%1, you were entering a RESTRICTED ZONE. Check your map.", toUpper(name player)] }; titleText [_msg, "PLAIN"]; // no need for multiple people to do this if ( player == driver _veh ) then { // get the velocity vector _vel = velocity _veh; _velX = _vel select 0; _velY = _vel select 1; _velZ = _vel select 2; // get the direction of movement (could be different from the direction of the unit) _dir = [[0,0,0], _vel] call Txu_Misc_fDirTo; // turn 180 _dir = _dir + 180; _veh setDir _dir; // place unit a few meters forward _pos = getPosATL _veh; _posX = _pos select 0; _posY = _pos select 1; _posZ = _pos select 2; _veh setPosATL [(_posX + sin(_dir) * _distance), (_posY + cos(_dir) * _distance), _posZ]; // reverse the velocity vector _veh setVelocity [-_velX, -_velY, -_velZ]; // if it was a footmobile, freeze userinput for a second // - needed because the LOA will be checked every 0.5 sec // - workaround for buggy disableUserInput if ( player == _veh ) then { Tx_fDisableMovementKeys = { _key = _this select 1; _disabledKeys = (actionKeys "moveForward") + (actionKeys "moveBack") + (actionKeys "MoveLeft") + (actionKeys "MoveRight"); if ( _key in _disabledKeys ) then { true } else { false }; }; _eh = (findDisplay 46) displayAddEventhandler ["keyDown", "_this call Tx_fDisableMovementKeys"]; uisleep 1; (findDisplay 46) displayRemoveEventHandler ["keyDown", _eh]; }; }; }; // end Share this post Link to post Share on other sites
killzone_kid 1330 Posted October 11, 2015 somehandle = [] spawn {sleep 1; sleep 1; sleep 1....}; you can stop any spawned script with terminate somehandle https://community.bistudio.com/wiki/terminate 1 Share this post Link to post Share on other sites