magicpanda 19 Posted August 16, 2015 Hi, I'm learning how to script stuff for Arma and decided to do a little script that creates ambient burning wrecks in the distance as the player travels and deletes them when gone. I've hit a bit of a brick wall with looping and cleaning up . Here is what is working so far. I'm thinking I need some kind if statement using player distance to delete _wreckcomp and "wreckmarker"; then start the whole process over again at random times. Also would using BIS_fnc_findSafePos; be better instead of SHK? I could nearly call it my own script then :) call compile preprocessfile "SHK_pos\shk_pos_init.sqf"; _PosA = [getpos player,[800,1000],random 360,0,[],heli] call SHK_pos; _wreckPos = _posA isFlatEmpty[2, 50, 0.5, 5, 0, false, heli]; while {(count _wreckPos) < 1} do { _PosA = [getpos player,[800,1000],random 360,0,[],heli] call SHK_pos; _wreckPos = _posA isFlatEmpty[2, 50, 0.5, 5, 0, false, heli]; }; _wreckMarker = createMarker ["wreckMarker",_wreckPos]; _wreckMarker setMarkerShape "ELLIPSE"; //for testing _wreckMarker setMarkerColor "ColorOPFOR"; _wreckMarker setMarkerSize [50, 50]; _wreckMarker setMarkerBrush "Solid"; _wreck1 = [["Land_Wreck_HMMWV_F",[0.758789,3.6582,0.0207825],0,1,0,[],"","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck2 = [["Land_Wreck_Truck_F",[0.326172,3.39844,0],0,1,0,[],"","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck3 = [["Land_Wreck_Car2_F",[0.424805,2.31836,0],103.117,1,0,[],"","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck4 = [["Land_Wreck_Car_F",[-0.428711,2.60156,0],116.565,1,0,[],"","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck5 = [["Land_Wreck_Hunter_F",[0.118164,4.66016,0],133.172,1,0,[],"","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck6 = [["Land_Wreck_Slammer_F",[-0.129883,6.14258,0],0,1,0,[],"","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck7 = [["Land_Wreck_Slammer_hull_F",[0.268555,4.48828,0],107.918,1,0,[],"","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck = [_wreck1, _wreck2, _wreck3, _wreck4, _wreck5, _wreck6, _wreck7]; _wreckComp = _wreck call BIS_fnc_selectRandom; 0 = [(getmarkerPos "wreckMarker"), random 360, _wreckComp] call BIS_fnc_ObjectsMapper; //sleep 10; //_cleanup = if (player distance "wreckmarker" > 2000) then [ { "true" }, { "false" } ]; //hint _cleanup; sleep (60 + (random 120)); // while {(count _wreckComp) < 1} do { // do everything all over again? Share this post Link to post Share on other sites
magicpanda 19 Posted August 16, 2015 Kind of solved it with a trigger and it works fine but it's throwing up an error. call compile preprocessfile "SHK_pos\shk_pos_init.sqf"; _PosA = [getpos player,[800,1000],random 360,0,[],heli] call SHK_pos; _wreckPos = _posA isFlatEmpty[2, 50, 0.5, 5, 0, false, heli]; while {(count _wreckPos) < 1} do { _PosA = [getpos player,[800,1000],random 360,0,[],heli] call SHK_pos; _wreckPos = _posA isFlatEmpty[2, 50, 0.5, 5, 0, false, heli]; }; _wreckMarker = createMarker ["wreckMarker",_wreckPos]; _wreckMarker setMarkerShape "ELLIPSE"; //for testing _wreckMarker setMarkerColor "ColorOPFOR"; _wreckMarker setMarkerSize [2000, 2000]; _wreckMarker setMarkerBrush "Solid"; _wreckTrigger = createTrigger ["EmptyDetector", getMarkerPos "wreckMarker"]; _wreckTrigger setTriggerArea [1500, 1500, 0, false]; _wreckTrigger setTriggerActivation ["ANY", "PRESENT", false]; _wreckTrigger setTriggerStatements ["!(player in thislist)", "sleep 1; deleteVehicle _wreckTrigger; deleteMarker 'wreckMarker'; deleteVehicle burning; hint 'Fuck yeah'; sleep 2; nul = execVM 'randomWreck.sqf'", ""]; _wreck1 = [["Land_Wreck_HMMWV_F",[0.758789,3.6582,0.0207825],0,1,0,[],"burning = this;","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck2 = [["Land_Wreck_Truck_F",[0.326172,3.39844,0],0,1,0,[],"burning = this;","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck3 = [["Land_Wreck_Car2_F",[0.424805,2.31836,0],103.117,1,0,[],"burning = this;","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck4 = [["Land_Wreck_Car_F",[-0.428711,2.60156,0],116.565,1,0,[],"burning = this;","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck5 = [["Land_Wreck_Hunter_F",[0.118164,4.66016,0],133.172,1,0,[],"burning = this;","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck6 = [["Land_Wreck_Slammer_F",[-0.129883,6.14258,0],0,1,0,[],"burning = this;","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck7 = [["Land_Wreck_Slammer_hull_F",[0.268555,4.48828,0],107.918,1,0,[],"burning = this;","OnFire = 'test_EmptyObjectForFireBig' createVehicle (getPos this);OnFire attachTo [this,[0,1,-1]]",true,false]]; _wreck = [_wreck1, _wreck2, _wreck3, _wreck4, _wreck5, _wreck6, _wreck7]; _wreckComp = _wreck call BIS_fnc_selectRandom; 0 = [(getmarkerPos "wreckMarker"), random 360, _wreckComp] call BIS_fnc_ObjectsMapper; Share this post Link to post Share on other sites
austin_medic 109 Posted August 16, 2015 It would appear your trying to assign a variable the same value as _newObj but you dont tell it which variable (nothing infront of the equals sign), at least thats what the error box is showing... Share this post Link to post Share on other sites
magicpanda 19 Posted August 16, 2015 Cheers cracked that part, just deleted = this after burning. It's deleting the fire effect that's the next problem :wacko: Share this post Link to post Share on other sites
magicpanda 19 Posted August 16, 2015 <3 kylainia _wreckTrigger setTriggerStatements ["!(player in thislist)", "deleteVehicle _wreckTrigger; deleteMarker 'wreckMarker'; {if (typeOf _x == '#particlesource') then {deleteVehicle _x}} forEach (burning nearObjects 10); deleteVehicle burning; hint 'Fuck yeah'; nul = execVM 'randomWreck.sqf'", ""]; Share this post Link to post Share on other sites
Larrow 2823 Posted August 17, 2015 {deleteVehicle _x} forEach ((onFire getvariable 'effects') + onFire) There is also a light source created that you would be leaving behind.All objects created by the effect (light and particle sources) are stored on the object in a variable called 'effects'. Saves having to do nearObjects Share this post Link to post Share on other sites
magicpanda 19 Posted August 17, 2015 Cheers Larrow. Never thought to check it at night. Not in HTML and CSS country now. I will fiddle with findSafePos later to replace all the SHKpos stuff Share this post Link to post Share on other sites
jandrews 116 Posted August 17, 2015 How about just making a simple script that damages, adds fire and smoke to any veh in its init box? May be easier that u can place in editor randomly. But don't let the veh delete or give it a timer. Share this post Link to post Share on other sites
magicpanda 19 Posted August 18, 2015 EDIT: Moved question to a more relevant thread Share this post Link to post Share on other sites