Search the Community
Showing results for tags 'if then'.
Found 3 results
-
My intent is to call reinforcements depending on the number of alive units. I have the reinforcements scripts made as functions. The problem is everything is spawning at the mission start. //ifs.sqf ran from initServer.sqf if ((count allUnits) < 250) then { ["reinforcements_incoming"] call BIS_fnc_showNotification; call KIB_fnc_mehSqus; call KIB_fnc_specOps; }; if ((count allUnits) < 225) then { ["reinforcements_incoming"] call BIS_fnc_showNotification; call KIB_fnc_mehSqus; call KIB_fnc_specOps; }; if ((count allUnits) < 200) then { ["reinforcements_incoming"] call BIS_fnc_showNotification; call KIB_fnc_mehSqus; call KIB_fnc_specOps; }; if ((count allUnits) < 175) then { ["reinforcements_incoming"] call BIS_fnc_showNotification; call KIB_fnc_mehSqus; call KIB_fnc_specOps; }; if ((count allUnits) < 150) then { ["reinforcements_incoming"] call BIS_fnc_showNotification; call KIB_fnc_mehSqus; call KIB_fnc_specOps; }; if ((count allUnits) < 125) then { ["reinforcements_incoming"] call BIS_fnc_showNotification; call KIB_fnc_mehSqus; call KIB_fnc_specOps; }; if ((count allUnits) < 100) then { ["reinforcements_incoming"] call BIS_fnc_showNotification; call KIB_fnc_mehSqus; call KIB_fnc_specOps; }; if ((count allUnits) < 75) then { ["reinforcements_incoming"] call BIS_fnc_showNotification; call KIB_fnc_mehSqus; call KIB_fnc_specOps; }; if ((count allUnits) < 50) then { ["reinforcements_incoming"] call BIS_fnc_showNotification; call KIB_fnc_mehSqus; call KIB_fnc_specOps; }; if ((count allUnits) < 25) then { ["reinforcements_incoming"] call BIS_fnc_showNotification; call KIB_fnc_mehSqus; call KIB_fnc_specOps; }; Looks like every if statement is TRUE so everything spawns, maybe ( 225 < (count allUnits) < 250) ? And one additional question, can I call a function two times if I need more reinforcements? call KIB_fnc_mehSqus; call KIB_fnc_mehSqus;
-
Error when there is no player in squad lead spot
InsanityGamer posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Essentially i'm try to make my own take on an invade and annex server thats team oriented. currently im working on adding a flagpole teleportation mechanic that will teleport you to your squad leader if you have a squad leader and will get you in the fight faster. so ive spent the better part of the day doing this.... im sure some of you are gagging at that, sorry im not very proficient in eden editor....or anything particularily... nonetheless this works as intended except it'll throw an error if there is nobody playing the character with their specific variable attached IE; SquadLeader_1, SquadLeader_2, Pilot, COC, Recon. for what i intend that's fine but i'd like to clean it up and offer a "Teleportation is down right now" for the characters that can teleport atleast. i've been trying to find some way to integrate try throw catch, but cant seem to find a way to set it up proper. any tips? -
troubles defining variables in trigger
lordfrith posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
well, i have been trawling about trying to find this particular problem for a while so i'll ask here: i'm trying to create a script that will spawn and despawn specific objects when player moves in/out of trigger area. originally i did this using separate spawn/despawn scripts but i'm trying to put both scripts in one SQF and select between the two parts using if/then and a variable in the script call. so i created an object "desk1" (which spawned objects attach to) and then created trigger with the following conditions trigger is working fine (i get ping pong) the script "officedesk.sqf" is below. The problem is i keep getting undefined variable errors for the "_stage" (line 7) even though it is defined in the call? i'm pretty confused as to whats going on here, changing _stage to be global doesn't seem to help and i'm.... pretty sure the script call in the trigger is ok? can anybody see what (probably blindingly obvious) thing is going wrong here? EDIT: SOLVED it was NOTHING to do with the error message's which confused me for ages the problem was that if i defined deskArray at the start of the script (before if/then code) 'pushback' didn't work and i was trying to delete and empty array of objects. I just moved it into the if/then code and it works fine with no errors. thing is... 'deskArray' is global so how come i can't define it at code start and then add items in the if/then code? Here's the working script in case anyones bored enough to check it out: p.s. sorry mods, having solved the problem i think the thread title is... inaccurate :D