_foley 192 Posted May 3, 2022 25 minutes ago, Tankbuster said: It is for MP. I did read the wiki notes on locality. The units that are being hit are server local and I want the code to run there. I've only tested localhost so far so will look out for issues. The HitPart event is more complicated than that in terms of locality. This event will fire only on the machine of the shooter, no matter if the target is local or not. You should add it on every machine that can potentially shoot the unit as opposed to just on the server where the unit is local. This isn't a problem for SP or hosted MP but it will make you scratch your head when you run it on dedicated server 🙂 1 Share this post Link to post Share on other sites
Tankbuster 1744 Posted May 3, 2022 24 minutes ago, _foley said: The HitPart event is more complicated than that in terms of locality. This event will fire only on the machine of the shooter, no matter if the target is local or not. You should add it on every machine that can potentially shoot the unit as opposed to just on the server where the unit is local. This isn't a problem for SP or hosted MP but it will make you scratch your head when you run it on dedicated server 🙂 Ah right. Yes, I see. Well, that might work in my favour as this is best run client side. Share this post Link to post Share on other sites
dreadedentity 278 Posted May 3, 2022 2 hours ago, Tankbuster said: ...are server local and I want the code to run there This just isn't going to be possible because of the locality of event handlers. While it would be simple to restrict unit spawning to the server only using remoteExec, the only player that has the same locality as the server is the player that hosted the MP mission; If it is a dedicated server then nobody will have the same locality as the server. Additionally there could be any number of players (well, 128) that could shoot the unit at any given time, but the event handlers are all local and will only fire where the shooter (not the target) is local. Thus the only way I can think of this working is that each client adds it's own event handler to the unit; that can be easily done with remoteExec and use 0 as the "target" parameter: [/* remoteExec args */] remoteExec ["addEventHandler", 0]; edit: I didn't see there was a page 2 and basically just rewrote everything _foley already said... 1 Share this post Link to post Share on other sites
sarogahtyp 1108 Posted May 3, 2022 25 minutes ago, dreadedentity said: easily done with remoteExec and use 0 as the "target" parameter: -2 would be the right target for a dedicated server environment Share this post Link to post Share on other sites
Tankbuster 1744 Posted May 3, 2022 6 hours ago, dreadedentity said: each client adds it's own event handler to the unit; Really? That's unnecessarily complex. I mean, I know how to do it, but really? Share this post Link to post Share on other sites
sarogahtyp 1108 Posted May 3, 2022 4 hours ago, Tankbuster said: Really? That's unnecessarily complex. I mean, I know how to do it, but really? I guess there is another solution where an EH has to be added to units which are local only and not the shooter has to be local: The HandleDamage EH provides the same information and needs to get added on the machine where the victim is local only... Maybe this helps to get a simpler solution for you. Edit: Should also work using https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Dammaged as @Twiznak stated already. This one should work without worrying bout locality as it fires with global arguments if i read it correctly. 1 Share this post Link to post Share on other sites
dreadedentity 278 Posted May 3, 2022 4 hours ago, Tankbuster said: Really? That's unnecessarily complex. I mean, I know how to do it, but really? It's worth thinking about if you have a very script-heavy mission and need to offload some processing to the clients. If not, then maybe not so much 1 Share this post Link to post Share on other sites
Tankbuster 1744 Posted May 4, 2022 @sarogahtyp I have plugged handledamage into the existing code and it sort of works. The only issue is that it returns the classname of the projectile, not its object, so the multiple activation prevention code is compromised Share this post Link to post Share on other sites
sarogahtyp 1108 Posted May 4, 2022 30 minutes ago, Tankbuster said: @sarogahtyp I have plugged handledamage into the existing code and it sort of works. The only issue is that it returns the classname of the projectile, not its object, so the multiple activation prevention code is compromised I think you should use Dammaged EH because it does'nt care bout locality and the projectile is returned as object as well. 1 Share this post Link to post Share on other sites
Tankbuster 1744 Posted May 4, 2022 1 hour ago, sarogahtyp said: I think you should use Dammaged EH because it does'nt care bout locality and the projectile is returned as object as well. Yep. That was my next port of call. I note that hitpart works with projectiles as of next game version. I'll look to see if that has any locality boobytraps when it arrives. Share this post Link to post Share on other sites
dreadedentity 278 Posted May 4, 2022 1 hour ago, Tankbuster said: see if that has any locality boobytraps Try not to think about it like this, but like...little pop quizzes from the devs 1 Share this post Link to post Share on other sites
Tankbuster 1744 Posted May 4, 2022 23 minutes ago, dreadedentity said: Try not to think about it like this, but like...little pop quizzes from the devs Absolutely. When I play the mission, I'm battling and trying to outwit the enemy. When I'm making the mission, I'm battling with Marek. 😀 Share this post Link to post Share on other sites
Tankbuster 1744 Posted May 4, 2022 Also, has it occurred to you that your username might be read as dread eden titty? Share this post Link to post Share on other sites
dreadedentity 278 Posted May 4, 2022 2 hours ago, Tankbuster said: Also, has it occurred to you that your username might be read as dread eden titty? that just makes it better 1 Share this post Link to post Share on other sites
Tankbuster 1744 Posted May 4, 2022 13 hours ago, sarogahtyp said: I think you should use Dammaged EH because it does'nt care bout locality and the projectile is returned as object as well. Dammaged EH doesn't activate when the unit is killed by the shot I'm sticking with handledamage (remember this returns the classname of the bullet, not the object) and when it activates, I'm using nearestobject bulletbase to get the bullet object, which I'm then feeding into the duplicate excluder snippet. So far - so good. 🙂 1 Share this post Link to post Share on other sites