Jump to content
Sign in to follow this  
tophe

Having some serious locality problems.

Recommended Posts

I made a chopper where the player is setcaptive when entering, and then a script is run that puts his weapons in a box and then all his weapons are removed.

This works like a charm in the editor. But in multiplayer it is messed up.

I tried it with a few friends, I was serving and playing on the same computer.

For me it works just fine. When I get to the box my weapons are inside.

But the other players can't see my weapons in the box, I can't see their weapons either.

Also they somtimes see their own weapons in the box but they can't pick them up.

After almost 10 minutes one of my friends could pick up his weapons in the box.

Here is what I have done.

TRIGGER

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

Repeatedly

Type: switch

Condition: vehicle player == chopper

On activation: player setcaptive true; [player,box] exec "script.sqs"

On deactivation: player setcaptive false

SCRIPT.SQS

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_player = _this select 0

_box = _this select 1

{_box addWeaponCargo [_x,1]} forEach weapons _player

{_box addMagazineCargo [_x,1]} forEach magazines _player

removeAllWeapons _player

I have the server game logic on the map.

How can I make the weapons appear for real in the box on all clients?

Thank you guys for all help so far.

Regards.

Share this post


Link to post
Share on other sites

Nudging a little on this one.

I really need to solve this.

Share this post


Link to post
Share on other sites

This is the only solution:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{player action ["DROPWEAPON",box,_X]} foreach (weapons player);

sleep 1;

{player action ["DROPMAGAZINE",box,_X]} foreach (magazines player);

Not only does it work in MP, but it also transfers the same weapons and magazines in his inventory to the ammo box instead of creating new copies of his weapons, so if he has a magazine with only 1 round in it you won't get a full one again from the box. Also, if things haven't changed since OFP, these actions work regardless of proximity to the box (unlike doing it from the action menu).

Share this post


Link to post
Share on other sites

I get this weird problem when trying your sollution...

First it didn't work at all, all the weapons were still on the unit. But then I renamed the box, then the weapons is removed but not put anywhere (since the name of the box didn't match the name in the script.)

So if the box that the weapons and maganzines are to be put in exist, then the action will not execute. But if they don't exist the weapons will just disappear.

{player action ["DROPWEAPON",box,_X]} foreach (weapons player);

Any suggestions?

Share this post


Link to post
Share on other sites

I solved it.. The hard way I'm afraid.

I kept my original script by I put a trigger for every playing unit that runs the script when the "unit" is in the chopper instead of doing it when "player" is. This makes the script run on every computer.

A bit ugly.. I don't like cramping tons of triggers in the mission.

But it did the trick. Thank you for your help.

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  

×