OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: laggy on 26 Mar 2009, 18:13:05

Title: Is it possible to change locality of an empty (non playable) object ?
Post by: laggy on 26 Mar 2009, 18:13:05
Hi,

In a mission I want the players to be able to pull an object around.
If they are close to the object this happens:

pull = player addaction ["Pull Ammo Box", "pulling.sqs"]

In the action script the object is then setpos'd on a tight loop to follow the "pulling" unit.

However, on a dedicated server (probably also for non server clients in hosted game) it works poorly, simply because the object is local to the server (I guess). The lag is ugly and confusing. It also makes the pulling process very stuttering.

Can you change locality of a static object (in this case an ammo crate) to a player instead ?
Wouldn't that solve my problem ?

Or should I add a publicVariable and run the setpos script on the server?

Cheers
Title: Re: Is it possible to change locality of an empty (non playable) object ?
Post by: Spooner on 26 Mar 2009, 21:31:12
Moving it on the server would help a tiny bit, but will still look bad. This has been a problem for ages (but there is a command to do this perfectly in VBS2) and even ACE uses a proxy vehicle to make this sort of syncing work while dragging bodies (both player and body get put inside an invisible vehicle which the player is "driving").
Title: Re: Is it possible to change locality of an empty (non playable) object ?
Post by: laggy on 26 Mar 2009, 22:15:53
Thanks Spooner.

EDIT: What does it mean that vehicle is not transferred in MP game with createVehicleLocal?
Do other players not see it ?
  ???

I think I solved it though, for my purposes at least. Thank god for createVehicleLocal  :D


I setpos the "real" ammo box 10 meters under ground.

Then createVehicleLocal a new "dummybox" (with clearWeaponCargo and clearMagazineCargo) at the real ones saved position.

When the "dummybox" is released the "real" one is setpos'd at the dummy's position and the dummy is deleted.

Works, looks good and keeps the weapon and magazine cargo realistic  :good:


Laggy
Title: Re: Is it possible to change locality of an empty (non playable) object ?
Post by: Rommel92 on 29 Mar 2009, 06:12:58
CreateVehicleLocal creates a vehicle local to the client on which the code is run. So only the local player would see him 'pulling' the ammo crate / vehicle.
Title: Re: Is it possible to change locality of an empty (non playable) object ?
Post by: laggy on 29 Mar 2009, 10:31:39
Hmmm...

Does that mean that the "pulling" effect will only LOOK good on the players computer that created the object ?

OR will it look good on other players screens as well, simply because the setpos objects loop is (due to createVehicleLocal) synced with the player where the object is local ?

Cheers

EDIT: Tried the script on a dedi where a (to the player non-local) AI unit "pulled" the box and it looked good.