Jump to content
Sign in to follow this  
callihn

Multiplayer howto?

Recommended Posts

I have researched this until I am going blind and crazy but I just do not understand, I have gone over scripts from several sources, read the biki, searched the forums and I just do not get it.

Could someone show me how to exec a script on each client please without MPF?

For example only:

private ["_car","_LB1","_LB3","_LB4","_LB5","_LB8","_LB6"]
_car = _this
#start
_car setobjecttexture [1,"\images\light.paa"]
_LB1 = "#lightpoint" createVehicleLocal getpos _car
_LB1 lightAttachObject [ _car,[ 0.54, -0.27, 1.60 ] ]
_LB1 setLightBrightness 0.4
_LB1 setLightAmbient[ 0, 0, 0.3]
_LB1 setLightColor[ 0, 0, 0.01 ]

Which is called with _this exec only runs on the client that started it, I tried changing createVehicleLocal to createVehicle and it did nothing! But I thought createVehicle was global?

I used the MPF but it was waaay too laggy and caused too much desync.

Another example:

private ["_car"]
_car = _this
#start
_car say "siren"

Only works on the client that called it, though I thought say was a global command?

Yet I look at other cars that seem to use the same command say and work in MP. This has become very frustrating and honestly I've never worked with an engine like this where commands do not work in MP.

Edited by callihn

Share this post


Link to post
Share on other sites

If it's just one time deal, then you could just add a trigger with some var as condition and onact the script execution. Then when you need it run, do:

yourVar = true; publicvariable "yourVar"

If you need to do the same thing multiple times, use addpublicvariableeventhandler.

Share this post


Link to post
Share on other sites
If it's just one time deal, then you could just add a trigger with some var as condition and onact the script execution. Then when you need it run, do:

yourVar = true; publicvariable "yourVar"

If you need to do the same thing multiple times, use addpublicvariableeventhandler.

Thanks, that seems too easy.

So basicly if the script loops using:

 
?(_car animationPhase "sirenon" > 0) : goto "start"

Then I could simply use:

 
sirenon = 1; publicvariable "sirenon"

And that will cause everyone that sees the car to see the lights on, is that correct?

What if there is more than one _car though, wouldn't that make the lights come on for every car on the map?

What about JIP?

I tried using

 
[nil,_car,"per",rsetobjecttexture,_car,1,"\images\light.paa"] call RE

That worked but seemed to cause some serious desync with just a few cars running. Could one rewrite it in .sqf and use rexecVM to call the script and get better results with the MPF?

Thanks

Edited by callihn

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  

×