Jump to content
Sign in to follow this  
Stubbinz

Locality issue?

Recommended Posts

Okay, so i have a gun rack with a bunch of actions allocated to it.

What these actions do is essentially subtracts the _callers variable of "money" and places a gun in the rack for you to take. So far it works 100% fine, until i have multiplayer going on.

Me as the host can still "buy" guns and equip them, however my buddy can not. He can see the actions and select them, and it even subtracts his money. One really weird aspect though, is the fact that it will place the gun in the rack, but only he sees it as I (host comp) can not. He will then try to pick it up and it never switches over to him, just stays in the rack visible to him, invisible to me.

Any idea what could be the issue? its giving me a headache.

Example buy script.

_target = _this select 0;
_caller = _this select 1;
_id = _this select 2;

_money = _caller getvariable ["money",0];


if(_money >= 200) THEN {_target addWeaponCargo ["LeeEnfield",1];_target addMagazineCargo ["10x_303",1];_money=_money-200;} ELSE {Hint "not Enough Cash."};
~0.125
_caller setvariable ["money",_money];

exit;

Share this post


Link to post
Share on other sites

Adding weapon and magazines to object is just a complete mess. The commands are local which means the weapon is only added on one side. However, if the server for example, doesn't know the weapon lies there it won't allow you to take it. The only reason many weapon and magazine scripts work is because they typically empties everything and adds it again on all machines.

However, recently I saw that these commands have been added to the BIKI:

addWeaponCargoGlobal

addMagazineCargoGlobal

They might be the solution to these issues.

Share this post


Link to post
Share on other sites

Don't forget clearMagazineCargoGlobal and clearWeaponCargoGlobal.

Muzzleflash is correct, the local variants will cause nothing but headaches in multiplayer. There are some issues with the global variants too, but I haven't been able to put my finger on what exactly is happening. But they are good enough to rely on in most circumstances. The local ones, you can only rely on them to fail :p

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  

×