Jump to content
Sign in to follow this  
frosties

Respawn/Loadout issue...

Recommended Posts

Im trying to get a vehicle loadoutscript working with the "Simple Vehicle Respawn"-script.

Im following the information to the best of my knowledge but cant get the vehicle to load the script..

Vehicle INIT:

hey = [this] execVM "loadout_veh.sqf"; veh = [this, 30, 900, 0, TRUE, FALSE, "hey = [this] execVM ""loadout_veh.sqf"""] execVM "vehicle.sqf"

loadout_veh.sqf:

_Soldier = _This select 0;
_role = _This select 1;

clearWeaponCargo this;    
clearMagazineCargo this;

switch (_role) do {
case "helo1" : {
this addWeaponCargo  ["ACE_Earplugs",10];            
this addWeaponCargo  ["ACE_M136_CSRS",6];                   
this addWeaponCargo  ["Binocular",2];                                             
this addWeaponCargo  ["Stinger",1];     
this addMagazineCargo  ["Stinger",2];                
this addMagazineCargo  ["SmokeShellGreen",5]
	};
case helo2" : {
this addWeaponCargo  ["ACE_Earplugs",10];            
this addWeaponCargo  ["ACE_M136_CSRS",6];                   
this addWeaponCargo  ["Binocular",2];                                             
this addWeaponCargo  ["Stinger",1];     
this addMagazineCargo  ["Stinger",2];                
this addMagazineCargo  ["SmokeShellGreen",5]
};
};

The only thing that happens is that the default loadout is being put in the chopper..

Share this post


Link to post
Share on other sites

That script takes two arguments, soldier and role. You're only passing it one argument, this, which is the vehicle object. So role never exists and you never assign any cargo.

Share this post


Link to post
Share on other sites

:oh:

Change:

hey = [this] execVM "loadout_veh.sqf";

To:

hey = [this, "helo1"] execVM "loadout_veh.sqf";

or

hey = [this, "helo2"] execVM "loadout_veh.sqf";

You'll also want to fix the missing " in the script, near helo2" assuming that was cut/pasted.

Share this post


Link to post
Share on other sites

i changed it as per your suggestion to:

hey = [this, "helo1"] execVM "loadout_veh.sqf"; veh = [this, 15, 900, 0, TRUE, FALSE, "hey = [this, ""helo1""] execVM ""loadout_veh.sqf"""] execVM "vehicle.sqf"

The editor doesnt complain about anything, so i thought it was all good..

but no dice... the helo still doesnt get the custom loadout thats in the file..

Do i need to change something in the loadout_veh.sqf?

(fixed the " problem)

Share this post


Link to post
Share on other sites

Bah, I didn't look closely at that script at all, did I? Noticed there was a missing " but not that all your commands pointed to this instead of _soldier. :) Change all references of this to _soldier and it should work. (Don't change the two _this at the top though.)

Share this post


Link to post
Share on other sites

No dice...

isnt this suppose to be working with vehicles and soldier with soldiers?

I have the same script (kind of), for units, and then its working..

_Soldier = _This select 0;
_role = _This select 1;

removeAllWeapons _soldier;

switch (_role) do {
case "s1" : {
	_soldier addMagazine 	"ACE_20Rnd_762x51_T_HK417";
	_soldier addMagazine 	"ACE_20Rnd_762x51_T_HK417";
	_soldier addMagazine 	"ACE_20Rnd_762x51_T_HK417";
	_soldier addMagazine 	"ACE_20Rnd_762x51_T_HK417";
	_soldier addMagazine 	"ACE_20Rnd_762x51_T_HK417";
	_soldier addMagazine 	"ACE_20Rnd_762x51_T_HK417";
	_soldier addWeapon 		"ACE_HK417_Eotech_4x";
	_soldier selectWeapon 	"ACE_HK417_Eotech_4x";
	_soldier addMagazine 	"ACE_12Rnd_45ACP_USPSD";
	_soldier addMagazine 	"ACE_12Rnd_45ACP_USPSD";
	_soldier addMagazine 	"ACE_12Rnd_45ACP_USPSD";
	_soldier addMagazine 	"ACE_12Rnd_45ACP_USPSD";
	_soldier addWeapon 		"ACE_USPSD";
	_soldier addMagazine 	"SmokeShellOrange";
	_soldier addMagazine 	"SmokeShellOrange";
	_soldier addWeapon 		"ACE_Earplugs";
	_soldier addWeapon 		"ACE_Earplugs";
	};
};

Share this post


Link to post
Share on other sites

example (removed ACE items)

init field:

fncVehicleLoadout = compile preprocessfile "loadout_veh.sqf"; [this,"helo1"] call fncVehicleLoadout; veh = [this, 30, 900, 0, TRUE, FALSE, "[this,'helo1'] call fncVehicleLoadout"] execVM "vehicle.sqf"

loadout_veh.sqf:

private ["_helo","_role"];
_helo = _this select 0;
_role = _this select 1;

clearWeaponCargo _helo;
clearMagazineCargo _helo;

switch (tolower _role) do {
 case "helo1" : {
   _helo addWeaponCargo ["ACE_Earplugs",10];
   _helo addWeaponCargo ["ACE_M136_CSRS",6];
   _helo addWeaponCargo ["Binocular",2];
   _helo addWeaponCargo ["Stinger",1];
   _helo addMagazineCargo ["Stinger",2];
   _helo addMagazineCargo ["SmokeShellGreen",5]
 };
 case "helo2" : {
   _helo addWeaponCargo ["ACE_Earplugs",10];
   _helo addWeaponCargo ["ACE_M136_CSRS",6];
   _helo addWeaponCargo ["Binocular",2];
   _helo addWeaponCargo ["Stinger",1];
   _helo addMagazineCargo ["Stinger",2];
   _helo addMagazineCargo ["SmokeShellGreen",5]
 };
};

Share this post


Link to post
Share on other sites

Now its working.... :)

A related question now...

Can i use the same script on vehicles, and just keep adding them in the script? Or is this just gonna work with helos?

Share this post


Link to post
Share on other sites

Works with any type of vehicles, variable names don't matter.

Oh and, you only need the first part:

fncVehicleLoadout = compile preprocessfile "loadout_veh.sqf";

in one init field. It can be any vehicle/object/game logic as long as it's not one of the playable units.

---------- Post added at 04:20 PM ---------- Previous post was at 04:18 PM ----------

AAANNND!

When adding new cases to the script, remember to give them lower case names!

Share this post


Link to post
Share on other sites

Don´t understand what you are meaning there shk..

I only have to add:

fncVehicleLoadout = compile preprocessfile "loadout_veh.sqf";

When adding new vehicles, not the entire thing with vehicle.sqf?

Im fairly new at this, but im learning.. thanks to you guys here ;)

Share this post


Link to post
Share on other sites

Well, hit F1 and add a new unit:

Side: Game Logic

Class: Objects

Unit: Game Logic

Into it's init field paste:

fncVehicleLoadout = compile preprocessfile "loadout_veh.sqf";

Into each vehicle's init you put this:

[this,"helo1"] call fncVehicleLoadout; veh = [this, 30, 900, 0, TRUE, FALSE, "[this,'helo1'] call fncVehicleLoadout"] execVM "vehicle.sqf"

With the correct loadout name obviously.

Share this post


Link to post
Share on other sites

ah! okey!

will do that.

Thanks a bunch for your help guys!

Gonna mention you all in my thank you note in my mission ... :)

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  

×