clydefrog 3 Posted July 5, 2013 (edited) I'd like to make a PVP mission where I could have it so all of one team are locked into a defined area, so they are forced to defend that area against an invading team. Ideally this would be some kind of invisible wall that only the defending team can't walk through, but other things could work too. Does anybody know how I'd go about doing this or know of any scripts (from arma 2 also) that can do such a thing? Also if not can anybody suggest any alternatives? One thing I can think of right now would be to have a trigger for each player that detects if they are outside the trigger area, and then sets their position back inside the area, but it wouldn't be the greatest way to do it... Hopefully if that is my only option the BIS_fnc_inTrigger function still works in Arma 3 (I guess there are other ways if not anyways so it doesn't matter too much, but like I say I'd rather not have to do it this way) then I would have for example: Condition: !([defendarea, position unit1] call BIS_fnc_inTrigger) onAct: unit1 setPos (getMarkerPos "respawn_east"); Cheers. Edited July 6, 2013 by clydefrog Share this post Link to post Share on other sites
kylania 568 Posted July 6, 2013 Make the zone the island, use water as your "walls". :) There's some whole new Curator thing that's in beta that seems to be for this kind of thing maybe? Poke around with that? Zone/round based pvp doesn't excite me so I've never really paid much attention, sorry. :) Share this post Link to post Share on other sites
clydefrog 3 Posted July 6, 2013 Make the zone the island, use water as your "walls". :)There's some whole new Curator thing that's in beta that seems to be for this kind of thing maybe? Poke around with that? Zone/round based pvp doesn't excite me so I've never really paid much attention, sorry. :) Thanks, I'll have a look, what do I actually need to search for to find that thing? I tried "arma 3 curator" but got nothing. The island isn't really doable, it needs to be one of the areas with a few buildings that will have an AI target for blufor inside one of them, and so blufor can land a distance from it and head in on foot, preferably not through water :p Share this post Link to post Share on other sites
Larrow 2822 Posted July 6, 2013 You could just place a trigger thats your area that you dont want them to leave plus a tiny bit bigger. ACTIVATION : Blufor, present, repeat Int the onAct spawn a loop that checks the triggers list, foreach object if it is further away than triggers area (minus a little) move them back to triggers area. handle = [thisTrigger] spawn { _trig = _this select 0; _dist = ((triggerArea _trig) select 0)-0.5; while {true} do { _list = list _trig; { if ((_x distance _trig) > _dist) then { _dir = [_trig, _x] call BIS_fnc_dirTo; _pos = [_trig, _dist, _dir] call BIS_fnc_relPos; _x setPosATL _pos; } }forEach _list; }; }; Share this post Link to post Share on other sites
clydefrog 3 Posted July 6, 2013 You could just place a trigger thats your area that you dont want them to leave plus a tiny bit bigger.ACTIVATION : Blufor, present, repeat Int the onAct spawn a loop that checks the triggers list, foreach object if it is further away than triggers area (minus a little) move them back to triggers area. handle = [thisTrigger] spawn { _trig = _this select 0; _dist = ((triggerArea _trig) select 0)-0.5; while {true} do { _list = list _trig; { if ((_x distance _trig) > _dist) then { _dir = [_trig, _x] call BIS_fnc_dirTo; _pos = [_trig, _dist, _dir] call BIS_fnc_relPos; _x setPosATL _pos; } }forEach _list; }; }; Hmmm, thanks, I'll give this a try later. Share this post Link to post Share on other sites
clydefrog 3 Posted July 6, 2013 (edited) I've just tried this, it's very glitchy and if I run to the edge of the trigger it's like I'm stuck on it and can't move back. Have you tried it yourself? Edited July 6, 2013 by clydefrog Share this post Link to post Share on other sites
Larrow 2822 Posted July 6, 2013 Yes i have tried it in preview and as hosted and worked fine for me. Player is stopped at boundary and can turn away freely. I test everything i post unless stated otherwise. Of course i cannot test all instances of how someone may implement my code snippets but they should give someone an idea on maybe implementing their own solution. test mission Share this post Link to post Share on other sites
clydefrog 3 Posted July 6, 2013 (edited) Yes i have tried it in preview and as hosted and worked fine for me. Player is stopped at boundary and can turn away freely.I test everything i post unless stated otherwise. Of course i cannot test all instances of how someone may implement my code snippets but they should give someone an idea on maybe implementing their own solution. test mission I'll check that cheers. I just made a blufor present trigger set to repeating as you said and copy and pasted that code into the onAct. Ok, I see it works with your settings of 10x10 metres but when I try a large area with that trigger (170x200) it doesn't work at all. Edited July 6, 2013 by clydefrog Share this post Link to post Share on other sites
Larrow 2822 Posted July 6, 2013 Mmm dont know then, if you get the same from the test mission only thing could be down to computer performance, slight lag in performance could cause check to pop in late or something so you get stuck on the boundary. ?? but only guessing why it would work differently for you Share this post Link to post Share on other sites
clydefrog 3 Posted July 6, 2013 Mmm dont know then, if you get the same from the test mission only thing could be down to computer performance, slight lag in performance could cause check to pop in late or something so you get stuck on the boundary. ?? but only guessing why it would work differently for you I don't know what happened last time with the getting stuck, it seems like different trigger size settings affect if differently, because now when I use your trigger but set it to 170x200 the trigger doesn't work at all, I can run straight out of it and carry on and it doesn't stop me. :confused: Share this post Link to post Share on other sites
Larrow 2822 Posted July 6, 2013 because now when I use your trigger but set it to 170x200 the trigger doesn't work at all, I can run straight out of it and carry on and it doesn't stop me. That because this example only takes into account one axis, it was quickly written to show you how todo it via a round trigger (all axis equal). If you want an elliptical trigger like that then youll need to change the script to account for this. Get yout trig head on :D Share this post Link to post Share on other sites
clydefrog 3 Posted July 6, 2013 (edited) That because this example only takes into account one axis, it was quickly written to show you how todo it via a round trigger (all axis equal). If you want an elliptical trigger like that then youll need to change the script to account for this. Get yout trig head on :D lol, I don't even understand that thing you did so this is doubtful but I'll have a look. Actually, no, I wouldn't have a clue haha. I just tried making both axis equal (200x200) and just get stuck on the edge of the trigger again, ahhhh. Edited July 6, 2013 by clydefrog Share this post Link to post Share on other sites
Larrow 2822 Posted July 6, 2013 Ok try this, this should account for round, elliptical and square. Has a few issue that would need cleaning up but its a point in the right direction :D. handle = [thisTrigger] spawn { _trig = _this select 0; while {true} do { _list = list _trig; { if(([_trig, getPosATL _x, true] call BIS_fnc_inTrigger) >= -1) then { _dir = [_trig, _x] call BIS_fnc_dirTo; _dist = (_x distance _trig) - 0.05; _pos = [_trig, _dist, _dir] call BIS_fnc_relPos; _x setPosATL _pos; }; }forEach _list; }; }; Thats wierd not once in testing any off these have i actaully got stuck on the boundary :/ Share this post Link to post Share on other sites
mikie boy 18 Posted July 6, 2013 WestRestZone = name a Gamelogic here; //object to which the distance applies to EastRestZone = name a Gamelogic here; RestrictionLength = prive a maximum distance here; FOCK_deathViaWaituntil = { _units = player; sleep 1.5; while {restrictedZone} do { _damageUnits= getDammage _units; _units setdamage (_damageUnits + 0.1); sleep 1.3; if (!alive _units) then {restrictedZone = false;}; }; }; FOCK_RestrictWest = { while {true} do { //change this to < tho keep tehm out - > to keep them in waituntil {player distance WestRestZone > RestrictionLength}; _picWTri = "img\warntriangle.paa";///you need a pick here or just replace line below with standard hint hint parseText format["<img size='2.0' image='%1'/> Do not approach Opfor Base!, Go Back Now",_picWTri]; restrictedZone = true; [] spawn FOCK_deathViaWaituntil; waituntil {player distance WestRestZone > RestrictionLength}; if(Alive player) then { hint "You have cleared out of the Restricted Zone"; }; restrictedZone = false; }; }; FOCK_RestrictEast = { while {true} do { //change this to < tho keep tehm out - > to keep them in waituntil {player distance EastRestZone > RestrictionLength}; _picWTri = "img\warntriangle.paa"; ///you need a pick here or just replace line below with standard hint hint parseText format["<img size='2.0' image='%1'/> Do not approach Blufor Base!, Go Back Now",_picWTri]; restrictedZone = true; [] spawn FOCK_deathViaWaituntil; waituntil {player distance EastRestZone > RestrictionLength}; if(Alive player) then { hint "You have cleared out of the Restricted Zone"; }; restrictedZone = false; }; }; //each player executes this on start up and on repsawn if (side player == West) then {[] spawn FOCK_RestrictWest;}; if(side player == East) then {[] spawn FOCK_RestrictEast;); Share this post Link to post Share on other sites
clydefrog 3 Posted July 7, 2013 (edited) Thanks Mikie but it's not working for me, nothing happens so I think I'm not understanding something. I've attached my mission file, could you take a look? cheers. http://www.mediafire.com/?cyb1di35nqa5359 Edited July 7, 2013 by clydefrog Share this post Link to post Share on other sites
mikie boy 18 Posted July 8, 2013 tried and tested - was the spawn part that wasnt working - needed a handle to call it for some reason - works well now - ive left the hints in for you so you can follow - and the hints for the damage hint "play areas.sqf started"; if (isnil "restrictedZone") then {restrictedZone = false}; WestRestZone = WestArea; //object to which the distance applies to EastRestZone = EastArea; RestrictionLength = 10; FOCK_deathViaWaituntil = { _units = player; sleep 1.5; while {restrictedZone} do { _damageUnits = getDammage _units; hint format ["Health: %1", _damageUnits]; _units setdamage (_damageUnits + 0.1); sleep 1.3; if (!alive _units) then {restrictedZone = false;}; }; }; FOCK_RestrictWest = { hint "Restrict West function started"; while {true} do { //change this to < tho keep them out - > to keep them in waituntil {player distance WestRestZone > RestrictionLength}; hint "Do not approach Opfor Base! Go Back Now"; restrictedZone = true; [] spawn FOCK_deathViaWaituntil; waituntil {player distance WestRestZone < RestrictionLength}; if(Alive player) then { hint "You have cleared out of the Restricted Zone"; }; restrictedZone = false; }; }; FOCK_RestrictEast = { hint "Restrict east function started"; while {true} do { //change this to < tho keep tehm out - > to keep them in waituntil {player distance EastRestZone > RestrictionLength}; hint "Do not approach Opfor Base! Go Back Now"; restrictedZone = true; [] spawn FOCK_deathViaWaituntil; waituntil {player distance EastRestZone < RestrictionLength}; if(Alive player) then { hint "You have cleared out of the Restricted Zone"; }; restrictedZone = false; }; }; //each player executes this on start up and on repsawn if (side player == West) then {hint "Restrict West started"; null = [] spawn FOCK_RestrictWest}; if(side player == East) then {hint "Restrict East started"; null = [] spawn FOCK_RestrictEast}; Share this post Link to post Share on other sites
clydefrog 3 Posted July 8, 2013 tried and tested - was the spawn part that wasnt working - needed a handle to call it for some reason - works well now - ive left the hints in for you so you can follow - and the hints for the damage hint "play areas.sqf started"; if (isnil "restrictedZone") then {restrictedZone = false}; WestRestZone = WestArea; //object to which the distance applies to EastRestZone = EastArea; RestrictionLength = 10; FOCK_deathViaWaituntil = { _units = player; sleep 1.5; while {restrictedZone} do { _damageUnits = getDammage _units; hint format ["Health: %1", _damageUnits]; _units setdamage (_damageUnits + 0.1); sleep 1.3; if (!alive _units) then {restrictedZone = false;}; }; }; FOCK_RestrictWest = { hint "Restrict West function started"; while {true} do { //change this to < tho keep them out - > to keep them in waituntil {player distance WestRestZone > RestrictionLength}; hint "Do not approach Opfor Base! Go Back Now"; restrictedZone = true; [] spawn FOCK_deathViaWaituntil; waituntil {player distance WestRestZone < RestrictionLength}; if(Alive player) then { hint "You have cleared out of the Restricted Zone"; }; restrictedZone = false; }; }; FOCK_RestrictEast = { hint "Restrict east function started"; while {true} do { //change this to < tho keep tehm out - > to keep them in waituntil {player distance EastRestZone > RestrictionLength}; hint "Do not approach Opfor Base! Go Back Now"; restrictedZone = true; [] spawn FOCK_deathViaWaituntil; waituntil {player distance EastRestZone < RestrictionLength}; if(Alive player) then { hint "You have cleared out of the Restricted Zone"; }; restrictedZone = false; }; }; //each player executes this on start up and on repsawn if (side player == West) then {hint "Restrict West started"; null = [] spawn FOCK_RestrictWest}; if(side player == East) then {hint "Restrict East started"; null = [] spawn FOCK_RestrictEast}; Nice one, works well. Do you know if it should work on a dedicated server? Share this post Link to post Share on other sites