Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Community Reputation

3 Neutral

About jazzraill

  • Rank
    Private First Class

Recent Profile Visitors

475 profile views
  1. try this https://community.bistudio.com/wiki/switchMove
  2. hey maxi.. just logged in to say thanks. this was actually an idea i was thinking for a long time. it's nice to see someone else thought like me and made it happen :)
  3. I'd suggest using switch..do structure.. switch (_input) do { case 361 : {_hint = "good"}; default {_hint = "bad"}; }; if (_input isEqualTo "") exitWith {};
  4. i don't think "if" structure will work insine "waituntil". Try using if () then {}else{}; maybe? What is the expected outcome ?
  5. thanks for the reply! for anyone else wondering, the second code was almos 1.5 times faster .. (I'm also coding this on a core 2 duo so results may differ)
  6. try this maybe? https://community.bistudio.com/wiki/BIS_fnc_stalk (not tested)
  7. Greetings, I'm currently working on a code that runs for each spawned entity on the map so it should be the quickest. However I'm stuck between two desicions: First one uses less lines of code, but more private variables : switch _cond1 do { case 1: { _y = 1;_z = 3; }; case 2: { _y = 2;_z = 4; }; }; switch _cond2 do { case 1: { _c = 1; }; case 2: { _c = 3; }; }; _n = (_y*_z)+_c; The second one uses more lines of code, but no variables at all: _cond1,_cond2 call { if (_cond1 isEqualTo 1) exitWith { _cond2 call { if (_cond2 isEqualTo 1) exitWith {4}; }; _cond2) call { if (_cond2 isEqualTo 2) exitWith {6}; }; }; }; _cond1,_cond2 call { if (_cond1 isEqualTo 2) exitWith { _cond2 call { if (_cond2 isEqualTo 1) exitWith {7}; }; _cond2 call { if (_cond2 isEqualTo 2) exitWith {9}; }; }; };
  8. jazzraill

    AI Unit Side

    not sure if east units in west groups will be completely bug free though. instead you can spawn one dummy east unit, transform items of him to unit in west group, and have east looking west guy!
  9. from what i understand it's the same unit respawning in same position so, use the same variables again maybe.. ? (performance wise) also create a function like , fnc_unitSpawn = { sleep ((_this select 1)*4); if (!alive (_this select 0)) then { //deleteVehicle (_this select 0); sleep (_this select 1); _unit = (group (_this select 0)) createUnit [(typeOf (_this select 0)), ((getPos)_this select 0), [], (_this select 1), "FORM"]; _unit addEventHandler ["killed", {0 = [(_this select 0),5,"blackfish_1","Driver",helipad_2,15] call fnc_unitSpawn}]; _unit setSkill (skill(_this select 0)); _unit setRank (rank(_this select 0));//not sure this or above code will work _unit setPosATL ((getPos)_this select 0); _unit setVehicleVarName (vehicleVarName (_this select 0)); _unit setDir (getDir (_this select 0)); deleteVehicle (_this select 0); 0 = [_unit,(_this select 1),blackfish_1,Driver,helipad_2,15] execVM unit_getin.sqf; 0 = [_unit,(_this select 1),blackfish_1,Driver,helipad_2,(_this select 5)] execVM "unit_getin.sqf"; }; }; not tested btw
  10. jazzraill

    Init Line question..

    do you need to immobilize that unit again? if not, in init field _this spawn { _this enableSimulation false; waitUntil {sleep 0.2; /*your condition here*/}; _this enableSimulation true; };
  11. wow.. never thought of that. thanks man
  12. what im trying to do is : unit kills another unit -- eh fires unit moves victims position, --problems occur here grabs his gun, moves on after waitUntil {sleep 3;(((_this select 0) distance (_this select 1))< 5) }; it goes on like this; {(_this select 1) disableAI _x} forEach ["TARGET","MOVE","FSM"]; (_this select 1) playActionNow "Medic"; //Sleep 0.2; if (((currentWeapon (_this select 0))) in Lvl2Weapons ) then { (_this select 1) removeWeapon (primaryWeapon(_this select 1)); //remove magazine here (_this select 1) addWeapon (primaryWeapon (_this select 0)); (_this select 1) addmagazine (getArray(configFile >> "CfgWeapons" >> (primaryWeapon (_this select 1)) >> "magazines") select 0); }; {(_this select 1) enableAI _x} forEach ["TARGET","MOVE","FSM"]; (_this select 1) domove waypointPosition [group (_this select 1),1]; (_this select 0) removeAllEventHandlers "killed"; }]; the problem is if unit gets distracted when moving victims position, and goes somewhere else instead, waitUntil {sleep 3;(((_this select 0) distance (_this select 1))< 5) }; takes forever and script doesnt terminate
  13. greetings. im working on a script which has to terminate when unit fires a weapon.. looking everywhere for hours, can't use fired eh because this line is in an eh already.. _EHkilledIdx = _this addEventHandler ["killed", { if (((_this select 0)==(_this select 1)) || (_this select 1) == player) exitwith {}; systemChat format ["%1 was killed by %2 from %3m with %4",(name (_this select 0)),(name (_this select 1)),((_this select 0)distance (_this select 1)),(parseText (getText (configFile >> "CfgWeapons" >> (currentWeapon (_this select 1)) >> "displayname")))]; _nearestEnemy = (_this select 1) findNearestEnemy (_this select 1); _isSafe = (((_this select 1) distance _nearestEnemy) > 35); waitUntil {sleep 10;_isSafe}; (_this select 1) doMove (getPos (_this select 0)); >> what im trying to do here:: if ((_this select 1) fires a weapon) exitwith {}; so that below waitUntil doesnt last forever waitUntil {sleep 3;(((_this select 0) distance (_this select 1))< 5) };
  14. hi fellow modders i'm working on a script that spawns units when player is near some kind of building, de-spawns when player is far and spawns again if player is near same kind of building again. here is my code : _groups_nato = []; x = true; fn_find_base = { _list = nearestObjects [player, _bases, 1000]; _base = _list call bis_fnc_selectrandom; _return = getpos _base; _return }; fn_spawn_nato = { if (count _groups_nato < 5) then { _pos = [] call fn_find_base; _grp = creategroup west; for "_i" from 1 to 3 do {"B_Soldier_F" createUnit [_pos, _grp];}; nul = [_grp, _pos] call BIS_fnc_taskdefend; _return = _grp; _return }; }; while {x} do { _grp = [] call fn_spawn_nato; _groups_nato = _groups_nato + [_grp]; _ldr = leader _grp; if ((_ldr) distance player > 1000) then { {deletevehicle _x} foreach units _grp; _groups_nato = _groups_nato - [_grp]; }; hint str _groups_nato; }; the spawning and de-spawning part of the script works, but it fails to spawn again when player is near same kind of buildings. any help will be appreciated.
  15. Hello everyone. I am trying to spawn units and some objects with trigger, then delete them when player leaves the trigger area (eg. 200x200) and re-spawn when entering again. what i am trying to do is to create a military bases around the map with camps/ tents and units patrolling but it costs a lot of fps. i would like to place units and objects in editor but they should spawn when player is in their activation trigger. then they should despawn if player leaves the area. sorry for bad english