OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: DMarkwick on 06 Sep 2009, 02:35:39

Title: Broadcasting MP effects
Post by: DMarkwick 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?
Title: Re: Broadcasting MP effects
Post by: Mandoble 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.
Title: Re: Broadcasting MP effects
Post by: kju 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