Home   Help Search Login Register  

Author Topic: Broadcasting MP effects  (Read 1465 times)

0 Members and 1 Guest are viewing this topic.

Offline DMarkwick

  • Contributing Member
  • **
  • I'm a llama!
Broadcasting MP effects
« on: 06 Sep 2009, 02:35:39 »
Currently to broadcast some custom effects when a vehicle is destroyed I use this method:
Code: [Select]
_MPInit=Format ["[This,%1,%2,%3,%4,%5] ExecVM ""JTD_FireAndSmoke\Scripts\SmokeMain.sqf""",_SmokeStyle,_PrimaryLifetime,_SecondaryLifetime,_thisTime,_VehicleScale];
_Vehicle SetVehicleInit _MPInit;
ProcessInitCommands;
With "_vehicle" being the vehicle destroyed.

When destroying nearby trees, I use the same method but use a custom object and set the init on that:
Code: [Select]
_thisTreeMarker = "firemarkerinv" createVehicle _FirePos;
_MPInit=Format ["[_x,%1,%2,%3,%4] ExecVM ""JTD_FireAndSmoke\Scripts\ForestFireTree.sqf""",_SmokeStyle,_PrimaryLifetime,_SecondaryLifetime,_thisTime];
_thisTreeMarker SetVehicleInit _MPInit;
ProcessInitCommands;
where, as you can see, "_thisTreeMarker" is the "vehicle" having the init set this time.I need to use a custom object because I cannot set an init on a map object like a tree.

All the above works fine in SP, and I see all effects.

In MP, it's reported to me that the vehicle effects are seen by all clients, but that the tree effects are only seen by the client on which the code is executed.

Can anyone see why this would be from the examples provided? I'm tempted to think that maybe the vehicles aren't being created on any other machine. They're just small invisible cubes. Does createVehicle really create vehicles on ALL machines when used?


*****************************************************

Guys, will I be better served to use publicVariable to achieve this?
« Last Edit: 08 Sep 2009, 02:16:21 by DMarkwick »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Broadcasting MP effects
« Reply #1 on: 13 Sep 2009, 14:16:07 »
I would go for the processinitcommands method. Just consider that with something like a bomb near where many vehicles are parked, you would need to publish many variables or one many times. I think setVehicleinit might ensure better that nothing is lost there.

EDIT:
About the marked problem, your have there a suspicious _x, not sure how the script is designed, but probable This should be there instead of _x.
« Last Edit: 13 Sep 2009, 14:18:41 by Mandoble »

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: Broadcasting MP effects
« Reply #2 on: 13 Sep 2009, 16:17:12 »
Exchange ""..."" with '...'. (doubles quotes inside quotes).
It will make reading code easier and your life more enjoyable.  :D