Jump to content
Sign in to follow this  
denco

CreateVehicleCrew problem

Recommended Posts

Hi guys, I'm having the strangest issue. I'm trying to spawn a vehicle with its crew but it doesn't work. The vehicle spawns but its completely empty and I get no script error.

Here is the line;

_h1 = createVehicle ["I_Heli_Transport_02_F", getmarkerpos "Helli_spawn1", [], 0, "NONE"];
createVehicleCrew _h1;

As I said it doesn't work. The vehicle spawns but its empty. So I did what was only natural and I tried something else.

_h1 = [getmarkerpos "Helli_spawn1", 0 , "I_Heli_Transport_02_F", west] call BIS_bis_fnc_spawnVehicle;
createVehicleCrew (_h1 select 0);

And I get the same result. The vehicle spawns but its empty :confused:

Any ideas.

---------- Post added at 02:53 PM ---------- Previous post was at 02:32 PM ----------

My bad, I was editing the script in the wrong folder ( I started a new mission for this script to test it ) :o

Can a moderator delete this thread please.

Share this post


Link to post
Share on other sites

Glad you got the problem fixed, and thank you for editing in your solution! I see you are using the function for spawnVehicle. Excellent. I believe their is also a function for spawnCrew. Also, I thought there was another function that allowed you to spawn a vehicle and a crew with one execution. Sorry to be guessing, I'm just not at my main PC. But I'd suggest looking into that and doing it. Of course, if what you've got works and you can control it, go on with your bad self.

Share this post


Link to post
Share on other sites
;2671882']But I'd suggest looking into that and doing it. Of course' date=' if what you've got works and you can control it, go on with your bad self.[/quote']

Yea it works good so I'll leave it as it is now and suffer the consequences :). But I'll look into those options you've listed they look very interesting.

Share this post


Link to post
Share on other sites
;2671882']Also' date=' I thought there was another function that allowed you to spawn a vehicle and a crew with one execution.[/quote']

_h1 = [getmarkerpos "Helli_spawn1", 0 , "I_Heli_Transport_02_F", WEST] call BIS_fnc_spawnVehicle;

I believe that spawns in the heli with WEST units controlling it

BIS_fnc_spawnVehicle

Share this post


Link to post
Share on other sites
_h1 = [getmarkerpos "Helli_spawn1", 0 , "I_Heli_Transport_02_F", WEST] call BIS_fnc_spawnVehicle;

I believe that spawns in the heli with WEST units controlling it

BIS_fnc_spawnVehicle

Bingo, this is what I was talking about. I use it whenever I spawn "reinforcements" in COOP missions. Controllable, too.

Share this post


Link to post
Share on other sites
;2672050']Bingo' date=' this is what I was talking about. I use it whenever I spawn "reinforcements" in COOP missions. Controllable, too.[/quote']

Well I tried it and it makes my game crashed on load.

eArmor1 = [getmarkerPos "Armor_Spawn", 0, "I_MBT_03_cannon_F" resistance] call bis_fnc_spawnVehicle;

I've been having some issues with my script where whenever I forget something it crashes instead of reporting any error.

//Create 2 helicopters and spawn them

h1grp = creategroup resistance;
h2grp = creategroup resistance;


h1 = createVehicle ["I_Heli_Transport_02_F", getMarkerPos "Helli_spawn1", [], 0, "NONE"];
createVehicleCrew h1;
h1grp = group h1;

h2 = createVehicle ["I_Heli_Transport_02_F", getmarkerpos "Helli_spawn2", [], 0, "NONE"];
createVehicleCrew h2;
h2grp = group h2;

//Create 2 groups for paratroopers

egrp1 = creategroup resistance;
egrp2 = creategroup resistance;

//Group 1
Para_leader = "I_Soldier_SL_F" createunit [getmarkerpos "para_spawn", egrp1, "this addbackpack ""B_Parachute""", 0.3, "Captain"];
Para_trooper1 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp1, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];
Para_trooper2 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp1, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];
Para_trooper3 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp1, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];
Para_trooper4 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp1, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];
Para_trooper5 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp1, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];
Para_trooper6 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp1, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];
Para_trooper7 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp1, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];

{_x moveinCargo h1} foreach units egrp1;

//Group 2


Para2_leader = "I_Soldier_SL_F" createunit [getmarkerpos "para_spawn", egrp2, "this addbackpack ""B_Parachute""", 0.3, "Captain"];
Para2_trooper1 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp2, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];
Para2_trooper2 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp2, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];
Para2_trooper3 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp2, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];
Para2_trooper4 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp2, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];
Para2_trooper5 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp2, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];
Para2_trooper6 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp2, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];
Para2_trooper7 = "I_soldier_F" createUnit [getmarkerpos "para_spawn", egrp2, "this addbackpack ""B_parachute""", 0.2, "Sergeant"];

{_x moveincargo h2} foreach units egrp2;

sleep 2;

//Enemy Armor spawn
agrp1 = creategroup resistance;

/*eArmor1 = createVehicle ["I_MBT_03_cannon_F", getMarkerPos "Armor_Spawn", [], 0, "NONE"];
createVehicleCrew eArmor1;

eArmor2 = createVehicle ["I_MBT_03_cannon_F", getmarkerpos "Armor_Spawn", [], 0, "NONE"];
createVehicleCrew eArmor2;

eArmor3 = createVehicle ["I_MBT_03_cannon_F", getmarkerpos "Armor_Spawn", [], 0, "NONE"];
createVehicleCrew eArmor3;

agrp1 = group eArmor1;
eArmor2 joinAsSilent [agrp1, 2];
eArmor3 joinAsSilent [agrp1, 3];*/

eArmor1 = [getmarkerPos "Armor_Spawn", 0, "I_MBT_03_cannon_F" resistance] call bis_fnc_spawnVehicle;

sleep 2;

//Enemy Infantry spawn
infgrp1 = creategroup resistance;
infgrp2 = creategroup resistance;

Inf1 = "I_Soldier_SL_F" createUnit [getmarkerpos "Inf_Spawn", infgrp1, "", 0.6, "Captain"];
inf2 = "I_soldier_F" createUnit [getmarkerpos "Inf_Spawn", infgrp1, "", 0.4, "Sergeant"];
inf3 = "I_soldier_F" createUnit [getmarkerpos "Inf_Spawn", infgrp1, "", 0.4, "Sergeant"];
inf4 = "I_soldier_F" createUnit [getmarkerpos "Inf_Spawn", infgrp1, "", 0.4, "Sergeant"];
inf5 = "I_Soldier_AR_F" createUnit [getmarkerpos "Inf_Spawn", infgrp1, "", 0.3, "Sergeant"];
inf6 = "I_Soldier_AR_F" createUnit [getmarkerpos "Inf_Spawn", infgrp1, "", 0.3, "Sergeant"];
inf7 = "I_soldier_F" createUnit [getmarkerpos "Inf_Spawn", infgrp1, "", 0.4, "Sergeant"];
inf8 = "I_soldier_F" createUnit [getmarkerpos "Inf_Spawn", infgrp1, "", 0.4, "Sergeant"];
inf9 = "I_soldier_F" createUnit [getmarkerpos "Inf_Spawn", infgrp1, "", 0.4, "Sergeant"];

Infa1 = "I_Soldier_SL_F" createUnit [getmarkerpos "Inf_Spawn", infgrp2, "", 0.6, "Captain"];
infa2 = "I_soldier_F" createUnit [getmarkerpos "Inf_Spawn", infgrp2, "", 0.4, "Sergeant"];
infa3 = "I_soldier_F" createUnit [getmarkerpos "Inf_Spawn", infgrp2, "", 0.4, "Sergeant"];
infa4 = "I_soldier_F" createUnit [getmarkerpos "Inf_Spawn", infgrp2, "", 0.4, "Sergeant"];
infa5 = "I_Soldier_AR_F" createUnit [getmarkerpos "Inf_Spawn", infgrp2, "", 0.3, "Sergeant"];
infa6 = "I_Soldier_AR_F" createUnit [getmarkerpos "Inf_Spawn", infgrp2, "", 0.3, "Sergeant"];
infa7 = "I_soldier_F" createUnit [getmarkerpos "Inf_Spawn", infgrp2, "", 0.4, "Sergeant"];
infa8 = "I_soldier_F" createUnit [getmarkerpos "Inf_Spawn", infgrp2, "", 0.4, "Sergeant"];
infa9 = "I_soldier_F" createUnit [getmarkerpos "Inf_Spawn", infgrp2, "", 0.4, "Sergeant"];

execVM "Enemy_Attack.sqf"

Also when I try to move my created tank group ( the one that is quoted ) only the leader moves while the rest of them wait?

Edited by Denco

Share this post


Link to post
Share on other sites

Well to start, if you truly tried this:

eArmor1 = [getmarkerPos "Armor_Spawn", 0, "I_MBT_03_cannon_F" resistance] call bis_fnc_spawnVehicle;

You need to do it correctly, by using this:

eArmor1 = [getmarkerPos "Armor_Spawn", 0, "I_MBT_03_cannon_F", GUER] call bis_fnc_spawnVehicle;

That may be why your game is crashing. Though it should not be crashing. Usually any errors in the description.ext will result in crashing, so if you've made some recent changes there, check those.

My friend, please see the function BIS_fnc_spawnGroup. Saves you some hassle :P

Ex:

_boat1group = [_boat1crewmkr, WEST, ["B_Soldier_SL_F", "B_Soldier_F", "B_Soldier_F", "B_Soldier_F"]] call BIS_fnc_spawnGroup;

Share this post


Link to post
Share on other sites

I don't know whats up with crashing but I do see why the game crashed when I tried spawning the enemy tank using the fnc_spawnvehicle function. I never had the crashing problem before and I somehow suspect it has something to do with this script even though at glance there is nothing in it that would be the cause.

The function for spawning groups will save me some hassle that's for sure but honestly I haven't really checked all the functions available. Something that I now deeply regret :)

You've been of much help Grimes, thanks.

Share this post


Link to post
Share on other sites

Happy to help. I highly, highly suggest just scanning through the names of the functions real quick, and read the top descriptions of ones that catch your eye. That's one of many things BIS got right in A3.

Share this post


Link to post
Share on other sites
eArmor1 = [getmarkerPos "Armor_Spawn", 0, "I_MBT_03_cannon_F"[color="#FF0000"],[/color] resistance] call bis_fnc_spawnVehicle;

You don't have a comma there, could possible be why

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  

×