Jump to content
Sign in to follow this  
Taxen0

addmagazine backpack

Recommended Posts

I have a coop mission and i try to add some magazines to all the players backpacks at start with the following in their respective inits.

(unitBackpack this) addmagazine ["30Rnd_65x39_caseless_mag",6];

but it does not work well with multiplayer. only me (server) gets the magazines, and I can see the magazines in my friends backpacks, but they can't.

so it's obviously some locality issue, but how should I fix it?

Share this post


Link to post
Share on other sites

As far as i know you have to use playableUnits to add the magazine to all playable units. Sry i'm not a pro in scripting, you have to wait for more experienced users for a ready-to-go script^^

Maybe:

if (side playableUnits == WEST) then { 
your code 
} forEach playableUnits;

Again, it's just a suggestion.

Edited by Valixx

Share this post


Link to post
Share on other sites

When do you add backpacks to your players? Only a few units start with backpacks by default, so just add the magazines when you add the backpacks.

Share this post


Link to post
Share on other sites

drop (unitbackpack this) this only works for you.

just use on other players in MP:

this addMagazines ["30Rnd_65x39_caseless_mag",6];

Took me FOREVER to catch this in my Map setup.

Share this post


Link to post
Share on other sites

They are basically ammoboxes, use addMagazineCargo

Share this post


Link to post
Share on other sites

Use backpack unit for the classname and unitBackpack unit for the object.

uN0D266.jpg

Share this post


Link to post
Share on other sites

revisiting this in case someone else needs it in the future.

the new command "addMagazineCargoGlobal" works!

so in this case

(unitBackpack this) addMagazineCargoGlobal ["30Rnd_65x39_caseless_mag",6];

Share this post


Link to post
Share on other sites

That's what I wrote above :rolleyes:

Share this post


Link to post
Share on other sites

If your fellow member have a backpack on start, just get

player addMagazines ["30Rnd_65x39_caseless_mag",6];  

into the init.sqf and you should be fine. If they don't have a backpack, you should add one with

player addbackpack "backpackclassname";

for example "B_AssaultPack_khk". So it would be:

player addbackpack "backpackclassname";
player addMagazines ["30Rnd_65x39_caseless_mag",6];

in the init.sqf

If you don't want to have to do a init, you should be able to use these 2 commands in the init of the units, just replace "player" with "this".

Share this post


Link to post
Share on other sites

your way worked, but it only worked for the server for some reason. The players had empty backpacks, but if the server had a look the magazines were there.

the addition of Global made it MP-syncronized.

Share this post


Link to post
Share on other sites
The players had empty backpacks, but if the server had a look the magazines were there.

Do you mean the unit had magazines in his backpack, but the unit itself couldn't see it? So only you (the server), could see them?

Share this post


Link to post
Share on other sites

Yeah if you run it only on the server, only the server will see it indeed.

If it ran from the init line of the unit, you would not need Global

Share this post


Link to post
Share on other sites
Do you mean the unit had magazines in his backpack, but the unit itself couldn't see it? So only you (the server), could see them?

Yes, exactly like that.

Yeah if you run it only on the server, only the server will see it indeed.

If it ran from the init line of the unit, you would not need Global

But I did have it in the unit init-field =/

this is my init:

this addvest "V_RebreatherB";
this addbackpack "B_Carryall_ocamo";
(unitBackpack this) addMagazineCargoGlobal ["100Rnd_65x39_caseless_mag",3];
(unitBackpack this) addWeaponCargoGlobal ["FirstAidKit",2];
(unitBackpack this) addMagazineCargoGlobal ["HandGrenade",2];

and without global only "me" (server) can see is as content.

Share this post


Link to post
Share on other sites

Weird. Normal addMagazineCargo; The arguments do not have to be local to the unit and the effects are only local on where it was executed. Which would mean that every player that connects will add more stuff to the backpack.

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  

×