ADuke 1 Posted December 2, 2011 I hope there is a workaround for this.. I have a script that creates a helicopter... Then the script creates the crew for the helicopter... (This script is executed on a Game Logic of mine.) I can use assignAs and orderGetIn for the gunner, but there are 2 other turrets that I want to fill, how can I do this via scripting? Or am I SOL? Note: moveIn commands are useless here because these are dynamically created units. Thanks, -AD Share this post Link to post Share on other sites
[frl]myke 14 Posted December 2, 2011 http://community.bistudio.com/wiki/moveInTurret Share this post Link to post Share on other sites
ADuke 1 Posted December 2, 2011 Myke;2065489']http://community.bistudio.com/wiki/moveInTurret Note: moveIn commands are useless here because these are dynamically created units. Sorry, not going to work, but thanks for your help anyway :) Share this post Link to post Share on other sites
neokika 62 Posted December 2, 2011 Sorry, not going to work, but thanks for your help anyway :) What's the difference between a "dynamically created unit" from an editor placed one? _neo_ Share this post Link to post Share on other sites
ADuke 1 Posted December 2, 2011 What's the difference between a "dynamically created unit" from an editor placed one?_neo_ A unit that is spawned using createVehicle or createUnit. These units don't respond to movein commands. Share this post Link to post Share on other sites
Homer Johnston 0 Posted December 2, 2011 I have great news for you: you're wrong. :D If you can't get it to work, post some of your code and I'm sure someone will look for mistakes. Share this post Link to post Share on other sites
ADuke 1 Posted December 2, 2011 (edited) I have great news for you: you're wrong. :D If you can't get it to work, post some of your code and I'm sure someone will look for mistakes. That is great news :) Here ya go... //////////////////////////////////Spawn Helos//////////////////////////////////////////////////////// _helipad1 = "HeliH" createVehicle (position _logic); _helipad1 setpos [(getPos _logic select 0)+15,(getPos _logic select 1)+5,getPos _logic select 2]; _helo1 = "ad_MH1L" createVehicle (position _logic); _helo1 setpos [(getPos _logic select 0)+15,(getPos _logic select 1)+5,getPos _logic select 2]; _helipad2 = "HeliH" createVehicle (position _logic); _helipad2 setpos [(getPos _logic select 0)-15,(getPos _logic select 1)+5,getPos _logic select 2]; _helo2 = "ad_MH1L" createVehicle (position _logic); _helo2 setpos [(getPos _logic select 0)-15,(getPos _logic select 1)+5,getPos _logic select 2]; sleep 1; ////////////////////////////Spawn Crew//////////////////////////////////////////////////////////////////// _helo1_gunner = "USMC_Soldier_Pilot" createVehicle (getMarkerPos "ad_farp_marker1"); sleep 1; _helo1_gunner moveInGunner _helo1; _helo1_leftdoorgunner = "USMC_Soldier_Pilot" createVehicle (getMarkerPos "ad_farp_marker1"); sleep 1; _helo1_leftdoorgunner moveInTurret [_helo1, [1]]; _helo1_rightdoorgunner = "USMC_Soldier_Pilot" createVehicle (getMarkerPos "ad_farp_marker1"); sleep 1; _helo1_rightdoorgunner moveInTurret [_helo1, [2]]; Thanks, -AD Edited December 2, 2011 by ADuke Share this post Link to post Share on other sites
f2k sel 164 Posted December 2, 2011 _helo1_rightdoorgunner moveInTurret [_helo1, [2]]; isn't that the crew chief? Share this post Link to post Share on other sites
ADuke 1 Posted December 2, 2011 (edited) _helo1_rightdoorgunner moveInTurret [_helo1, [2]]; isn't that the crew chief? Technically, it would be, but naming it "_helo1_rightdoorgunner" doesn't change anything as far as scripting goes. Note: If I place units in the editor and write these same commands into their init fields, they load the helicopter as intended. Something gets lost in the translation of executing these commands in the script, everything works in the script up to that point, everything is created but these units are just standing at their marker. That's why I came to the conclusion that the MoveIn commands don't work on units created via script. Edited December 2, 2011 by ADuke Share this post Link to post Share on other sites
Homer Johnston 0 Posted December 2, 2011 Try using the "createUnit Array" command - createVehicle generally isn't compatible with AI units... I'll paste up some sample code that works tonight (in 5 hrs) if need be. Share this post Link to post Share on other sites
ADuke 1 Posted December 2, 2011 (edited) Try using the "createUnit Array" command - createVehicle generally isn't compatible with AI units...I'll paste up some sample code that works tonight (in 5 hrs) if need be. I had thought that might be the case, I will try that. Thanks again, -AD EDIT: Still not working, here is the new code.... /////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////Spawn Helos//////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////// _helipad1 = "HeliH" createVehicle (position _logic); _helipad1 setpos [(getPos _logic select 0)+15,(getPos _logic select 1)+5,getPos _logic select 2]; _helo1 = "ad_MH1L" createVehicle (position _logic); _helo1 setpos [(getPos _logic select 0)+15,(getPos _logic select 1)+5,getPos _logic select 2]; _helipad2 = "HeliH" createVehicle (position _logic); _helipad2 setpos [(getPos _logic select 0)-15,(getPos _logic select 1)+5,getPos _logic select 2]; _helo2 = "ad_MH1L" createVehicle (position _logic); _helo2 setpos [(getPos _logic select 0)-15,(getPos _logic select 1)+5,getPos _logic select 2]; sleep 1; ///////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////Spawn Crew////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////// _newGroupCenter = createCenter west; _helo1group = createGroup west; _newGroupCenter2 = createCenter west; _helo2group = createGroup west; _helo1_gunner = "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _helo1group]; _helo1_gunner moveInGunner _helo1; _helo1_leftgunner = "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _helo1group]; _helo1_leftgunner moveInTurret [_helo1, [1]]; _helo1_crewchief = "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _helo1group]; _helo1_crewchief moveInTurret [_helo1, [2]]; _helo2_gunner = "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _helo2group]; _helo2_gunner moveInGunner _helo2; _helo2_leftgunner = "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _helo2group]; _helo2_leftgunner moveInTurret [_helo2, [1]]; _helo2_crewchief = "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _helo2group]; _helo2_crewchief moveInTurret [_helo2, [2]]; Edited December 2, 2011 by ADuke Share this post Link to post Share on other sites
f2k sel 164 Posted December 2, 2011 I tried this and it works. _group = createGroup west; "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _group, "this moveInTurret [_helo1, [0]]"]; "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _group, "this moveInTurret [_helo1, [1]]"]; "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _group, "this moveInTurret [_helo1, [2]]"]; Share this post Link to post Share on other sites
ADuke 1 Posted December 2, 2011 I tried this and it works. :party:WINNER WINNER CHICKEN DINNER!!:party: That worked great, thank you!! :) Much respect, :pc: -AD Share this post Link to post Share on other sites
demonized 20 Posted December 3, 2011 why not just use the BIS_fnc_spawnVehicle command? full crew ready to go in one line. unless its something custom crewed ofc. Share this post Link to post Share on other sites
ADuke 1 Posted December 3, 2011 why not just use the BIS_fnc_spawnVehicle command? full crew ready to go in one line.unless its something custom crewed ofc. My hope was to crew the vehicle with different soldier/pilot models that I had configged (door gunners/crew chiefs with face masks and so on). Thanks to the suggestions here I have done that. I will attempt to explain what my intention is with this game logic.. In the group that I play with we tend to lean towards ground fighting/clandestine types of fighting, but once in awhile I feel like taking to the skies and providing CAS or transport. We literally have thousands of missions stockpiled that we play, so in order to place all of the things necessary for an air mission (MMA logics, refuel/rearm facilities etc.) it would require so much time in the mission editor that no human could possibly accomplish it. When we spend more time editing missions than we do playing this makes us not such happy campers. So my intention was to have "One Game Logic to rule them all". This Game Logic, when placed does the following.. 1. Spawns more Game Logics ////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////Spawn Logics/////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// if ((isNil ("ad_logics_spawned"))) then { _center = createCenter sideLogic; _group = createGroup _center; _WeatherLogic = _group createUnit ["BIS_clouds_Logic", position _logic, [], 0, "NONE"]; _mmainitLogic = _group createUnit ["Mando_Missile_ArmA", position _logic, [], 0, "NONE"]; _mmafullLogic = _group createUnit ["Mando_Missile_ArmA_full", position _logic, [], 0, "NONE"]; _mmaACELogic = _group createUnit ["Mando_Missile_ArmA_ace", position _logic, [], 0, "NONE"]; _adLogic = _group createUnit ["AD_MMA_Logic", position _logic, [], 0, "NONE"]; _ace_anti_stamina = _group createUnit ["ACE_NoStamina", position _logic, [], 0, "NONE"]; publicVariable "ad_logics_spawned"; }; 2. Spawns Markers indicating where the F.A.R.P. is /////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////Spawn Markers////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////// _ad_farp_marker1 = createMarker ["ad_farp_marker1", position _logic]; "ad_farp_marker1" setMarkerType "Heliport"; "ad_farp_marker1" setMarkerText "F.A.R.P."; "ad_farp_marker1" setMarkerColor "ColorBlack"; _ad_farp_marker2 = createMarker ["ad_farp_marker2", position _logic]; "ad_farp_marker2" setMarkerShape "RECTANGLE"; "ad_farp_marker2" setMarkerSize [40, 35]; "ad_farp_marker2" setMarkerColor "ColorKhaki"; "ad_farp_marker2" setMarkerBrush "Solid"; "ad_farp_marker2" setMarkerPos [getPos _logic select 0,(getPos _logic select 1)+10,getPos _logic select 2]; _ad_farp_marker3 = createMarker ["ad_farp_marker3", position _logic]; "ad_farp_marker3" setMarkerShape "RECTANGLE"; "ad_farp_marker3" setMarkerSize [40, 35]; "ad_farp_marker3" setMarkerColor "ColorBlack"; "ad_farp_marker3" setMarkerBrush "Border"; "ad_farp_marker3" setMarkerPos [getPos _logic select 0,(getPos _logic select 1)+10,getPos _logic select 2]; 3. Spawns Helicopters to jump in and use //////////////////////////////////////////////////////////////////////////// ////////////////////////////////////Spawn Helos//////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////// _helipad1 = "HeliH" createVehicle (position _logic); _helipad1 setpos [(getPos _logic select 0)+15,(getPos _logic select 1)+5,getPos _logic select 2]; _helo1 = "ad_MH1L" createVehicle (position _logic); _helo1 setpos [(getPos _logic select 0)+15,(getPos _logic select 1)+5,getPos _logic select 2]; _helipad2 = "HeliH" createVehicle (position _logic); _helipad2 setpos [(getPos _logic select 0)-15,(getPos _logic select 1)+5,getPos _logic select 2]; _helo2 = "ad_MH1L" createVehicle (position _logic); _helo2 setpos [(getPos _logic select 0)-15,(getPos _logic select 1)+5,getPos _logic select 2]; 4. Spawns the crew(s) for the helicopters. ///////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////Spawn Crew////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////// _newGroupCenter = createCenter west; _helo1group = createGroup west; _newGroupCenter2 = createCenter west; _helo2group = createGroup west; _helo1_gunner = "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _helo1group,"this moveInGunner _helo1"]; helo1_gunner moveInGunner ad_farp_helo1; _helo1_leftgunner = "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _helo1group,"this moveInTurret [_helo1, [1]]"]; helo1_leftgunner moveInTurret [ad_farp_helo1, [1]]; _helo1_crewchief = "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _helo1group,"this moveInTurret [_helo1, [2]]"]; _helo1_crewchief moveInTurret [ad_farp_helo1, [2]]; _helo2_gunner = "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _helo2group,"this moveInGunner _helo2"]; helo2_gunner moveInGunner ad_farp_helo2; _helo2_leftgunner = "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _helo2group,"this moveInTurret [_helo2, [1]]"]; helo2_leftgunner moveInTurret [ad_farp_helo2, [1]]; _helo2_crewchief = "USMC_Soldier_Pilot" createUnit [getMarkerPos "ad_farp_marker1", _helo2group,"this moveInTurret [_helo2, [2]]"]; helo2_crewchief moveInTurret [ad_farp_helo2, [2]]; 5. Spawns triggers allowing for refuel/repair, as well as recruitment of helo crews /////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////Spawn Triggers//////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////// _refuelrepairtriggger1=createTrigger["EmptyDetector",position _helipad1]; _refuelrepairtriggger1 setTriggerArea[6,6,0,false]; _refuelrepairtriggger1 setTriggerActivation ["WEST", "PRESENT", true]; _refuelrepairtriggger1 setTriggerStatements ["this and ""ad_mh1l"" == typeOf vehicle player and vehicle player in thislist and !isengineon vehicle player","ad_refuelaction1 = vehicle player addaction [""REFUEL at F.A.R.P."",""\ad_helos\scripts\refuel.sqf""];ad_repairaction1=vehicle player addAction[""REPAIR at F.A.R.P"",""\ad_helos\scripts\repair.sqf""]","vehicle player removeaction ad_refuelaction1 ; vehicle player removeaction ad_repairaction1"]; _refuelrepairtriggger2=createTrigger["EmptyDetector",position _helipad2]; _refuelrepairtriggger2 setTriggerArea[6,6,0,false]; _refuelrepairtriggger2 setTriggerActivation ["WEST", "PRESENT", true]; _refuelrepairtriggger2 setTriggerStatements ["this and ""ad_mh1l"" == typeOf vehicle player and vehicle player in thislist and !isengineon vehicle player","ad_refuelaction1 = vehicle player addaction [""REFUEL at F.A.R.P."",""\ad_helos\scripts\refuel.sqf""];ad_repairaction1=vehicle player addAction[""REPAIR at F.A.R.P"",""\ad_helos\scripts\repair.sqf""]","vehicle player removeaction ad_refuelaction1 ; vehicle player removeaction ad_repairaction1"]; _recruittriggger1=createTrigger["EmptyDetector",position _helipad1]; _recruittriggger1 setTriggerArea[6,6,0,false]; _recruittriggger1 setTriggerActivation ["WEST", "PRESENT", false]; _recruittriggger1 setTriggerStatements ["this and ""ad_mh1l"" == typeOf vehicle player and vehicle player in thislist","nul = [thislist] execVM ""\ad_helos\scripts\recruitcrew.sqf""",""]; _recruittriggger2=createTrigger["EmptyDetector",position _helipad2]; _recruittriggger2 setTriggerArea[6,6,0,false]; _recruittriggger2 setTriggerActivation ["WEST", "PRESENT", false]; _recruittriggger2 setTriggerStatements ["this and ""ad_mh1l"" == typeOf vehicle player and vehicle player in thislist","nul = [thislist] execVM ""\ad_helos\scripts\recruitcrew.sqf""",""]; 6. Spawns physical objects of the F.A.R.P. ///////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////Spawn Objects/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////// _wall1 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall1 setpos [getPos _logic select 0,(getPos _logic select 1) -20,getPos _logic select 2]; //second position sets the object behind the game logic _wall2 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall2 setpos [(getPos _logic select 0)+15.5,(getPos _logic select 1)-20,getPos _logic select 2]; _wall3 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall3 setpos [(getPos _logic select 0)+31,(getPos _logic select 1)-20,getPos _logic select 2]; _wall4 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall4 setpos [(getPos _logic select 0)-15.7,(getPos _logic select 1)-20,getPos _logic select 2]; _wall5 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall5 setpos [(getPos _logic select 0)-31.4,(getPos _logic select 1)-20,getPos _logic select 2]; _wall6 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall6 setpos [(getPos _logic select 0)-38.5,(getPos _logic select 1)-11.5,getPos _logic select 2]; _wall6 setDir 90; _wall7 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall7 setpos [(getPos _logic select 0)+38.5,(getPos _logic select 1)-11.5,getPos _logic select 2]; _wall7 setDir 90; _wall8 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall8 setpos [(getPos _logic select 0)+38.5,(getPos _logic select 1)+4,getPos _logic select 2]; _wall8 setDir 90; _wall9 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall9 setpos [(getPos _logic select 0)-38.5,(getPos _logic select 1)+4,getPos _logic select 2]; _wall9 setDir 90; _wall10 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall10 setpos [(getPos _logic select 0)+38.5,(getPos _logic select 1)+18,getPos _logic select 2]; _wall10 setDir 90; _wall11 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall11 setpos [(getPos _logic select 0)-38.5,(getPos _logic select 1)+18,getPos _logic select 2]; _wall11 setDir 90; _wall12 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall12 setpos [(getPos _logic select 0)+38.5,(getPos _logic select 1)+33.5,getPos _logic select 2]; _wall12 setDir 90; _wall13 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall13 setpos [(getPos _logic select 0)-38.5,(getPos _logic select 1)+33.5,getPos _logic select 2]; _wall13 setDir 90; _wall14 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall14 setpos [(getPos _logic select 0)+31.5,(getPos _logic select 1)+42,getPos _logic select 2]; _wall15 = "Base_WarfareBBarrier10x" createVehicle (position _logic); _wall15 setpos [(getPos _logic select 0)-31.5,(getPos _logic select 1)+42,getPos _logic select 2]; _wall16 = "Land_Fort_Watchtower" createVehicle (position _logic); _wall16 setpos [(getPos _logic select 0)+19,(getPos _logic select 1)+39,getPos _logic select 2]; _wall16 setDir 90; _wall17 = "Land_Fort_Watchtower" createVehicle (position _logic); _wall17 setpos [(getPos _logic select 0)-19,(getPos _logic select 1)+39,getPos _logic select 2]; _wall17 setDir 90; _container1 = "Misc_cargo_cont_tiny" createVehicle (position _logic); _container1 setpos [getPos _logic select 0,(getPos _logic select 1)-18,getPos _logic select 2]; _container1 setDir 40; _container2 = "Misc_cargo_cont_tiny" createVehicle (position _logic); _container2 setpos [(getPos _logic select 0)-10,(getPos _logic select 1)-18,getPos _logic select 2]; _container3 = "Misc_cargo_cont_tiny" createVehicle (position _logic); _container3 setpos [(getPos _logic select 0)+10,(getPos _logic select 1)-18,getPos _logic select 2]; _container3 setDir 90; Note: The above part is not yet finished So, it is not finished yet, but that was the intention, just drop in the game logic and we're off to the races. :) -AD Share this post Link to post Share on other sites
demonized 20 Posted December 3, 2011 sounds cool man, like the idea. One thing you might be interested in in terms of vehicel turrets: http://kronzky.info/turrets/index.htm then you could maybe adapt it to dynamic use instead of harcoding all vehicles, or simply use BIS_fnc_spawnVehicle and get assignedVehicleRole command and just replace the unit with your unit of choise and put it back into its seat. Share this post Link to post Share on other sites