cash 15 Posted October 17, 2014 (edited) Hello all , I have lost two days in such simple task , the task is make a troops reinforcement via air taxi. Here is the code located in Init.sqf : //ALL MARKERS IS ALREADY HAS BEEN PLACED IN EDITOR// _grpheli = createGroup west; _pilot = "B_Helipilot_F" createunit [getMarkerPos "barracks",_grpheli,"",1,"FORM"]; //________________________________________________________________________________________// _heli = createVehicle ["B_Heli_Transport_01_camo_F",getMarkerPos "helispawn",[],0,"FORM"]; [color="#FF0000"]//________________BELOW THIS LINE CODE IS NOT WORKING________________________//[/color] _pilot assignAsDriver _heli; _pilot orderGetIn true; //________________________________________________________________________________________// _troops = createGroup west; _soldier1 = "B_Soldier_F" createunit [getMarkerPos "barracks",_troops,"",1,"FORM"]; _soldier2 = "B_Soldier_F" createunit [getMarkerPos "barracks",_troops,"",1,"FORM"]; _soldier3 = "B_Soldier_F" createunit [getMarkerPos "barracks",_troops,"",1,"FORM"]; //________________________________________________________________________________________// _wpPilot1 = _grpheli addWaypoint [getMarkerPos "HeliPad", 0]; [_grpheli,0] setWaypointType "LOAD"; _wpPilot2 = _grpheli addWaypoint [getMarkerPos "LZ", 1]; [_grpheli,1] setWaypointType "MOVE"; //________________________________________________________________________________________// _wpTroops1 = _troops addWaypoint [getMarkerPos "NearHeliPad1", 0]; [_troops,0] setWaypointType "MOVE"; _wpTroops2 = _troops addWaypoint [getMarkerPos "HeliPad", 1]; [_troops,1] setWaypointType "GETIN"; [_grpheli,0] synchronizeWaypoint [[_troops,1]]; //________________________________________________________________________________________// Help me please if you know what problem is . Edited October 17, 2014 by CASH Share this post Link to post Share on other sites
jshock 512 Posted October 17, 2014 How are you calling this script and what do you mean by not working, exactly, my obvious guess would be that the pilot is not getting moved into the _heli, but I'm just making sure that is the "not working" part :p. Share this post Link to post Share on other sites
TKTom 10 Posted October 17, 2014 Hello all , I have lost two days in such simple task , the task is make a troops reinforcement via air taxi. Here is the code :_groupheli = createGroup west; _pilot = "B_Helipilot_F" createunit [getMarkerPos "barracks",_groupheli,"",1,"FORM"]; //________________________________________________________________________________________// _heli = createVehicle ["B_Heli_Transport_01_camo_F", getMarkerPos "heli", [], 0, "FORM"]; //________________________________________________________________________________________// [color="#FF0000"]_pilot moveInDriver _heli;[/color] The red peace of code is not working . Help please if you know what problem is . I believe that the syntax of CreateUnit that you are using does not return the object, use the other one. https://community.bistudio.com/wiki/createUnit_array <-- gives the usage you want https://community.bistudio.com/wiki/createUnit <-- gives the usage you got (_pilot is nothing) Alternatively, before the moveInDriver. (Assuming the pilot is the only member of the group.) _pilot = leader _groupheli; Share this post Link to post Share on other sites
jshock 512 Posted October 17, 2014 I believe that the syntax of CreateUnit that you are using does not return the object, use the other one.https://community.bistudio.com/wiki/createUnit_array <-- gives the usage you want https://community.bistudio.com/wiki/createUnit <-- gives the usage you got (_pilot is nothing) Alternatively, before the moveInDriver. (Assuming the pilot is the only member of the group.) _pilot = leader _groupheli; That as well as the "FORM" that you currently have as the last argument in your current syntax is incorrect, because that is suppossed to be the rank of the unit, i.e. "PRIVATE". So it looks like you just mixed up your syntax :p, always fun. So, your _pilot creation line should look like: _pilot = _groupheli createUnit ["B_Helipilot_F", (getMarkerPos "barracks"), [], 0, "NONE"]; Share this post Link to post Share on other sites
cash 15 Posted October 17, 2014 //ALL MARKERS IS ALREADY HAS BEEN PLACED IN EDITOR// _grpheli = createGroup west; //_pilot = "B_Helipilot_F" createunit [getMarkerPos "barracks",_grpheli,"",1,"NONE"]; "B_Helipilot_F" createUnit [ getMarkerPos "barracks", _grpheli]; //[color="#FF0000"]In both cases created a unit perfect,i'v try both of it for the rest piece of code[/color]// _heli = createVehicle ["B_Heli_Transport_01_camo_F",getMarkerPos "helispawn",[],0,"NONE"]; //_____________________BELOW THIS LINE CODE IS NOT WORKING PROPERLY____________________// _pilot assignAsDriver _heli; _pilot orderGetIn true; _pilot moveInDriver _heli; //[color="#FF0000"]Do not working,the pilot won't get in heli in both cases[/color]// _troops = createGroup west; _soldier1 = "B_Soldier_F" createunit [getMarkerPos "barracks",_troops,"",1,"NONE"]; _soldier2 = "B_Soldier_F" createunit [getMarkerPos "barracks",_troops,"",1,"NONE"]; _soldier3 = "B_Soldier_F" createunit [getMarkerPos "barracks",_troops,"",1,"NONE"]; //[color="#FF0000"]Units creates fine [/color]// _wpPilot1 = _grpheli addWaypoint [getMarkerPos "HeliPad", 0]; [_grpheli,0] setWaypointType "LOAD"; _wpPilot2 = _grpheli addWaypoint [getMarkerPos "LZ", 1]; [_grpheli,1] setWaypointType "MOVE"; //[color="#FF0000"]The WP are working normal,except one thing , the pilot is not in heli[/color]// _wpTroops1 = _troops addWaypoint [getMarkerPos "NearHeliPad1", 0]; [_troops,0] setWaypointType "MOVE"; _wpTroops2 = _troops addWaypoint [getMarkerPos "HeliPad", 1]; [_troops,1] setWaypointType "GETIN"; [_grpheli,0] synchronizeWaypoint [[_troops,1]]; //[color="#FF0000"]Here is working only first WP "MOVE"[/color]// Share this post Link to post Share on other sites
TKTom 10 Posted October 18, 2014 Put a line: Hint str _pilot; In somewhere and you will see what we are talking about. Yes, the unit creates fine but your _pilot variable is not referencing anything because the create is not returning anything. I know it seems very counter-intuitive but you are not using the same command as Jshock has in his line. Share this post Link to post Share on other sites
jshock 512 Posted October 18, 2014 (edited) You need to sync [_grpheli,1] waypoint with [[_troops, 1]] waypoint not, [[_troops, 0]], then you need to add a "GETOUT", waypoint to the _troops and sync that with the [_grpheli,2] waypoint. There is one small change in this than what I sent you back via PM (create pilot line): _grpheli = createGroup west; _pilot = _groupheli createUnit ["B_Helipilot_F", (getMarkerPos "barracks"), [], 0, "NONE"];//<< My pilot createUnit _heli = createVehicle ["B_Heli_Transport_01_camo_F",getMarkerPos "helispawn",[],0,"NONE"]; //_____________________________________________________________________________________// _pilot = leader _grpheli; _pilot assignAsDriver _heli; [_pilot,1] orderGetIn true; _troops = createGroup west; _soldier1 = "B_Soldier_F" createunit [getMarkerPos "barracks",_troops,"",1,"COLONEL"]; _soldier2 = "B_Soldier_F" createunit [getMarkerPos "barracks",_troops,"",1,"PRIVATE"]; _soldier3 = "B_Soldier_F" createunit [getMarkerPos "barracks",_troops,"",1,"PRIVATE"]; player joinAs [_troops, 4]; _wpPilot1 = _grpheli addWaypoint [position _heli, 0]; [_grpheli,0] setWaypointType "MOVE"; _wpPilot2 = _grpheli addWaypoint [getMarkerPos "HeliPad", 1]; [_grpheli,1] setWaypointType "LOAD"; _wpPilot3 = _grpheli addWaypoint [getMarkerPos "LZ", 2]; [_grpheli,2] setWaypointType "TR UNLOAD"; _wpTroops1 = _troops addWaypoint [getMarkerPos "HeliPad", 0]; [_troops,0] setWaypointType "MOVE"; _wpTroops2 = _troops addWaypoint [position _heli, 1]; //<<This index also needed to be 1, not 0 [_troops,1] setWaypointType "GETIN"; [_grpheli,1] synchronizeWaypoint [[_troops,1]]; _wpTroops3 = _troops addWaypoint [position _heli, 2];//<<New waypoint [_troops, 2] setWaypointType "GETOUT";//<<Type of waypoint, get out of chopper [_grpheli,2] synchronizeWaypoint [[_troops, 2]];//<< syncs to the transport unload And to add to what TKTom is saying, There are two types of "createUnit" commands, there is the createUnit (older), and the newer(ish) createUnit array, the difference between the two is that the "older" version does not return a unit object, however the "newer" version returns the unit object. So what this means is when you have your createUnit array code line "=" to a variable (in this case _pilot) the return value coming from the code line will now be equal to the variable (_pilot). So when createUnit array returns the unit object, _pilot is now equal to the unit, and when we say that the older createUnit command isn't returning a value (because it doesn't) this means that every other time you used _pilot in the script, _pilot is not defined. Edited October 18, 2014 by JShock Share this post Link to post Share on other sites