kerozen 187 Posted December 26, 2018 Hello. I'm trying to create different spawn points for different groups. The mission is going to have 3 different forces, the Pilots, the SOF guys and normal Army guys. I want each to have their own respawn point. Tried searching for something similar and came up with: OnPlayerRespawn.sqf player addEventHandler ["Respawn", { if (group player == "B Alpha 1-1") then {player setpos (getmarkerpos "PilotRespawn"); } else { if (group player == "B Alpha 1-2") then {player setpos (getmarkerpos "SOFRespawn"); }]; Tried using Respawn and MPrespawn EH, both didn't work. Respawn is set as Custom Location and there are 3 markers (respawn_west, PilotRespawn and SOFRespawn and also tried on Position of Death but the code doesn't do anything and also doesn't work. 1 Share this post Link to post Share on other sites
pokertour 30 Posted December 26, 2018 hi, you can do what you want with : player addEventHandler ["Respawn", { if (groupId (group player) == "Alpha 1-1") then {player setpos (getmarkerpos "respawntroup"); } else {player setpos (getmarkerpos "respawnpilot");} }]; if you want more than 2 pos you can use the switch command ex : player addEventHandler ["Respawn", { switch (groupId (group player)) do { case "Alpha 1-1": { player setpos (getmarkerpos "PilotRespawn"); }; case "Alpha 1-2": { player setpos (getmarkerpos "SOFRespawn"); }; case "Alpha 1-3": { player setpos (getmarkerpos "AnotherRespawnMarker"); }; }; }]; the command "groupId" return the group name 2 1 Share this post Link to post Share on other sites
kerozen 187 Posted December 26, 2018 @pokertour Thank you. I ended up using this: player addEventHandler ["Respawn", { if (groupId (group player) == "Alpha 1-1") then {player setpos (getmarkerpos "PilotRespawn"); } else {} }]; player addEventHandler ["Respawn", { if (groupId (group player) == "Alpha 1-2") then {player setpos (getmarkerpos "SOFRespawn"); } else {} }]; because i couldn't get switch do working, i didn't get any errors it just didn't do anything player addEventHandler ["Respawn", { switch (groupId (group player)) do { case "Alpha 1-1"; { player setpos (getmarkerpos "PilotRespawn"); }; case "Alpha 1-2"; {player setpos (getmarkerpos "SOFRespawn"); }; default {player setpos (getmarkerpos "respawn_west"); }; }; }]; Share this post Link to post Share on other sites
pokertour 30 Posted December 26, 2018 if you don't use the else statement you can remove it and keep only your Then : if (groupId (group player) == "Alpha 1-1") then {player setpos (getmarkerpos "PilotRespawn"); }; you can also regroup your two if in only one EventHandler: player addEventHandler ["Respawn", { if (groupId (group player) == "Alpha 1-1") then {player setpos (getmarkerpos "PilotRespawn"); }; if (groupId (group player) == "Alpha 1-2") then {player setpos (getmarkerpos "SOFRespawn"); }; }]; it's because in your case you have put ";" instead of ":" case "Alpha 1-1"; need to be : case "Alpha 1-1": 1 Share this post Link to post Share on other sites
kerozen 187 Posted December 26, 2018 @pokertour Thanks for the help once again. In terms of performance or possibility of "malfunction" which of the two is better to use? Switch do or If? Share this post Link to post Share on other sites
pokertour 30 Posted December 26, 2018 I think " If " is faster than " switch do " maybe someone can confirm ? @GEORGE FLOROS GR you make a lot of scripts maybe you have an idea :) what do you mean by "malfunction" ? 1 Share this post Link to post Share on other sites
kerozen 187 Posted December 26, 2018 I always read that arma sometimes breaks and stops running scripts correctly and stuff. I not a scripter so i don't know how to optimize code. Share this post Link to post Share on other sites
pokertour 30 Posted December 26, 2018 I never had this kind of problems with my scripts, so i do not know :) if you need some explaination with somes command you can look at arma 3 wiki https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 1 1 Share this post Link to post Share on other sites
gc8 977 Posted December 26, 2018 Speed is never an issue with such a small script that is run only once in respawn. You should only have to optimize slow loops and such 1 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted December 26, 2018 2 hours ago, pokertour said: I think " If " is faster than " switch do " Thanks pokertour ! I'm not any professional though , i'm more of a reader ! https://community.bistudio.com/wiki/Code_Optimisation#if_and_switch 4 Share this post Link to post Share on other sites