Jump to content
Sign in to follow this  
dmarkwick

"fired" event weirdness

Recommended Posts

Getting some strange results in MP with the "fired" event. I'm beginning to suspect that a client throwing an object (i.e. grenade) is not seen as a fired event, whereas the same action by the host/player is.

I was testing out a new addon tonight for the first time in MP. It's the smokeshell viewblock addon I've been working on recently.

First, we tried a simple test mission where we took turns to throw smoke grenades around a corner where two enemy were standing, and then we both stepped out. As pilots, we each had red smoke grenades.

When I threw them, we were able to step out OK and not get fired upon, but when Acog99 threw grenades out, we were shot as though no viewblock existed. We repeated this several times, no mistake.

Next, we did exactly the same mission but as grenadiers. Same result for me, I fired smokeshells and we stepped out, no fire. Acog99 fired smokeshells, we step out and also, no fire. Several times, same result. So Acog99 can fire successful smokeshells, but not throw them.

So for some reason, if a client fires a smokeshell, a viewblock object is created. If he throws a smoke grenade, no viewblock is created. If the host throws a smoke grenade, a viewblock is created. Exactly the same code is used for each type. I cannot explain this activity in terms of scripting, all that happens is that on a "fired" event, the ammo type is compared against a list of strings.

I wonder if a client throwing something in MP is not captured as a "fired" event for some reason?

Share this post


Link to post
Share on other sites

Further to the above, we tested it out on 2 versions of the smoke grenade addon. In one version, the viewblocks were made with createVehicle. On the other, the viewblocks were made with createVehicle on the server only, using "if (!isServer) then exitwith {};"

Same results both ways.

Share this post


Link to post
Share on other sites

I'm going to check if clients throwing objects trigger a fired Eh on their local machine...

EDIT: I added the fired eventhandler locally to units on the machine I created them on, in MP, and displayed a hint showing the weapon/ammo. The computer with the local units that fired the smoke grenades (squad leaders) successfully displayed the hint, whether client or server. I also created roadcones upon the fired event at the firer's location, which displayed for all machines whether created on the server or client, and the ammo was correctly shown as "smokeshell". (Also, there was a noticable innaccuracy in placement of the cones, maybe your viewblockers are being placed too far away from the smoke location?)

Might want to check the code where you compare the ammo to the string in the event there's a compare error, or where you catch the landing location of the smokeshell. Perhaps the code creates the viewobject at the landing location of the smoke, but not where it bounces?

Share this post


Link to post
Share on other sites
I'm going to check if clients throwing objects trigger a fired Eh on their local machine...

EDIT: I added the fired eventhandler locally to units on the machine I created them on, in MP, and displayed a hint showing the weapon/ammo. The computer with the local units that fired the smoke grenades (squad leaders) successfully displayed the hint, whether client or server. I also created roadcones upon the fired event at the firer's location, which displayed for all machines whether created on the server or client, and the ammo was correctly shown as "smokeshell". (Also, there was a noticable innaccuracy in placement of the cones, maybe your viewblockers are being placed too far away from the smoke location?)

Might want to check the code where you compare the ammo to the string in the event there's a compare error, or where you catch the landing location of the smokeshell. Perhaps the code creates the viewobject at the landing location of the smoke, but not where it bounces?

That's an interesting test The_Captain, and thanks for the effort you put in smile_o.gif That will help me out for sure.

The viewblock object is constantly (every 5 seconds) updated to the shellsmoke position. (I had to do this to correctly line up smoke & viewblock for extreme distant grenade launches. It's no biggie as the viewblock orientation is also updated every 5 seconds to orient to the wind.)

So it sounds like there's a viewblock being created somewhere, just not where it's supposed to be. Time to make the addon viewblock visible again (I removed all the visible objects for addon size) and have a look smile_o.gif

But one thing puzzles me: one of the addons uses a if (!isServer) exitwith {}; logic to only control the viewblock from the server, and if the server knows where the smokeshell is (as evidenced by the smoke we both see ingame), why would it not correctly update the viewblock?

Is perhaps the smokeshell object local to the client? But if so then the addon version without the exitwith would have been OK as far as I can work out.

**EDIT**

Re-reading you post again, did you try throwing the smokeshell as a player client? This is the only area it fails.

Share this post


Link to post
Share on other sites
i think al-simmons had same problem when he made some view blockers .

here is a linkt maybe there is some relevant info.

al-simmons smoke grenades

Hmm yes, looks like there is some sort of problem. Also looks like KyleSarnik has some sort of a solution, involving inserting a small delay somewhere. I've PM'd him, but if anyone knows more about this can they post it up here? The FAC addon link(s) at that thread are dead apparently.

Share this post


Link to post
Share on other sites

6thsense.eu tracers work on all bullets in MP. Something like that might help.

Fired eventhandler should be global by the way. So each PC with the addon should run the scripts.

Maybe "createvehiclelocal" the viewblock on each client and server.

Share this post


Link to post
Share on other sites
6thsense.eu tracers work on all bullets in MP. Something like that might help.

It's only on a throw action that the fired event is not working, and only for MP clients.

Fired eventhandler should be global by the way. So each PC with the addon should run the scripts.

According to the Biki it is global, but I need to make it createVehicle so that only the server needs the addon for VB functionality. To this end I've disabled clients creating objects.

Maybe "createvehiclelocal" the viewblock on each client and server.

I'm trying to implement a createVehicle on the server as mentioned above. I'd like for the DMSmokeGrenadeVB addon to be either server-only, client-only, or both, with no ill effects for mix & matching. So servers will execute the VB functionality for the entire game, and clients will just get the visual effects, without trying to spawn stuff the server might not have.

Share this post


Link to post
Share on other sites

After testing in MP, I've drawn the conclusion that the fired event works globally for most projectiles (tested with M4), but only locally for thrown projectiles (tested with M67). That means, even when the fired EH is added to the unit in global space, its effects when triggered by a thrown projectile are only local to the firing unit. It's quite odd, but it means that the event still fires somewhere for thrown projectiles in MP. So all you need to do is make sure that the scripts called via the event handler are designed to operate on the client that the firing unit is local to.

Now, I can't say if it did the same in OFP, but I do know that my grenade pack scripts were designed to function soley from the client (for other reasons), and the only scripts executed globally were simple dropped particle effects. Hopefully you'll be able to do the same much easier with the added scripting commands in ArmA.

Share this post


Link to post
Share on other sites
After testing in MP, I've drawn the conclusion that the fired event works globally for most projectiles (tested with M4), but only locally for thrown projectiles (tested with M67). That means, even when the fired EH is added to the unit in global space, its effects when triggered by a thrown projectile are only local to the firing unit. It's quite odd, but it means that the event still fires somewhere for thrown projectiles in MP.

Then I guess it constitutes a bug, as the reference for the "fired" event labels it as global.

So all you need to do is make sure that the scripts called via the event handler are designed to operate on the client that the firing unit is local to.

I had this in one version of the DMSmokeGrenadeVB addon, where the client also used a createVehicle for the viewblock object, but no go. Maybe it only created it locally on his machine, but that's not what I expected createVehicle to do.

Is there any way to force the server to see the client-thrown grenade's position?

Now, I can't say if it did the same in OFP, but I do know that my grenade pack scripts were designed to function soley from the client (for other reasons), and the only scripts executed globally were simple dropped particle effects. Hopefully you'll be able to do the same much easier with the added scripting commands in ArmA.

Well I'd like for the server to be solely responsible for VB placement if possible. Using createVehicle so all clients see it (so their local AI react to it).

Share this post


Link to post
Share on other sites

I have an idea on working around this that just may let you pull it off successfully. It's actually a script based global executor I've used before that I could adapt to force the issue to go the way you need it to go in MP, so I know it's reliable. It just needs a little adaptation to make it suitable for a more generalized task like this.

I'm sending you my e-mail address via PM. If you like, drop me what you have so far, and I'll see if I can't get it up to scratch wink_o.gif.

Share this post


Link to post
Share on other sites
Quote[/b] ]Is there any way to force the server to see the client-thrown grenade's position?

What about ProcessInitCommands? Amongst other things, you can send either the grenade itself or just the position it explodes. Plus it will cover people who JIP as well.

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  

×