Author Topic: [SOLVED (fo reelz?)] Headshot that spawn an explosion on target's death?  (Read 6669 times)


Using the default gun, which kills in 4 shots, it prints 'Move' 3 times, but the fourth shot doesn't print anything

Try it with different guns as well, if they all print nothing for the kill then use the nothing.

Mm, doesn't print anything or prints ""? There's a big difference; is it a blank line or is no line printed at all?

Mm, doesn't print anything or prints ""? There's a big difference; is it a blank line or is no line printed at all?
Try it with different guns as well, if they all print nothing for the kill then use the nothing.
Same thing happens with other weapons, it makes the chat say "Move" with each blow to the head, except the one that kills the player which doesn't print anything at all, no new chat line, nothing

Coolio. So that means that the announce function isn't being called at all. This means that either if(matchBodyArea(getHitbox( %obj, %col, %pos ), $headTest )) or if(%col.getType() & $TypeMasks::PlayerObjectType) is returning false. Move the announce line up two lines so we can find out which; if it still doesn't appear then matchBodyArea is returning false, if it does appear then %col.getType() isn't player object type.

announce(%col.getType() & $TypeMasks::PlayerObjectType); announces "16384" for three shots, but the fourth one announces "0"
announce(matchBodyArea(getHitbox( %obj, %col, %pos ), $headTest )); announces "1" for all four shots

Is 16384 the ID of the bot or the brick that spawned it or something?

So, apparently, dead bodies aren't players, lol. Change that check to if(%col.getClassName() $= "Player")

16384 is the mask that players have. The number itself is unimportant, it's effectively random. The relevance is that, when converted to binary, it's 100000000000000. Only one 1 is set. Bitmasks are a complicated type system that doesn't need to be understood for this purpose, but if you wanna understand them z0w0 has a great writeup here.
« Last Edit: November 08, 2014, 10:45:48 PM by $trinick »

Alright, now it's returning 0s for all four shots, so we can confirm that bots are indeed, not players :cookieMonster:

What class name do bots use?


AIPlayer.
Waha! It works! And if(%col.getState() $= "Dead") even returns 1 when the player dies!

Thanks a bunch, guys! Everything now works as it should :D

Edit: For some reason, the particles don't work, they only appear when i execute the server.cs or server_bdaydeath.cs file either through the console, or by leaving it in the if(%col.getState() $= "Dead") script, so what's this all about now?

These are the whole files
server.cs - Server_BdayDeath.cs
« Last Edit: November 09, 2014, 02:13:30 AM by Masterlegodude »

Use %col.getType() & $TypeMasks::PlayerObjectType to check if they're either a player or a bot.

Use %col.getType() & $TypeMasks::PlayerObjectType to check if they're either a player or a bot.
I used that originally and it didn't work, anyway, that doesn't matter now since i've got it all working

I just need to figure out why the particles don't appear unless i execute the add-on

Edit: Uhh, all i did was space out a few things in the various explosion datablocks and add in a UI name for the explosion and projectile data so that it can be used with events and it works somehow

It's such a minor change, i really have no idea what happened or how i managed to fix it by doing that but i guess everything's hunky-dory now, question mark?
« Last Edit: November 09, 2014, 05:55:53 AM by Masterlegodude »