mandoble 1 Posted June 23, 2007 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? Share this post Link to post Share on other sites
Big Dawg KS 6 Posted June 23, 2007 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
mandoble 1 Posted June 23, 2007 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 Share this post Link to post Share on other sites
Synide 0 Posted June 24, 2007 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
mandoble 1 Posted June 24, 2007 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 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