htmlasp 10 Posted April 23, 2011 Hi everyone. I am new to the editor and scripting and I am trying to make a mission where there is a helicopter crash and a battle that happens after and takes place at the crash site. So far I have been able to get the helicopter to crash. I am using a script supplied on here and it crashes somewhere different each time. I can also get groups of OPFOR units to converge on the crash site. Now when the chopper crashes everyone inside is dead, so I want to spawn a couple of pilots at the crash that the player can try to protect and rescue. I can't just use a script to create them in the same place, because like I said, it crashes somewhere different each time. Its just random. So I am using similar code to what I use to get the OPFOR to converge on the crash site. This is what I do (chopper is the name of the helicopter that crashed) In a trigger: Condition: !alive chopper On Act: "USMC_Soldier" createUnit [getPos chopper, grppa, "", 0.5, "private"]; I have tried so many variations of this and nothing is working. I use the getPos with domove to get the OPFOR to move to the chopper using the same !alive chopper in the condition, and it works great. But for the spawning of units, nothing. THANKS IN ADVANCE! Keep up the awesome work everyone. Share this post Link to post Share on other sites
tyler4171 10 Posted April 23, 2011 For a definitave Helo wreck try using the UnitCapture/UnitPlay functions http://forums.bistudio.com/showthread.php?t=101421&highlight=record Then try spawning the units on a marker at the wreck Share this post Link to post Share on other sites
taro8 806 Posted April 23, 2011 Maybe spawn unit first somewhere offmap and then teleport them. Share this post Link to post Share on other sites
undercoverbrother 10 Posted April 24, 2011 (edited) g'day htmlasp, the following script will: - spawn a helo at a random crashsite - damage it enough to get the crew out - make the crew hold the there position - spawna a random 6 man team of enemies and make them move to the crashsite - then keep checking if the enemy team has been eliminated, in which case a message will pop up and the helo crew will join your crew for this to work you need to: - press (f7) - the one for modules - in the editor double-click on the map and select the functions module - place execatly 4 markers were you want the helo to spawn and call them crashSite1, crashSite2... - have fun here is the code: _pos1 = getMarkerPos "crashSite1"; _pos2 = getMarkerPos "crashSite2"; _pos3 = getMarkerPos "crashSite3"; _pos4 = getMarkerPos "crashSite4"; _posArray = [_pos1, _pos2, _pos3, _pos4]; _crashsite = _posArray select (round(random 3)); _helo = "UH60M_EP1"; _spawnvehicleArray = [[1,1,1], 90, _helo, WEST] call bis_fnc_spawnvehicle; _spawnvehicle = _spawnvehicleArray select 0; _spawngroup = _spawnvehicleArray select 2; _spawnvehicle setpos _crashsite; _spawnVehicle setVelocity [0, 0, 0]; _spawnvehicle setDamage 0.7; sleep 4; _spawngroup allowDamage false; _spawnvehicle setDamage 1; _wp = _spawngroup addWaypoint [_crashsite, 0]; _wp setWaypointBehaviour "COMBAT"; _wp setWaypointSpeed "FULL"; _wp setWaypointType "HOLD"; _enemyUnits1 = ["TK_GUE_Soldier_5_EP1","TK_GUE_Soldier_AR_EP1","TK_GUE_Warlord_EP1","TK_GUE_Soldier_TL_EP1", "TK_INS_Soldier_2_EP1", "TK_GUE_Warlord_EP1"]; _enemyUnits2 = ["TK_GUE_Soldier_MG_EP1","TK_INS_Soldier_4_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_Sniper_EP1", "TK_INS_Soldier_AA_EP1", "TK_INS_Soldier_TL_EP1"]; _enemyUnits3 = ["TK_Soldier_AR_EP1", "TK_Soldier_AA_EP1", "TK_Soldier_EP1", "TK_Soldier_B_EP1", "TK_Soldier_Sniper_EP1", "TK_Soldier_MG_EP1"]; _enemyUnitsArray = [_enemyUnits1, _enemyUnits2, _enemyUnits3]; _enemyUnits = _enemyUnitsArray select (round(random 2)); _spawngroupEnemies = [_crashsite, EAST, _enemyUnits, [],[],[0.4,0.6]] call BIS_fnc_spawnGroup; _wp = _spawngroupEnemies addWaypoint [_crashsite, 0]; _enemiesPresent = true; while {_enemiesPresent = true} do { _enemiesPresent = false; { if (alive _x) then { _enemiesPresent = true; }; } forEach units _spawngroupEnemies; if (_enemiesPresent = false) then { hint format "Congratulations, all enemies have been eliminated, crashsite secured"; {_x join (group player)} forEach units _spawngroupEnemies; }; sleep 5; }: it is untested, so if there are any problems message me or reply and I'll have a look. good luck, I hope this works for you, undercoverbrother Edited April 24, 2011 by undercoverbrother Share this post Link to post Share on other sites
ke6jzs 1 Posted June 16, 2012 (edited) Hello, sounds like just what I need, but only the 6 man enemy groups spawns, no helo and no Nice job when I waste them all. I have 4 markers named as the script looks for: crashSite1, crashSite2, etc.... and 1 function module. Then I put a trigger that runs the script? Does the function run the script? tried it both ways. Gary Edited June 16, 2012 by ke6jzs Share this post Link to post Share on other sites