Jump to content
Sign in to follow this  
RonnieJ

Multiplayer crate not working

Recommended Posts

Hey... can anyone tell me why the following code aint working? It makes the crate but the content inside is the normal that comes with the crate... not empty'd and not with the new content inside?! :confused:

if (!isServer) exitWith {};

_crate = "RUBasicAmmunitionBox" createVehicle (getMarkerPos "friendly");

// Remove the stock items from the crate
clearMagazineCargo _crate;
clearWeaponCargo _crate;

// Add the items to the crate
_crate addMagazineCargo ["FlareGreen_M203", 25];
_crate addMagazineCargo ["FlareRed_M203", 25];
_crate addMagazineCargo ["FlareWhite_M203", 25];
_crate addMagazineCargo ["FlareYellow_M203", 25];

Share this post


Link to post
Share on other sites

something like this. Might need tweaking

if (!isServer) exitWith {}; 

_crate = "RUBasicAmmunitionBox" createVehicle (getMarkerPos "friendly"); 
_crate setvehicleinit "clearMagazineCargo this; clearWeaponCargo this; this addMagazineCargo ["FlareGreen_M203", 25]; this addMagazineCargo ["FlareRed_M203", 25]; 
this addMagazineCargo ["FlareWhite_M203", 25]; this addMagazineCargo ["FlareYellow_M203", 25];";
processInitCommands;
sleep 1;
clearVehicleInit _crate;

Share this post


Link to post
Share on other sites

Ghost you are the man! :) works like a charm... could you possibly tell why it does hehe? :) trying to understand the damn thing :P

Share this post


Link to post
Share on other sites

I just followed the examples from the wiki. Basically when you used

_crate = "RUBasicAmmunitionBox" createVehicle ....

_crate refers to the model and all kinds of stuff. if you want to know what im talking about put a hint in the script after the createvehicle command as follows

hint format ["%1", _crate];

so since _crate is not technically the name of the object but what the object is you have to use the setvehicleinit command then process those commands via processinitcommands.

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  

×