Jump to content
Sign in to follow this  
fusion13

Set name of vehicle spawned in?

Recommended Posts

Ok so my code is as follows

_spawn = "B_Heli_Transport_01_F";
_posplr = [((getPos player) select 0) + 2, ((getPos player) select 1) + 2, 0];
_dirplr = getDir player;
_spwnveh = _spawn createVehicle (_posplr);
_spwnveh setVariable ["Sarge",1,true];

Nevermind I got it, it was the setVarible, But anyway how can I make it occupied by AI?

Edited by Fusion13

Share this post


Link to post
Share on other sites
I suggest you to use BIS_fnc_spawnVehicle. It spawns the entire crew plus turrets and requires only one line of code.

Sweet thanks

Actually how would I name the vehicle I tried to use the method I had used recently but I dont think it will work

Edited by Fusion13

Share this post


Link to post
Share on other sites

_veh = [getPos mySpawnPos, 180, "BMP3", EAST] call bis_fnc_spawnvehicle;
(_veh select 0) setVehicleVarName "theName";

---------- Post added at 14:29 ---------- Previous post was at 14:29 ----------

The function returns an array - 0: created vehicle (Object), 1: all crew (Array of Objects), 2: vehicle's group (Group)

Edited by Iceman77

Share this post


Link to post
Share on other sites
_veh = [getPos mySpawnPos, 180, "BMP3", EAST] call bis_fnc_spawnvehicle;
(_veh select 0) setVehicleVarName "theName";

---------- Post added at 14:29 ---------- Previous post was at 14:29 ----------

The function returns an array - 0: created vehicle (Object), 1: all crew (Array of Objects), 2: vehicle's group (Group)

Hey I have this

_posplr = [((getPos player) select 0) + 100, ((getPos player) select 1) + 100, 0];
_posplr2 = [((getPos player) select 0) + 2, ((getPos player) select 1) + 2, 0];
_veh = [_posplr, 180, "B_Heli_Transport_01_F", WEST] call bis_fnc_spawnvehicle;
(_veh select 0) setVehicleVarName "helievac";
helievac moveTo _posplr2;
hint format ["swag","PLAIN"];

Ignore the hint it's a testing thing

But anyway that wont work for some reason it will just sit there and hover

Share this post


Link to post
Share on other sites

_veh = [getPos player, 180, "B_Heli_Transport_01_F", WEST] call bis_fnc_spawnvehicle;
(_veh select 0) setVehicleVarName "helo1";
call compile format ["%1=_veh select 0","helo1"];

sleep 1;
if (alive helo1) then {helo1 doMove getPos pad1;};

---------- Post added at 15:06 ---------- Previous post was at 14:59 ----------

_veh = [getPos player, 180, "B_Heli_Transport_01_F", WEST] call bis_fnc_spawnvehicle;
_veh call compile format ["%1=_this select 0","helo1"];

sleep 1;
if (alive helo1) then {helo1 doMove getPos pad1;};

This also works. :p

Edited by Iceman77

Share this post


Link to post
Share on other sites

Thanks it worked, Besides it won't land next to the player, do I have to make a invisible helipad spawn at _posplr2?

Share this post


Link to post
Share on other sites

You can use the Land command + a waypoint for the helo to land. You may need some other commands too, to get the helo to behave how you want upon landing.

Share this post


Link to post
Share on other sites

I'm not sure. I don't use the "move" waypoint with the land command because it didn't work when I tried it last (some time ago). I'm always using getOut, unload or TRUnload for my needs, combined with Land. I've no problems with them landing so far. They do like to land though at the nearest H pad. I hope lol.. tbh I haven't checked any landing scripts since the latest patch.

Share this post


Link to post
Share on other sites

Hmm. You've tried creating a waypoint onto an empty Hpad (or any heli pad) and using the land command?

---------- Post added at 16:49 ---------- Previous post was at 16:41 ----------

Try something like this.

_helo = [getPosATL player, 180, "B_Heli_Transport_01_F", WEST] call bis_fnc_spawnvehicle;
_hPad = createVehicle ["Land_HelipadEmpty_F", getMarkerPos "lz", [], 0, "CAN_COLLIDE"];
_heloCrew = createGroup west; 
{[_x] joinSilent _heloCrew;} forEach crew (_helo select 0);    

_heloWp = _heloCrew addWaypoint [_hPad, 0];
_heloWp setWaypointType "TR UNLOAD";
//_heloWp setWaypointType "GETOUT";
//_heloWp setWaypointType "UNLOAD";
_heloWp setWaypointBehaviour "CARELESS";
_heloWp setWaypointCombatMode "BLUE";
_heloWp setWaypointSpeed "FULL";
_heloWp setWaypointStatements ["true", "(vehicle this) LAND 'LAND';"];

waitUntil {isTouchingGround (_helo select 0)};

//doStuff  

---------- Post added at 17:03 ---------- Previous post was at 16:49 ----------

K, just tested and he lands on the created pad. You can also use doStop command once he's touching the ground etc. maybe even lock the vehicle and play with the fule too. Idk, just some ideas. Not sure exactly what you're trying to do.

Edited by Iceman77

Share this post


Link to post
Share on other sites
Hmm. You've tried creating a waypoint onto an empty Hpad (or any heli pad) and using the land command?

---------- Post added at 16:49 ---------- Previous post was at 16:41 ----------

Try something like this.

_helo = [getPosATL player, 180, "B_Heli_Transport_01_F", WEST] call bis_fnc_spawnvehicle;
_hPad = createVehicle ["Land_HelipadEmpty_F", getMarkerPos "lz", [], 0, "CAN_COLLIDE"];
_heloCrew = createGroup west; 
{[_x] joinSilent _heloCrew;} forEach crew (_helo select 0);    

_heloWp = _heloCrew addWaypoint [_hPad, 0];
_heloWp setWaypointType "TR UNLOAD";
//_heloWp setWaypointType "GETOUT";
//_heloWp setWaypointType "UNLOAD";
_heloWp setWaypointBehaviour "CARELESS";
_heloWp setWaypointCombatMode "BLUE";
_heloWp setWaypointSpeed "FULL";
_heloWp setWaypointStatements ["true", "(vehicle this) LAND 'LAND';"];

waitUntil {isTouchingGround (_helo select 0)};

//doStuff  

I'll try this tomorrow I am off for the night, Thanks for the help man!

Share this post


Link to post
Share on other sites

Looks like for some reason the mission I had was corrupted, no matter what I do they don't land but if I load another they work perfectly.

Not even a flying chopper with a getout waypoint would land.

I didn't even know it was possible to corrupt things.

Share this post


Link to post
Share on other sites

Sounds about right. But who would ever think that their mission is corrupted? That would drive me crazy trying to figure the problem out. LOL

Share this post


Link to post
Share on other sites

Well the mission is posted on the feedback tracker if you want to check it, I can't see anything wrong in mission.sqf

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×