UltimateBawb 1 Posted April 9, 2013 I'm trying to make a dynamic side mission generator, starting with a VIP mission. The VIP and group of 5 other soldiers starts at "vipCarSpawn" with 2 cars, on unarmed and one armed. The two cars should move to "_vipHeliSpawn," which is randomly selected from 2 positions, a north helipad and south helipad. At either helipad, their is a helicopter with two pilots which should fly him off of the map, or to "outOfMapMarker." If the helicopter makes it to the marker with the VIP still alive, the side mission is lost, but if the VIP is killed, it is won. I've turned on the -showScriptErrors launch option and debugged all syntax errors, but the checks to see if the groups are at their waypoints are ignored, and the convoy does not move to the helipad successfully. I believe it has to do with the setWaypointStatements parts of the script and have tried multiple fixes to no avail. Any help? while {true} do { _rand = (floor 100); if ((_rand < 101) and (! sideMissionOn) and (isServer)) then { _vipHeliSpawn = ""; carWayDone = false; heliWayDone = false; sideMissionOn = true; _vipGroup = createGroup east; unitK = _vipGroup createUnit ["O_Soldier_SL_F", getMarkerPos "vipCarSpawn", [], 6, "NONE"]; vipMan = _vipGroup createUnit ["C_man_polo_1_F", getMarkerPos "vipCarSpawn", [], 6, "NONE"]; _unit1 = _vipGroup createUnit ["O_Soldier_lite_F", getMarkerPos "vipCarSpawn", [], 6, "NONE"]; _unit2 = _vipGroup createUnit ["O_Soldier_lite_F", getMarkerPos "vipCarSpawn", [], 6, "NONE"]; _unit3 = _vipGroup createUnit ["O_Soldier_AR_F", getMarkerPos "vipCarSpawn", [], 6, "NONE"]; _unit4 = _vipGroup createUnit ["O_medic_F", getMarkerPos "vipCarSpawn", [], 6, "NONE"]; removeAllWeapons vipMan; vipMan addWeapon "hgun_Rook40_F"; vipMan addMagazine "30Rnd_9x21_Mag"; vipMan addMagazine "30Rnd_9x21_Mag"; _rand = (floor 100); if (_rand < 50) then {_vipHeliSpawn = "northHelipad";} else {_vipHeliSpawn = "southHelipad";}; _vipHeli = createVehicle ["O_Ka60_Unarmed_F", getMarkerPos _vipHeliSpawn, [], 0, "NONE"]; _vipHeliGroup = createGroup east; _unitPilot1 = _vipHeliGroup createUnit ["O_helipilot_F", getMarkerPos _vipHeliSpawn, [], 4, "NONE"]; _unitPilot2 = _vipHeliGroup createUnit ["O_helipilot_F", getMarkerPos _vipHeliSpawn, [], 4, "NONE"]; _unitPilot1 assignAsDriver _vipHeli; _unitPilot2 assignAsCargo _vipHeli; _vipCar = createVehicle ["O_Ifrit_F", getMarkerPos "vipCarSpawn", [], 6, "NONE"]; _vipEscort = createVehicle ["O_Ifrit_MG_F", getMarkerPos "vipCarSpawn", [], 6, "NONE"]; _vipCar setDir 260; _vipEscort setDir 260; unitK assignAsDriver _vipCar; vipMan assignAsCargo _vipCar; _unit1 assignAsCargo _vipCar; _unit4 assignAsCargo _vipCar; _unit3 assignAsDriver _vipEscort; _unit2 assignAsGunner _vipEscort; _vipGroup addVehicle _vipCar; _vipGroup addVehicle _vipEscort; _carWay = _vipGroup addWaypoint [getMarkerPos "_vipHeliSpawn", 15]; _carWay setWaypointType "MOVE"; _carWay setWaypointStatements ["true", "carWayDone = true;"]; while {! carWayDone} do {sleep 5;}; while {(! unitReady unitK) and (alive unitK)} do {sleep 5}; unitK action ["eject", vehicle unitK]; vipMan action ["eject", vehicle vipMan]; _unit1 action ["eject", vehicle _unit1]; _unit4 action ["eject", vehicle _unit4]; _unit3 action ["eject", vehicle _unit3]; unassignVehicle vipMan; vipMan assignAsCargo _vipHeli; [vipMan] joinSilent _vipHeliGroup; _heliWay = _vipHeliGroup addWaypoint [getMarkerPos "outOfMapMarker", 30]; _heliWay setWaypointType "MOVE"; _heliWay setWaypointStatements ["true", "heliWayDone = true;"]; while {! heliWayDone} do {sleep 5;}; while {(! unitReady _unitPilot1) and (alive _unitPilot1)} do {sleep 5}; if (alive vipMan) then { hint "Failed."; } else { hint "Success."; }; sideMissionOn = false; }; sleep 600; }; Share this post Link to post Share on other sites
UltimateBawb 1 Posted April 9, 2013 Any help? :/ [bump] Share this post Link to post Share on other sites
f2k sel 164 Posted April 9, 2013 I made a few changes and it seems to work ok now. Things I changed There was no random selection being made. Removed if ((_rand < 101) and (! sideMissionOn) and (isServer)) then { as it stopped it working for me I had to add this otherwise they ran to the chopper {[_x] orderGetIn true} foreach units _vipgroup+[_vipman]; your main problem was that you used _carWay = _vipGroup addWaypoint [getmarkerPos "_vipHeliSpawn", 15]; it should be _carWay = _vipGroup addWaypoint [getmarkerPos _vipHeliSpawn, 15]; while {true} do { _rand = floor random 2;// 0-1 as it's rounded down // if ((_rand < 101) and (! sideMissionOn) and (isServer)) then { _vipHeliSpawn = ""; carWayDone = false; heliWayDone = false; sideMissionOn = true; _vipGroup = createGroup east; unitK = _vipGroup createUnit ["O_Soldier_SL_F", getMarkerPos "vipCarSpawn", [], 26, "NONE"]; vipMan = _vipGroup createUnit ["C_man_polo_1_F", getMarkerPos "vipCarSpawn", [], 26, "NONE"]; _unit1 = _vipGroup createUnit ["O_Soldier_lite_F", getMarkerPos "vipCarSpawn", [], 26, "NONE"]; _unit2 = _vipGroup createUnit ["O_Soldier_lite_F", getMarkerPos "vipCarSpawn", [], 26, "NONE"]; _unit3 = _vipGroup createUnit ["O_Soldier_AR_F", getMarkerPos "vipCarSpawn", [], 26, "NONE"]; _unit4 = _vipGroup createUnit ["O_medic_F", getMarkerPos "vipCarSpawn", [], 26, "NONE"]; removeAllWeapons vipMan; vipMan addWeapon "hgun_Rook40_F"; vipMan addMagazine "30Rnd_9x21_Mag"; vipMan addMagazine "30Rnd_9x21_Mag"; //_rand = (floor 100); if (_rand == 0) then {_vipHeliSpawn = "northHelipad";} else {_vipHeliSpawn = "southHelipad";}; _vipHeli = createVehicle ["O_Ka60_Unarmed_F", getMarkerPos _vipHeliSpawn, [], 0, "NONE"]; _vipHeliGroup = createGroup east; _unitPilot1 = _vipHeliGroup createUnit ["O_helipilot_F", getMarkerPos _vipHeliSpawn, [], 4, "NONE"]; _unitPilot2 = _vipHeliGroup createUnit ["O_helipilot_F", getMarkerPos _vipHeliSpawn, [], 4, "NONE"]; _unitPilot1 assignAsDriver _vipHeli; _unitPilot2 assignAsCargo _vipHeli; _vipCar = createVehicle ["O_Ifrit_F", getMarkerPos "vipCarSpawn", [], 6, "NONE"]; _vipEscort = createVehicle ["O_Ifrit_MG_F", getMarkerPos "vipCarSpawn", [], 6, "NONE"]; _vipCar setDir 260; _vipEscort setDir 260; unitK assignAsDriver _vipCar; vipMan assignAsCargo _vipCar; _unit1 assignAsCargo _vipCar; _unit4 assignAsCargo _vipCar; _unit3 assignAsDriver _vipEscort; _unit2 assignAsGunner _vipEscort; _vipGroup addVehicle _vipCar; _vipGroup addVehicle _vipEscort; {[_x] orderGetIn true} foreach units _vipgroup+[_vipman]; _carWay = _vipGroup addWaypoint [getmarkerPos _vipHeliSpawn, 15]; _carWay setWaypointType "MOVE"; _carWay setWaypointStatements ["true", "carWayDone = true;hint 'test wp1'"]; while {! carWayDone} do {sleep 5;}; while {(! unitReady unitK) and (alive unitK)} do {sleep 5}; unitK action ["eject", vehicle unitK]; vipMan action ["eject", vehicle vipMan]; _unit1 action ["eject", vehicle _unit1]; _unit4 action ["eject", vehicle _unit4]; _unit3 action ["eject", vehicle _unit3]; unassignVehicle vipMan; vipMan assignAsCargo _vipHeli; [vipMan] joinSilent _vipHeliGroup; _heliWay = _vipHeliGroup addWaypoint [getMarkerPos "outOfMapMarker", 30]; _heliWay setWaypointType "MOVE"; _heliWay setWaypointStatements ["true", "heliWayDone = true;;hint 'test wp2'"]; while {! heliWayDone} do {sleep 5;}; while {(! unitReady _unitPilot1) and (alive _unitPilot1)} do {sleep 5}; if (alive vipMan) then { hint "Failed."; } else { hint "Success."; }; sideMissionOn = false; }; sleep 600; //}; Share this post Link to post Share on other sites
UltimateBawb 1 Posted April 9, 2013 Ah, thanks. I'll test in when I can in about a half and hour. :) Sorry about the first 'if' test; it was meant to check a global boolean sideMissionOn that was defined in the init, and the '_rand < 101' was meant for debugging purposes. The whole thing was meant to loop every 10 minutes with a very low probability of the VIP side mission actually occurring if another side mission was not already in progress. I'll probably make a universal counter script to call them later. Thanks again! Share this post Link to post Share on other sites