Jump to content
Sign in to follow this  
mikie boy

Ranked Ammo crate and multiplayer issues

Recommended Posts

Hello all, i have been unable to finalise the below script, which is for the ammobox placed in game.

I have a ranking system and i wanted the ammo box to only show locally the guns for which rank that player currently is. However it would appear that when one player gets promoted the other players can see the same list of weapons. Ive tried !isdedicated no joy - in fact ive tried a load of things that i cant remember - but no joy. Ive also tried addweaponscargo instead of global, but you cant take the guns.

thus, my question is..how do i get the weapons to show up for each player to match their rank only. Any help would be really appreciated guys.

the below is called within the box init line - _null = [this,this] execVM "weaponsfiller.sqf"; ive tried it without _null and calling it _ammobox - again no joy. Think my knowledge of locality is seriously lacking...

_unit = _this select 0;
_ammostuff = _this select 1;
_playrank = rank player;	

_privweapons =
[
"FN_FAL", "LeeEnfield", "M4A1", "m136", "M9"
];

_corpweapons = 
[
"M16A2GL", "G36C_camo", "G36A_camo", "G36K_camo","M14_EP1","BAF_L85A2_RIS_Holo", "M60A4_EP1", "STINGER", "M9SD", "revolver_EP1"
];

_sergweapons = 
[
];	

  while {alive _ammostuff} do 
{    

if (_playrank == "PRIVATE") then 
{
clearMagazineCargoglobal _ammostuff;
clearWeaponCargoglobal _ammostuff;
{ _ammostuff addWeaponCargoglobal [_x,10]; } foreach _privweapons;	
 };

if (_playrank == "CORPORAL") then
{
clearMagazineCargoglobal _ammostuff;
clearWeaponCargoglobal _ammostuff;
{ _ammostuff addWeaponCargoglobal [_x,10]; } foreach _privweapons;
{ _ammostuff addWeaponCargoglobal [_x,10]; } foreach _corpweapons;
};
sleep 20; 
};  // linked to While do 


again

cheers for any help

[FOCK] Mikie J

http://fockers.moonfruit.com/#

Share this post


Link to post
Share on other sites

If someone could help Mikie with this I would appreciate it as well lol.

We have been trying different things for a week now with moderate success.

He is making quite an entertaining multiplayer mission that will be very good when complete.

Goal: 1 full ammo box but access depends on rank.

Higher rank = more weapons.

At present if more than 1 person selects gear, - the gear from the highest rank is shown to all. You can see the list of weapons reload and more appear while you are looking at it.

-Is there something wrong with the script? (The above is abbreviated BTW)

-Or is it a locallity issue? We need it to run seperately on each client machine.

-Or is that just how the ammo box is coded?

Share this post


Link to post
Share on other sites

You're correct in that it's a locality issue. You cannot have one global ammo box show different gear for different players, meaning you need to have it be local for each player. Here is how I set up local ammo boxes, which may or may not be the best way of doing it:

First, place a trigger with local player for the condition and nul= [] execVM "jip.sqf" for the activation.

in jip.sqf put:

_cr01 = "USSpecialWeaponsBox" createvehiclelocal (getMarkerPos "am01");
_cr01 allowdamage false;
nul=[_cr01] execVM "ammo.sqf";

Make a marker named am01 where you want the crate to be created, and ammo.sqf is your ammo crate script. I use this method for class loadouts so it should work for you as well.

Share this post


Link to post
Share on other sites

Yes, for different contents for each player, creating the crate locally with createVehicleLocal is probably the best solution. Though keep in mind if he places any weapons in the crate nobody else will be able to pick them up. Also, you can break the ranking system by gaining a rank and giving the weapons to your friends who don't have the required rank, so you would still need some sort of script to prevent that.

Share this post


Link to post
Share on other sites

Chaps, thanks so much -

knew it was a locality issue but getting there just wasnt gona happen. Huge thanks to you both.

Just for your info - tried it without trigger created in game - placed

execVM "Rank\jip.sqf"

straight into init file. worked no problem. Oh, and for anyone reading this - the ammo box needs to be changed for OP Arrow.

As for the ranking structure with the guns i have already made that. Once this is all complete ill be chucking it out in the forums.

Again thanks for the assistance

[FOCK] Mikie J

http://fockers.moonfruit.com/#

Share this post


Link to post
Share on other sites

No, stay away from those commands. Buggy and nothing but trouble, and you can't handle them for JIP. Typically you'll end up with weapons in crate whose number indicate they are there, but you can't grab. Kinda like the cargo count is updated, but not the numbers showing the count. Not really sure what's going on, but global versions and local to player is about the only thing that seems we can get control over.

Share this post


Link to post
Share on other sites

cheers chaps,

blakeace - unfortunately the addweaponcargo needs to be synchronised across the network in order for you to take the weapons. galzohar and the above are correct with the createvehicle local.

i have spent a good solid week, with the help of PELHAM, trying to work it out, and we both concluded that it was a locality issue. addweaponcargo doesnt allow you to take to weapons but does displays them in the box.

So for anyone else reading this....

Createvehiclelocal - for a ranked ammo box is the simplest way.

cheers though for all the advice

[FOCK] Mikie J

http://fockers.moonfruit.com/#

Share this post


Link to post
Share on other sites

Cheers for the info, just thought it might work through having had results of players having different contents and able to grab them through an error in a script once where i was creating random contents in ammoboxes but trying to syncing them in mp. The global version would have been real handy back then. :P

Thanks

Blake

Share this post


Link to post
Share on other sites

you could also look at data/scripts/eventsC.sqf in evolution, which is called from pinit.sqf which is called by a trigger recognising JIP. this has worked since arma1, though it is a bit belt and braces...

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  

×