hogmason
Member-
Content Count
405 -
Joined
-
Last visited
-
Medals
Everything posted by hogmason
-
random house pos in certain distance for spawned units
hogmason posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
hey im trying to set a random house position within 300 meters of said marker for my units that i spawn i could work it out if i wasnt using for "_i" from 0 to 30 do { }; but that loop just throws me out of my comfort zone. any way this is my spawn units code _rebelArray = []; for "_i" from 0 to 30 do { _random = floor(random 6); _spawn = getMarkerPos "E_Patrol"; _group = floor(random 8); switch (_group) do { case 0: {_units = ["TK_INS_Soldier_Sniper_EP1"];}; case 1: {_units = ["TK_INS_Soldier_AT_EP1"];}; case 2: {_units = ["TK_INS_Soldier_MG_EP1"];}; case 3: {_units = ["TK_INS_Soldier_AA_EP1"];}; case 4: {_units = ["TK_INS_Soldier_Sniper_EP1"];}; case 5: {_units = ["TK_INS_Soldier_TL_EP1"];}; case 6: {_units = ["TK_INS_Soldier_4_EP1"];}; case 7: {_units = ["TK_INS_Bonesetter_EP1"];}; }; [color="#FF0000"]_spawngroup = [getMarkerPos "E_Patrol", EAST, _units, [],[],[],[],[1,1]] call BIS_fnc_spawnGroup;[/color] // Add the created group to an array of groups so we can reference them later _rebelArray set[(count _rebelArray), _spawngroup]; //[_spawngroup,300,3] execVM "missions\scripts\pow_positions.sqf"; [leader _spawngroup,"E_Patrol","spawned","nowait","nofollow","nomove"] execVM "scripts\upsmon.sqf"; //"randomup" }; and this is the code im trying to implement _rebelArray = []; for "_i" from 0 to 30 do { _random = floor(random 6); _spawn = getMarkerPos "E_Patrol"; _group = floor(random 8); switch (_group) do { case 0: {_units = ["TK_INS_Soldier_Sniper_EP1"];}; case 1: {_units = ["TK_INS_Soldier_AT_EP1"];}; case 2: {_units = ["TK_INS_Soldier_MG_EP1"];}; case 3: {_units = ["TK_INS_Soldier_AA_EP1"];}; case 4: {_units = ["TK_INS_Soldier_Sniper_EP1"];}; case 5: {_units = ["TK_INS_Soldier_TL_EP1"];}; case 6: {_units = ["TK_INS_Soldier_4_EP1"];}; case 7: {_units = ["TK_INS_Bonesetter_EP1"];}; }; _spawngroup = [getMarkerPos "E_Patrol", EAST, _units, [],[],[],[],[1,1]] call BIS_fnc_spawnGroup; [color="#FF0000"] _radius = 300; _minBuildingPos = 5; _randomPos = [(getpos _spawngroup select 0) + _radius*0.5 - (random _radius), (getpos _spawngroup select 1) + _radius*0.5 - (random _radius), 0]; _houseArray = nearestObjects [_randomPos, ["House"], _radius]; sleep 1; _houseNumber = count _houseArray; _x = 0; while {_x <= _houseNumber} do { _house = _houseArray select _x; waitUntil {! isNil "_house"}; if (format ["%1", _house buildingPos _minBuildingPos] != "[0,0,0]") exitWith {_y = 0; while { format ["%1", _house buildingPos _y] != "[0,0,0]" } do {_y = _y + 1}; _y = _y - 1; _obj setPos (_house buildingpos (ceil random _y));}; _x = _x +1; sleep 0.1; };[/color] // Add the created group to an array of groups so we can reference them later _rebelArray set[(count _rebelArray), _spawngroup]; //[_spawngroup,300,3] execVM "missions\scripts\pow_positions.sqf"; [leader _spawngroup,"E_Patrol","spawned","nowait","nofollow","nomove"] execVM "scripts\upsmon.sqf"; //"randomup" }; got me beat any ideas. even if i could have it as a seperate sqf i.e private ["_obj","_radius","_minBuildingPos","_randomPos","_houseArray","_houseNumber","_x","_house","_y"]; _obj = _this select 0; _radius = _this select 1; _minBuildingPos = _this select 2; _randomPos = [(getpos _obj select 0) + _radius*0.5 - (random _radius), (getpos _obj select 1) + _radius*0.5 - (random _radius), 0]; _houseArray = nearestObjects [_randomPos, ["House"], _radius]; sleep 1; _houseNumber = count _houseArray; _x = 0; while {_x <= _houseNumber} do { _house = _houseArray select _x; waitUntil {! isNil "_house"}; if (format ["%1", _house buildingPos _minBuildingPos] != "[0,0,0]") exitWith {_y = 0; while { format ["%1", _house buildingPos _y] != "[0,0,0]" } do {_y = _y + 1}; _y = _y - 1; _obj setPos (_house buildingpos (ceil random _y));}; _x = _x +1; sleep 0.1; }; and some how call it from inside the spawn loop i.e _spawngroup = [getMarkerPos "E_Patrol", EAST, _units, [],[],[],[],[1,1]] call BIS_fnc_spawnGroup; [_spawngroup ,300,3] execVM "missions\scripts\pow_positions.sqf"; i know that will not work as is becouse the _spawngroup is a group not an object i.e a specific unit but as i used the spawn loop i have no idea how to use a single unit to call the code. lol i dont even know if thats correct but thats my limit of knowledge lol ;) -
UPSMON - Urban Patrol Script Mon
hogmason replied to Monsada's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
thnks mate ;) -
UPSMON - Urban Patrol Script Mon
hogmason replied to Monsada's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
ill email you the code mate for you to check do you mind ---------- Post added at 23:22 ---------- Previous post was at 23:17 ---------- i just emailed it to you -
UPSMON - Urban Patrol Script Mon
hogmason replied to Monsada's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
thanks mate i tried those and in the end i decided to create the marker on the map in the editor named E_patrol then use this to move it around _gamelogic = center; _towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; _RandomTownPosition = position (_towns select (floor (random (count _towns)))); _marker = createmarker ["taskarea",_RandomTownPosition]; "taskarea" setmarkershape "ELLIPSE"; "taskarea" setmarkersize [300,300]; sleep 5; [color="#FF0000"] "E_Patrol" setMarkerPos getMarkerPos "taskarea"; "E_Patrol" setMarkerColor "ColorRed"; "E_Patrol" setMarkerAlpha 1;[/color] sleep 5; but now the marker is visible at mission start then moves to the task area as meant to then after the 20 secound sleep command and instantly when upsmon units start to spawn the marker disapears. when i have the alpha set to 1 so it should stay i think any way. also just noticed even thought upsmon units are spawning in the marker area i am also getting upsmon debug markers the ones with circle and x in middle with numbers spawning in bottom left corner. just to confirm i am doing this right i have on the map 1 unit of each faction set to 0% probability and the functions module on board on all my scripts n in my init i have waituntil {!isnil "bis_fnc_init"}; and all i add for upsmon is in init.sqf call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf"; and my spawn sqf switch (_group) do { case 0: {_units = ["TK_INS_Soldier_Sniper_EP1"];}; case 1: {_units = ["TK_INS_Soldier_AT_EP1"];}; case 2: {_units = ["TK_INS_Soldier_MG_EP1"];}; case 3: {_units = ["TK_INS_Soldier_AA_EP1"];}; case 4: {_units = ["TK_INS_Soldier_Sniper_EP1"];}; case 5: {_units = ["TK_INS_Soldier_TL_EP1"];}; case 6: {_units = ["TK_INS_Soldier_4_EP1"];}; case 7: {_units = ["TK_INS_Bonesetter_EP1"];}; }; [color="#FF0000"]_spawngroup[/color] = [getMarkerPos "E_Patrol", EAST, _units, [],[],[],[],[1,1]] call BIS_fnc_spawnGroup; // Add the created group to an array of groups so we can reference them later _rebelArray set[(count _rebelArray), _spawngroup]; [color="#FF0000"][leader _spawngroup,"E_Patrol","spawned","randomup","nowait","nofollow","nomove"] execVM "scripts\upsmon.sqf"; //"randomup"[/color] }; thats it. have i maybe missed something -
UPSMON - Urban Patrol Script Mon
hogmason replied to Monsada's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
ive got this strange bug that my marker that my upsmon units are meant to patrol moves to the bottom left corner of the map when the upsmon units spawn NOW the units still spawn where the marker originally was and still patrol so alls well um NO! see my marker is created every time a new task is started after the old 1 is finished now i delete the marker then recreate it using _createpatrolmarker = createMarker ["E_Patrol",getMarkerPos "taskarea"]; _createpatrolmarker setMarkershape "ELLIPSE"; _createpatrolmarker setMarkersize [300,300]; //_createpatrolmarker setMarkerAlpha 0;// this is // out for testing only now the issue its seems to cause is after a few tasks all the upsmon units seem to spawn down the bottom left corner with the marker. meaning task area is empty of enemy this is how i spawn the enemy units and join them to upsmon switch (_group) do { case 0: {_units = ["TK_INS_Soldier_Sniper_EP1"];}; case 1: {_units = ["TK_INS_Soldier_AT_EP1"];}; case 2: {_units = ["TK_INS_Soldier_MG_EP1"];}; case 3: {_units = ["TK_INS_Soldier_AA_EP1"];}; case 4: {_units = ["TK_INS_Soldier_Sniper_EP1"];}; case 5: {_units = ["TK_INS_Soldier_TL_EP1"];}; case 6: {_units = ["TK_INS_Soldier_4_EP1"];}; case 7: {_units = ["TK_INS_Bonesetter_EP1"];}; }; [color="#FF0000"] _spawngroup = [getMarkerPos "E_Patrol", EAST, _units, [],[],[],[],[1,1]] call BIS_fnc_spawnGroup[/color]; // Add the created group to an array of groups so we can reference them later _rebelArray set[(count _rebelArray), _spawngroup]; //dont worry bout this its for a delete upsmon array down the bottom [color="#FF0000"] [leader _spawngroup,"E_Patrol","spawned","randomup","nowait","nofollow","nomove"] execVM "scripts\upsmon.sqf"; //"randomup" [/color] }; does any 1 know how to solve this or has any 1 had this issue as well cheers -
count alive unit issue
hogmason replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Thanks for all the help guys i got going with all your help -
hi i have done a script that spawns 5 pows, and have attempted to create a count of all 5 pows spawned and at the bottom of the code i have a while command that i hoped would decide the end result for the task by 2 ways 1) if all alive POWs were returned to base a tent named POW_safe then the task will complete a success 2) if 3 pows were killed = the task failes //create POWS //count alive POWs AlivePOWs = {({alive _x} count _this)}; if (isServer) then { waituntil {!isnil "bis_fnc_init"}; //set POWs state at start _POWs_death_Limit = false; _POWs_rescued = false; //create POWs _units = []; _POWsArray = []; for "_i" from 0 to 5 do { _POWman = ["US_Delta_Force_EP1","US_Delta_Force_AR_EP1","US_Delta_Force_SD_EP1"] call BIS_fnc_selectRandom; _jail = getMarkerPos "jail"; _POWgrp = createGroup west; _POW = createVehicle [_POWman, _jail, [], 0, "CAN_COLLIDE"]; _POW setcaptive true; _POW setBehaviour "CARELESS"; removeAllWeapons _POW; _POW call {[_POW,20,3] execVM "missions\scripts\pow_positions.sqf"}; _POW setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; _POWsArray set[(count _POWsArray), _POWman]; if (HOG_debug) then { _handle = [_POW,"pow","ColorRed","mil_dot"] spawn HOGdebugmkrs; }; }; while {!_POWs_rescued && !_POWs_death_Limit} do { //check to see if 3 POWs have been killed if so fail task if ((_units call AlivePOWS) == 2) then { _POWs_death_Limit = true; ["Task1","failed"] call SHK_Taskmaster_upd; [] call SHK_addTask; }; //check to see if POWs have been returned to base if so complete task if (_units distance POW_safe < 20) then { _POWs_rescued = true; ["Task1","succeeded"] call SHK_Taskmaster_upd; [] call SHK_addTask; }; }; }; however i am doing something wrong well most likely alot but ive given it a good go and cant do it i do get 1 error in my rpt log ill post it below if any 1 knows. if (_units distance POW_safe < 20) then { _POWs_re> Error position: <distance POW_safe < 20) then { _POWs_re> Error 0 elements provided, 3 expected File C:\Users\natho\Documents\ArmA 2 Other Profiles\=Mason=\missions\testtakitestttestestestestest.Takistan\missions\scripts\pow_spawn.sqf, line 45 Error in expression < [] call SHK_addTask; };
-
check distance of units in array from object
hogmason posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
gday i have got an array built up of units that are spawned _grp = [POW,POW1,POW2,POW3,POW4]; now im trying to get the distance of all alive units in that array to a flag pole named POW_safe. im using this i get no errors but the task doesnt finish when all remaining units are 30 mtrs from the pole if ({(_x distance POW_safe) <30} count _grp == (count _grp)) then { _POWs_rescued = true; hint "all living POWs made it!"; ["Task1","succeeded"] call SHK_Taskmaster_upd; [] call SHK_addTask; }; i know the array is good as i use it for this code if (count _grp <3) then { hint "Too many POWs died!"; ["Task1","failed"] call SHK_Taskmaster_upd; [] call SHK_addTask; _POWs_death_Limit = true; }; and all works fine if less then 3 units from the array are dead then the task does fail. does any 1 know how i can make my distance check work with the array thanks. -
check distance of units in array from object
hogmason replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
thanks mate works perfect lol ill also admit to a stupid foulup i did i just found that in the code my flag is called POW_safe but on the editor my flag is called POWsafe Doh Doh Doh Doh -
check distance of units in array from object
hogmason replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
can you test this for me mate please note = at the end the 2 conditions dont work for me but when i change the 1st condition to > instead of < tat condition works ===strange==== //create POWS //count alive POWs if (isServer) then { waituntil {!isnil "bis_fnc_init"}; _POWgrp = createGroup resistance; _jail = getMarkerPos "jail"; if (isnil "POWs_rescued") then {POWs_rescued = 0;}; ///// set at begining if (isnil "POWs_death_Limit") then {POWs_death_Limit = 0;};///// set at begining POWs_rescued = 1; publicvariable "POWs_rescued";///// set to 1 at start POWs_death_Limit = 1; publicvariable "POWs_death_Limit";///// set to 1 at start //create POWs _POWman = ["UN_CDF_Soldier_AAT_EP1","UN_CDF_Soldier_AMG_EP1","UN_CDF_Soldier_Officer_EP1"] call BIS_fnc_selectRandom; POW = _POWgrp createUnit [_POWman, _jail, [], 0, "FORM"]; POW setcaptive true; POW setBehaviour "CARELESS"; removeAllWeapons POW; POW call {[POW,20,3] execVM "missions\scripts\pow_positions.sqf"}; POW setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; //create POWs _POW1man = ["UN_CDF_Soldier_AAT_EP1","UN_CDF_Soldier_AMG_EP1","UN_CDF_Soldier_Officer_EP1"] call BIS_fnc_selectRandom; POW1 = _POWgrp createUnit [_POW1man, _jail, [], 0, "FORM"]; POW1 setcaptive true; POW1 setBehaviour "CARELESS"; removeAllWeapons POW1; POW1 call {[POW1,20,3] execVM "missions\scripts\pow_positions.sqf"}; POW1 setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; //create POWs _POW2man = ["UN_CDF_Soldier_AAT_EP1","UN_CDF_Soldier_AMG_EP1","UN_CDF_Soldier_Officer_EP1"] call BIS_fnc_selectRandom; POW2 = _POWgrp createUnit [_POW2man, _jail, [], 0, "FORM"]; POW2 setcaptive true; POW2 setBehaviour "CARELESS"; removeAllWeapons POW2; POW2 call {[POW2,20,3] execVM "missions\scripts\pow_positions.sqf"}; POW2 setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; //create POWs _POW3man = ["UN_CDF_Soldier_AAT_EP1","UN_CDF_Soldier_AMG_EP1","UN_CDF_Soldier_Officer_EP1"] call BIS_fnc_selectRandom; POW3 = _POWgrp createUnit [_POW3man, _jail, [], 0, "FORM"]; POW3 setcaptive true; POW3 setBehaviour "CARELESS"; removeAllWeapons POW3; POW3 call {[POW3,20,3] execVM "missions\scripts\pow_positions.sqf"}; POW3 setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; //create POWs _POW4man = ["UN_CDF_Soldier_AAT_EP1","UN_CDF_Soldier_AMG_EP1","UN_CDF_Soldier_Officer_EP1"] call BIS_fnc_selectRandom; POW4 = _POWgrp createUnit [_POW4man, _jail, [], 0, "FORM"]; POW4 setcaptive true; POW4 setBehaviour "CARELESS"; removeAllWeapons POW4; POW4 call {[POW4,20,3] execVM "missions\scripts\pow_positions.sqf"}; POW4 setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; _grp = [POW,POW1,POW2,POW3,POW4]; while{(POWs_death_Limit == 1)} do { if (count _grp < 3) then { [sgt,nil,rgroupChat,"Too many POW's died!"] call RE; POWs_death_Limit = 0; publicvariable "POWs_death_Limit"; }; if ({(_x distance POW_safe) <30} count _grp == (count _grp)) then { POWs_rescued = 0; publicvariable "POWs_rescued"; hint "all living POWs made it!"; POWs_rescued = 0; publicvariable "POWs_rescued"; } }; }; ---------- Post added at 20:53 ---------- Previous post was at 20:30 ---------- that works but if 1 dies it doesnt -
count > working but count < is not
hogmason replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
ill try that now mate -
count > working but count < is not
hogmason posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
lol i have this strange bug that i just cant work out this is working ("just to test") -- as i spawn 5 units in _grp instantly it tells me there is more then 3 if (count _grp > 3) then { ["Task1","failed"] call SHK_Taskmaster_upd; [] call SHK_addTask; }; BUT this is not (and its what i need) -- i spawn 5 units in _grp kill 4 and nothing happens if (count _grp < 3) then { ["Task1","failed"] call SHK_Taskmaster_upd; [] call SHK_addTask; }; -
ordering a unit from another group
hogmason posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
hi i am spawning pows via script and creating them in a group named _POWgrp which is fine but when i rescue them they join my group therefore leave _POWgrp wich then tells my script that they are dead as i am using this code to fail task if to many die. if (count units _POWgrp <3) then { hint "Too many POWs died!"; ["Task1","failed"] call SHK_Taskmaster_upd; [] call SHK_addTask; _POWs_death_Limit = true; }; so my question is how can i make them follow my orders but not leave the _POWrgp group. this is the rescue code. [code] _per = _this select 0; // Person who had the addAction _ldr = _this select 1; // Person who used the addAction _act = _this select 2; // ID of the addAction // Remove the rescue option _per removeAction _act; // Join the POW to rescue group. [_per] joinSilent group _ldr; _per EnableAI "MOVE"; [/code] -
count alive unit issue
hogmason replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
ok so i got the check for tomany deaths working using if (count units _POWgrp <3) then { hint "Too many POWs died!"; ["Task1","failed"] call SHK_Taskmaster_upd; [] call SHK_addTask; _POWs_death_Limit = true; }; but now i cant get the check to see all alive members of POWgrp within 20meters of POW_safe tent working this is what i have got if (_POWgrp distance POWSafe <20) then { _POWs_rescued = true; hint "all living POWs made it!"; ["Task1","succeeded"] call SHK_Taskmaster_upd; [] call SHK_addTask; }; -
count alive unit issue
hogmason replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
what about this //create POWS //count alive POWs if (isServer) then { waituntil {!isnil "bis_fnc_init"}; _POWgrp = createGroup west; _jail = getMarkerPos "jail"; [color="#FF0000"] _POWs_death_Limit = false; _POWs_rescued = false;[/color] //create POWs _POWman = ["US_Delta_Force_EP1","US_Delta_Force_AR_EP1","US_Delta_Force_SD_EP1"] call BIS_fnc_selectRandom; POW = _POWgrp createUnit [_POWman, _jail, [], 0, "FORM"]; POW setcaptive true; POW setBehaviour "CARELESS"; removeAllWeapons POW; POW call {[POW,20,3] execVM "missions\scripts\pow_positions.sqf"}; POW setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; //create POWs _POW1man = ["US_Delta_Force_EP1","US_Delta_Force_AR_EP1","US_Delta_Force_SD_EP1"] call BIS_fnc_selectRandom; POW1 = _POWgrp createUnit [_POW1man, _jail, [], 0, "FORM"]; POW1 setcaptive true; POW1 setBehaviour "CARELESS"; removeAllWeapons POW1; POW1 call {[POW1,20,3] execVM "missions\scripts\pow_positions.sqf"}; POW1 setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; //create POWs _POW2man = ["US_Delta_Force_EP1","US_Delta_Force_AR_EP1","US_Delta_Force_SD_EP1"] call BIS_fnc_selectRandom; POW2 = _POWgrp createUnit [_POW2man, _jail, [], 0, "FORM"]; POW2 setcaptive true; POW2 setBehaviour "CARELESS"; removeAllWeapons POW2; POW2 call {[POW2,20,3] execVM "missions\scripts\pow_positions.sqf"}; POW2 setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; //create POWs _POW3man = ["US_Delta_Force_EP1","US_Delta_Force_AR_EP1","US_Delta_Force_SD_EP1"] call BIS_fnc_selectRandom; _POW3 = _POWgrp createUnit [_POW3man, _jail, [], 0, "FORM"]; _POW3 setcaptive true; _POW3 setBehaviour "CARELESS"; removeAllWeapons POW3; _POW3 call {[POW3,20,3] execVM "missions\scripts\pow_positions.sqf"}; _POW3 setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; //create POWs _POW4man = ["US_Delta_Force_EP1","US_Delta_Force_AR_EP1","US_Delta_Force_SD_EP1"] call BIS_fnc_selectRandom; POW4 = _POWgrp createUnit [_POW4man, _jail, [], 0, "FORM"]; POW4 setcaptive true; POW4 setBehaviour "CARELESS"; removeAllWeapons POW4; POW4 call {[POW4,20,3] execVM "missions\scripts\pow_positions.sqf"}; POW4 setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; [color="#FF0000"]_grp = [POW,POW1,POW2,POW3,POW4]; _obj = POWSafe; _safedistance = 20; _safe = 0; player sidechat format ["%1",_grp]; while {!_POWs_rescued && !_POWs_death_Limit} do { if (count units _grp == 3) exitWith (hint "Too many POWs died!") then // if pow count falls to 3 or below then task failed { //["Task1","failed"] call SHK_Taskmaster_upd; //[] call SHK_addTask; }; if (count units _grp distance POW_safe < 20) exitWith (hint "all living POWs made it!") then // if all alive pows are within 20mtrs from POW_safe then task succeeded { //["Task1","succeeded"] call SHK_Taskmaster_upd; //[] call SHK_addTask; }; }; [/color] }; ---------- Post added at 12:53 ---------- Previous post was at 12:33 ---------- so now im getting an error in my rpt Error in expression <death_Limit} do { if ({alive _x} count units _grp == 3) then { hint "Too many > Error position: <units _grp == 3) then { hint "Too many > Error units: Type Array, expected Object,Group File C:\Users\natho\Documents\ArmA 2 Other Profiles\=Mason=\missions\testtakitestttestestestestest.Takistan\missions\scripts\pow_spawn.sqf, line 87 on this code if (count units _grp == 3) then //this is grp _grp = [POW,POW1,POW2,POW3,POW4]; -
count alive unit issue
hogmason replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
cheers guys but still can not get it its strange nothing i try changes the fact that when i load the mission and the pows spawn instantly i get a hint saying all living POWs made it! now that should only appear if they are within 20mtrs of the tent named = POWSafe so this is what im doin i create the group _POWgrp = createGroup west; the above group is called outside the for "_i" from 0 to 4 do { }; then spawn the pows for "_i" from 0 to 4 do { _POWman = ["US_Delta_Force_EP1","US_Delta_Force_AR_EP1","US_Delta_Force_SD_EP1"] call BIS_fnc_selectRandom; _jail = getMarkerPos "jail"; _POW = _POWgrp createUnit [_POWman, _jail, [], 0, "FORM"]; _POW setcaptive true; _POW setBehaviour "CARELESS"; removeAllWeapons _POW; _POW call {[_POW,20,3] execVM "missions\scripts\pow_positions.sqf"}; _POW setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; if (HOG_debug) then { _handle = [_POW,"pow","ColorRed","mil_dot"] spawn HOGdebugmkrs; }; }; then i call the conditions while {true} do { sleep 10; { if ((_POW distance _obj) < _safeDistance) then {_safe = (_safe + 1)}; if (!alive _POW) then {_POWgrp = _POWgrp - _POW;}; } forEach units _POWgrp; if (count units _POWgrp == 3) exitWith (hint "Too many POWs died!") then { ["Task1","failed"] call SHK_Taskmaster_upd; [] call SHK_addTask; }; if (_safe >= count units _POWgrp) exitWith (hint "all living POWs made it!") then { ["Task1","succeeded"] call SHK_Taskmaster_upd; [] call SHK_addTask; }; }; whole thing if (isServer) then { waituntil {!isnil "bis_fnc_init"}; _obj = POWSafe; _safe = 0; //_grp = [POW1,POW2,POW3,POW4,POW5]; _safedistance = 20; _POWgrp = createGroup west; //create POWs for "_i" from 0 to 4 do { _POWman = ["US_Delta_Force_EP1","US_Delta_Force_AR_EP1","US_Delta_Force_SD_EP1"] call BIS_fnc_selectRandom; _jail = getMarkerPos "jail"; _POW = _POWgrp createUnit [_POWman, _jail, [], 0, "FORM"]; _POW setcaptive true; _POW setBehaviour "CARELESS"; removeAllWeapons _POW; _POW call {[_POW,20,3] execVM "missions\scripts\pow_positions.sqf"}; _POW setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; if (HOG_debug) then { _handle = [_POW,"pow","ColorRed","mil_dot"] spawn HOGdebugmkrs; }; }; player sidechat format ["%1",_POWgrp]; while {true} do { sleep 10; { if ((_x distance _obj) < _safeDistance) then {_safe = (_safe + 1)}; if (!alive _x) then {_POWgrp = _POWgrp - _x;}; } forEach units _POWgrp; if (count units _POWgrp == 3) exitWith (hint "Too many POWs died!") then { ["Task1","failed"] call SHK_Taskmaster_upd; [] call SHK_addTask; }; if (_safe >= count units _POWgrp) exitWith (hint "all living POWs made it!") then { ["Task1","succeeded"] call SHK_Taskmaster_upd; [] call SHK_addTask; }; }; }; sorry to be a pest but this has got me stuffed for quite a while -
count alive unit issue
hogmason replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
yeah ive got 1 unit from each side on map with 0 presence. i have everything spawning fine including pows but just cant get my tasks to end the way i need them by the pows either to many dead or within 20 meters from the tent lol ---------- Post added at 00:21 ---------- Previous post was at 00:04 ---------- ok so i changed it to createunit and a few more things done now it loads with no rpt error but the hint all living POWs made it! keeps flashing in the corner straight after the pows spawn and i can kill all of the pows and get no Too many POWs died hint seems to me like the powgrp is not being referenced or something this is the code //create POWS //count alive POWs if (isServer) then { waituntil {!isnil "bis_fnc_init"}; //create POWs for "_i" from 0 to 4 do { _POWgrp = createGroup west; _POWman = ["US_Delta_Force_EP1","US_Delta_Force_AR_EP1","US_Delta_Force_SD_EP1"] call BIS_fnc_selectRandom; _jail = getMarkerPos "jail"; //_POW = createVehicle [_POWman, _jail, [], 0, "CAN_COLLIDE"]; _POW = _POWgrp createUnit [_POWman, _jail, [], 0, "FORM"]; _POW setcaptive true; _POW setBehaviour "CARELESS"; removeAllWeapons _POW; _POW call {[_POW,20,3] execVM "missions\scripts\pow_positions.sqf"}; _POW setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; if (HOG_debug) then { _handle = [_POW,"pow","ColorRed","mil_dot"] spawn HOGdebugmkrs; }; }; _obj = POWSafe; //_grp = [POW1,POW2,POW3,POW4,POW5]; _safe = 0; _safedistance = 20; while {true} do { sleep 1; { if ((_x distance _obj) < _safeDistance) then {_safe = (_safe + 1)}; if (!alive _x) then {_POWgrp = _POWgrp - _x;}; } forEach units _POWgrp; if (count _POWgrp == 3) exitWith (hint "Too many POWs died!"); if (_safe >= count _POWgrp) exitWith (hint "all living POWs made it!"); }; }; ---------- Post added at 00:41 ---------- Previous post was at 00:21 ---------- THIS IS WERE I GOT TO AND WERE I AM OFFICIALLY STUCK stuck :( //create POWS //count alive POWs if (isServer) then { waituntil {!isnil "bis_fnc_init"}; _obj = POWSafe; _safe = 0; _grp = [POW1,POW2,POW3,POW4,POW5]; _safedistance = 20; _POWgrp = createGroup west; //create POWs for "_i" from 0 to 4 do { _POWman = ["US_Delta_Force_EP1","US_Delta_Force_AR_EP1","US_Delta_Force_SD_EP1"] call BIS_fnc_selectRandom; _jail = getMarkerPos "jail"; _POW = _POWgrp createUnit [_POWman, _jail, [], 0, "FORM"]; _POW setcaptive true; _POW setBehaviour "CARELESS"; removeAllWeapons _POW; _POW call {[_POW,20,3] execVM "missions\scripts\pow_positions.sqf"}; _POW setVehicleInit "this addAction ['Rescue Him!', 'missions\scripts\rescue.sqf'];"; processInitCommands; if (HOG_debug) then { _handle = [_POW,"pow","ColorRed","mil_dot"] spawn HOGdebugmkrs; }; }; while {true} do { sleep 1; { if ((_x distance _obj) < _safeDistance) then {_safe = (_safe + 1)}; if (!alive _x) then {_POWgrp = _grp - _x;}; } forEach units _POWgrp; if (count _POWgrp == 3) exitWith (hint "Too many POWs died!") then { ["Task1","failed"] call SHK_Taskmaster_upd; [] call SHK_addTask; }; if (_safe >= count _POWgrp) exitWith (hint "all living POWs made it!") then { ["Task1","succeeded"] call SHK_Taskmaster_upd; [] call SHK_addTask; }; }; }; ---------- Post added at 00:42 ---------- Previous post was at 00:41 ---------- sorry about caps -
count alive unit issue
hogmason replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
cheers guys ill try now ;) -
debug marker not updating using while command
hogmason posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
gday all i am using the below code to follow spawned units but it is not updating there positions _HOGdebugunits = _this select 0; _HOGdebugTEXT = _this select 1; while {alive _HOGdebugunits} do { _DEBUGmarker = createMarker[str(_HOGdebugunits),position _HOGdebugunits]; str(_HOGdebugunits) setMarkerType "mil_dot"; str(_HOGdebugunits) setMarkerColor "ColorRed"; str(_HOGdebugunits)setMarkerText _HOGdebugTEXT; sleep 1; }; any 1 know why thanks -
debug marker not updating using while command
hogmason replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Yeah thanks mate. i got it working by adding a few more commands but now i am stuck creating a few markers as this 1 piece of code is being called from multiple scripts so i need it to create a new mkr every time its called this is my code thats now working _HOGdebugUNITS = _this select 0; _HOGdebugTEXT = _this select 1; _HOGdebugCOLOUR = _this select 2; _HOGdebugTYPE = _this select 3; if (HOG_debug) then { _DEBUGmarker = createMarker ["dbgmkr",getPos _HOGdebugUNITS]; _DEBUGmarker setMarkerType _HOGdebugTYPE; _DEBUGmarker setMarkerColor _HOGdebugCOLOUR; _DEBUGmarker setMarkerText _HOGdebugTEXT; _DEBUGmarker setMarkerDir (direction _HOGdebugUNITS); while {alive _HOGdebugUNITS} do { _DEBUGmarker setMarkerPos getPosATL _HOGdebugUNITS; _DEBUGmarker setMarkerDir (direction _HOGdebugUNITS); sleep 0.5; }; }; this is how its called _handle = [_Su34,"jet","ColorRed","mil_triangle"] spawn HOGdebugmkrs; //explained _handle = [the unit,"txt","Color","type"] spawn HOGdebugmkrs; i tried this so it gives the marker a new name every time but it does funny things like change color every secound and stuff also i am not to clear what _x does i googled and looked but cant really find a decent explanation _DEBUGmarker = createMarker [str(_x),getPos _HOGdebugUNITS]; ---------- Post added at 14:17 ---------- Previous post was at 14:11 ---------- got it all going _HOGdebugUNITS = _this select 0; _HOGdebugTEXT = _this select 1; _HOGdebugCOLOUR = _this select 2; _HOGdebugTYPE = _this select 3; [color="#FF0000"]_mkrName = Format ["mkr_%1",_HOGdebugUNITS];[/color] if (HOG_debug) then { _DEBUGmarker = createMarker [_mkrName,getPos _HOGdebugUNITS]; _DEBUGmarker setMarkerType _HOGdebugTYPE; _DEBUGmarker setMarkerColor _HOGdebugCOLOUR; _DEBUGmarker setMarkerText _HOGdebugTEXT; _DEBUGmarker setMarkerDir (direction _HOGdebugUNITS); while {alive _HOGdebugUNITS} do { _DEBUGmarker setMarkerPos getPosATL _HOGdebugUNITS; _DEBUGmarker setMarkerDir (direction _HOGdebugUNITS); sleep 0.5; }; }; -
cheers mate
-
Demonized mate that is not working for me if (count _this > 1) then { (_this select 1) playMove "amovpsitmstpsraswrfldnon_smoking"; // here the player starts the repair animation, can be changed for another animation of choise. sleep 10; (_this select 0) setDammage 0; (_this select 0) setFuel 1; }; if (!isNil ("vehicleRepairInitiated")) exitWith {}; vehicleRepairInitiated = true; waitUntil {sleep 1; alive player}; while {true} do { { if (!(_x getVariable ["RepairsInitiated", false])) then { _id = _x addAction ["Repair Vehicle", "HOG_scripts\Vehicle_Repair\vehicleRepair.sqf", [], 1, false, true, "", "(getDammage _target) < 1 AND (getDammage _target) > 0 AND (faction _this) == 'soldierWB' AND (vehicle _this) == _this"]; _x setVariable ["RepairsInitiated", true, false]; }; } foreach vehicles; sleep 5; };
-
check enemy numbers before executing script
hogmason posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hi wondering how i can get this code to make sure there is less then 90 enemy units on the map before it runs the script this is what i have so far if (isServer) then { if ((Target1_active ==1) && (Target2_active ==1)) then { ["REIN","random","red",3] execVM "spawns\parareinf.sqf"; }; }; ---------- Post added at 21:04 ---------- Previous post was at 20:34 ---------- ive been playing with something like this if ((Target1_active ==1) && (Target2_active ==1)) then { if (({alive _x && side _x == east} count thisList) < 100) then { ["REIN","random","red",3] execVM "spawns\parareinf.sqf"; }; }; -
check enemy numbers before executing script
hogmason replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
cheers mikie ;) -
so i am adding a public variable to my composition base but i keep getting an error but everything looks to be fine this is the code [color="#FF0000"]if (isnil "radar_active") then {radar_active = 0;};[/color] [color="#FF0000"]radar_active = 1; publicvariable "radar_active";[/color] _radarbunker = [(getMarkerPos "campbase"), random 360, "radar_site_ru1"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf")); [color="#FF0000"]_radarbunker addeventhandler ["killed", { radar_active = 0;publicvariable "radar_active"; [sgt,nil,rgroupChat,"Enemy radar has been destroyed"] call RE;}];[/color] _radarbunker setVehicleInit "_radarbunker addEventHandler [""HandleDamage"",{(_this select 4) == ""PipeBomb""}]" ;format ["%1 = this; this setVehicleVarName ""%1""",_radarbunker]; processInitCommands; this is the error Warning Message: Script not found Error in expression <ipts\objectMapper.sqf")); _radarbunker addeventhandler ["killed", { radar_activ> Error position: <addeventhandler ["killed", { radar_activ> Error addeventhandler: Type Array, expected Object File C:\Users\natho\Documents\ArmA 2 Other Profiles\=Mason=\missions\Operation_HOG_V_3.Chernarus\missions\spawners\Targets\RADAR_base.sqf, line 27