Home   Help Search Login Register  

Author Topic: Is it possible to change locality of an empty (non playable) object ?  (Read 2056 times)

0 Members and 1 Guest are viewing this topic.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
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
« Last Edit: 26 Mar 2009, 18:15:49 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
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").
« Last Edit: 27 Mar 2009, 05:34:09 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
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
« Last Edit: 27 Mar 2009, 00:11:54 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Rommel92

  • Members
  • *
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.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
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.
« Last Edit: 29 Mar 2009, 11:10:09 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.