Jump to content
Sign in to follow this  
mandoble

incomingmissile and dedi server

Recommended Posts

The server spawns a tank with its crew and adds the following event to the tank:

_eh = _tank addEventHandler ["IncomingMissile",{deleteVehicle (_this select 0)}];

And no matter how many missiles you fire against that tank, the IncommingMissile event is never executed.

In SP it executes correctly and deletes the tank as soon as a missile is fired against it.

Where is the trick? banghead.gif

Share this post


Link to post
Share on other sites

Check the locality of the script that adds the EH, you want the EH to be added globally (on every client). You'll have to find a way of giving a locally spawned tank a globally added EH.

Share this post


Link to post
Share on other sites

Well, just for that case, the tanks and their crews are local to the server, and the event handler is added there too. It is tank with 3 AI crew members, all create from the same script and executed only in the server.

So, even in that case, the AddEvent for the incomingMissile is still needed in every client?

EDIT: Only way around so far seems to be vehicleinit and ProcessInitCommands crazy_o.gif

Share this post


Link to post
Share on other sites

Hmmm...

So, from what you're saying so far it looks like your trying to create some sort of dynamic tank factory server-side, right?

If so, then the only method I can think of to deal with that across all client computers would be...

Have a global array defined.

The Server would be the only computer adding to or removing from this array.

Whenever the Server does this it publicVariable's the array.

At the client end you would either have a trigger or a script thread monitoring the size of the array.

If the size of the array changes client side then iterate through the array and check if an event handle exists for the vehicle. If it does not the add the IncomingMissile event to the vehicle.

A bit compilicated but i can see it working... although, now i think about it... what happens when you delete a vehicle on a remote computer, do the events attached to it locally dissolve too? i'd guess so, but...

Share this post


Link to post
Share on other sites
Hmmm...

So, from what you're saying so far it looks like your trying to create some sort of dynamic tank factory server-side, right?

LOL Nope tounge2.gif Was just trying to replace all ArmA missiles by MMA ones. Now it is done adding the handler with vehicleinit and then usign ProcessInitCommands for each spawned tank, chopper or plane. So far it seems to work well in dedi servers.

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  

×