Jump to content
Sign in to follow this  
opendome

Weird Vehicle Init Issue

Recommended Posts

Did they change the "this addweaponcargo ["name", amount];" system? I'm trying to add task force 47's maaws but it just doesn't want to work. It also won't let me clear the inventory of any vehicles either.

Thanks!

Share this post


Link to post
Share on other sites

how do people add items to their vehicles through their inits?

Share this post


Link to post
Share on other sites

Thanks bud! So in the vehicles init I should put (without quaotations) "addWeaponCargoGlobal [t47_maaws, 1]"? and then use ; to separate multiples like usual right?

Thanks again!

Share this post


Link to post
Share on other sites

Weapon class name needs to be in quotes..

this addWeaponCargoGlobal ["t47_maaws", 1]

Share this post


Link to post
Share on other sites

Wrap it in a server check while you're at it.

if (isServer) then

{

this addWeaponCargoGlobal ["tf47_maaws",1];

};

Otherwise every jip player will add a maaws to the vehicle.

Share this post


Link to post
Share on other sites

thanks for the help guys! Unfortunately I haven't had any luck yet, also I have the correct spelling for the maaws, I just tossed what I thought it was quickly to see the format. I tried putting them each into the vehicle initialization field in the editor. I used to do this all the time in arma 2 and it was so easy lol

Share this post


Link to post
Share on other sites

add this to the init

if (isServer)
then
{
clearMagazineCargoGlobal this; 
clearWeaponCargoGlobal this; 
clearItemCargoGlobal this; 
clearBackpackCargoGlobal this;

this addWeaponCargoGlobal ["tf47_m3maaws", 1];
};

Share this post


Link to post
Share on other sites

Thanks for the help! Unfortunately that doesn't seem to work either :(

Share this post


Link to post
Share on other sites

So to be clear Im referring to the code used to add weapons to the inventory of a vehicle through its initialization field in the empty unit, in the editor. (just in case there s any confusion). Right now my exact code is

if (isServer)

then

{

clearMagazineCargoGlobal this;

clearWeaponCargoGlobal this;

clearItemCargoGlobal this;

clearBackpackCargoGlobal this;

this addWeaponCargoGlobal ["tf47_m3maaws", 1];

};

Share this post


Link to post
Share on other sites

I just tried it with the vanilla mx and it didnt work either :(

Share this post


Link to post
Share on other sites

Are you using some kind of respawn script or module on the vehicle?

Share this post


Link to post
Share on other sites

if (isServer)

then

{

clearMagazineCargoGlobal _this;

clearWeaponCargoGlobal _this;

clearItemCargoGlobal _this;

clearBackpackCargoGlobal _this;

_this addWeaponCargoGlobal ["tf47_m3maaws", 1];

};

Share this post


Link to post
Share on other sites
if (isServer)

then

{

clearMagazineCargoGlobal _this;

clearWeaponCargoGlobal _this;

clearItemCargoGlobal _this;

clearBackpackCargoGlobal _this;

_this addWeaponCargoGlobal ["tf47_m3maaws", 1];

};

that doesn't work either unfortunately :( I just don't get it, and apparently the class name is correct so I dunno. The only re spawn for vehicles i have is the vanilla arma vehicle re-spawn module synced to the vehicles.

Share this post


Link to post
Share on other sites

Well there lies your problem. The module is probably respawning the vehicle at the start of the mission... "Forced Respawn". Put this under the "expression" field in the modules window. This will run every time the vehicle respawns.

if (isServer) then {
(_this select 0) spawn {	
	clearMagazineCargoGlobal _this;
	clearWeaponCargoGlobal _this;
	clearItemCargoGlobal _this;
	clearBackpackCargoGlobal _this;

	_this addWeaponCargoGlobal ["tf47_m3maaws", 1];
};
};

Confirmed to work with forced respawn.

Edited by Fight9

Share this post


Link to post
Share on other sites

weird its not working either :( I tired putting both "Forced Respawn" and Forced Respawn in the expression field (but I also had forced respawn enabled in the drop down option if that matters?) My description looks like class header {

gametype = COOP;

minplayers = 1;

maxplayers = 19;

};

Onloadmission = "Operation FOXHOUND";

OnLoadMissionTime = True;

respawn = "BASE";

respawndelay = 30;

disabledAI=true;

#include "ASORGS\menu.hpp"

class CfgFunctions

{

#include "ASORGS\cfgfunctions.hpp"

};

#include "ATM_airdrop\dialog.hpp"

class CfgSounds

{

sounds[] = {Vent,Vent2,Para};

class Vent {name="Vent";sound[]={ATM_airdrop\data\Vent.ogg,db-11,1.0};titles[] = {};};

class Vent2 {name="Vent2";sound[]={ATM_airdrop\data\Vent2.ogg,db-11,1.0};titles[] = {};};

class Para {name="Para";sound[]={ATM_airdrop\data\parachute.ogg,db-11,1.0};titles[] = {};};

};

but I just cant figure out why this is working

Share this post


Link to post
Share on other sites

Um, put the code I posted in the expression field, not the words "forced respawn"... thats just the option I was talking about that was causing your issue. youre silly dude lol

To clarify,

FORCED RESPAWN: ENABLED

EXPRESSION:

if (isServer) then {
   (_this select 0) spawn {    
       clearMagazineCargoGlobal _this;
       clearWeaponCargoGlobal _this;
       clearItemCargoGlobal _this;
       clearBackpackCargoGlobal _this;

       _this addWeaponCargoGlobal ["tf47_m3maaws", 1];
   };
};  

Now, when the mission starts, the vehicle will automatically respawn, running the code above from the expression field. You can leave the vehicle INIT blank, because it wont apply.

Edited by Fight9

Share this post


Link to post
Share on other sites

Oh whoops lol. I just tried it and it didnt work either :(

Share this post


Link to post
Share on other sites

the init code should work, there's something else in your mission conflicting with it. upload your mission for us

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  

×