JacobJ 10 Posted April 13, 2011 Hey all How would I make a trigger that has an area and if anybody is present inside this area all weapons of each unit gets removed? Ive tried to make a trigger with: anybody present, repeatable, condition: this, OnAct: {removeallweapons _x} foreach thislist; But it doesnt work for people that respawn or gets teleported into the area, only on people inside the area the first time the trigger gets triggered. How can I make it repeatable, so all that every comes into the area looses their guns? /Jacob Share this post Link to post Share on other sites
shuko 45 Posted April 13, 2011 Anybody present, repeatedly. Cond: this Name: trigName OnAct: Then from init.sqf or wherever start a small loop: [] spawn { while {sleep 1; true} do { {removeallwepons _x} foreach (list trigName); }; }; Share this post Link to post Share on other sites
JacobJ 10 Posted April 13, 2011 (edited) yes that did work. There needs an A in removeallweApons, just for information. Thank you again my fellow skandinavian friend. ---------- Post added at 10:21 ---------- Previous post was at 10:08 ---------- Can I somehow make more things that the script does? Like starting the spectator-mode and run a script? I can't seem to get this to work: [] spawn { while {sleep 1; true} do { {removeallweapons _x} foreach (list trigName); {_x call ace_fnc_startSpectator} foreach (list trigName); {nul = [] execVM "spectator.sqf"} foreach (list trigName); }; }; The idea would then be to force the dead players into spectating mode and run the additional configurations of the spectating-mode with that script. When I try this code out, the player won't even remove his weapon. Edited April 13, 2011 by JacobJ Share this post Link to post Share on other sites
shuko 45 Posted April 13, 2011 Because you made the same typo as me. :) Missing "a". Don't start a script from a loop. Instead make a separate spawn to wait that player is in the area. if !isdedicated then { [] spawn { waituntil {player in (list trigName)}; execvm "spectator.sqf"; }; }; Share this post Link to post Share on other sites
JacobJ 10 Posted April 13, 2011 Okay I got it working. The _x in the call command needs to be _this ---------- Post added at 10:28 ---------- Previous post was at 10:25 ---------- Okay else the script would start every second? So the loop is only there to remove the weapons, and the other spawn starts the spectator and runs the config script right? Share this post Link to post Share on other sites
shuko 45 Posted April 13, 2011 Yeah, you dont want to be starting script for all those units every second. :) Once per player is enough. Share this post Link to post Share on other sites
JacobJ 10 Posted April 13, 2011 yeah thats true, I get the concept. Thanks for the help! Share this post Link to post Share on other sites