commanderx 17 Posted December 30, 2014 Hi, I have the following problem. In my mission template I would like to make 3 teamleader able to perform AGM medic tasks with this setVariable ["AGM_IsMedic", true]; That works fine but furthermore I would like to make this dependable from what I choose at the beginning of the mission with a parameter. Also that should work while someone is joining with one of the teamleadslots while mission is in progress. So I have the variable _team_medic = paramsArray select 3 (in the init.sqf) but don´t know how to assign the setvariable command. Best regards Kai Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted December 30, 2014 I hope I understand you correctly here as I've never worked with teams before. But maybe this helps you: { _x setVariable ["AGM_IsMedic", true]; } forEachMemberTeam _team_medic; Share this post Link to post Share on other sites
commanderx 17 Posted December 30, 2014 The 3 teamleader are not in the team _team_medic cause this is not a team. This variable is just 1 or 0. If _team_medic == 1 then all the teamleader (they have the names s2, s3 and s4) should be able to perform medic tasks. If 0 then not. Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted December 30, 2014 (edited) This should do the job: [color=#FF8040][color=#191970][b]if[/b][/color][color=#8B3E2F][b]([/b][/color][color=#1874CD]_team_medic[/color] [color=#8B3E2F][b]=[/b][/color][color=#8B3E2F][b]=[/b][/color] [color=#FF0000]1[/color][color=#8B3E2F][b])[/b][/color] [color=#191970][b]then[/b][/color] [color=#8B3E2F][b]{[/b][/color] [color=#1874CD]_medics[/color] [color=#8B3E2F][b]=[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] [color=#8B3E2F][b]{[/b][/color] [color=#1874CD]_medics[/color] [color=#191970][b]pushBack[/b][/color] [color=#8B3E2F][b]([/b][/color][color=#191970][b]missionNamespace[/b][/color] [color=#191970][b]getVariable[/b][/color] [color=#000000]_x[/color][color=#8B3E2F][b])[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#8B3E2F][b]}[/b][/color] [color=#191970][b]forEach[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"s1"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]"s2"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]"s3"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]"s4"[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] [color=#191970][b]if[/b][/color][color=#8B3E2F][b]([/b][/color][color=#000000]player[/color] [color=#191970][b]in[/b][/color] [color=#1874CD]_medics[/color][color=#8B3E2F][b])[/b][/color] [color=#191970][b]then[/b][/color] [color=#8B3E2F][b]{[/b][/color] [color=#000000]player[/color] [color=#191970][b]setVariable[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"AGM_IsMedic"[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]true[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] [color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color][/color] Kudos to Killzone_Kid for his SQF to BBCode Converter. By the way, you can also use boolean types (true, false) for your variable _team_medic. Then you don't have to do if(_team_medic == 1) then {...} but instead, you can do if(_team_medic) then {...} Edited December 30, 2014 by Heeeere's Johnny! Share this post Link to post Share on other sites
commanderx 17 Posted December 30, 2014 Wow, thank you! Will try that when I´m back at home. Share this post Link to post Share on other sites
commanderx 17 Posted December 30, 2014 Will something like this work? ["medic", "onPlayerConnected", { player setVariable ["AGM_IsMedic", true];}] call BIS_fnc_addStackedEventHandler; Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted December 30, 2014 It won't work as you want it, because if you execute that in the init.sqf, this EH will fire on every connected client whenever a new client connects. So not only will EVERY connected player get this variable set, they will only get it set when another player connects after them. You should put the code block I posted above into the init.sqf, because it will check on the player's connection if he connected as one of the medics. This is independent from other connected players and will have no effect on them. Share this post Link to post Share on other sites