I was wondering if anybody can point me in the right direction of making different death animations/death sounds play on the player/enemies depending on the kill type - like falling in lava, slime, getting killed by a shotgun, etc.
Announcement
Collapse
No announcement yet.
Alternate death animations for specific events?
Collapse
X
-
sure thing. Obituaries.. theyre in client.qc if i remember.
player animations are in player.qc
-
once i made players instantly gib when they fall in lava, well not instantly but when their health went to 0 i called the gib animation. There's no reason to see player corpse so why not burn them to hell?
Comment
-
i think will be something like some new global float called "deathtype".
in defs.qc
Code:.float deathtype; DEATHTYPE_LAVA = 1; DEATHTYPE_SLIME = 2; DEATHTYPE_WATER = 4; DEATHTYPE_BULLET = 8; DEATHTYPE_EXPLOSION = 16; DEATHTYPE_NAIL = 32; DEATHTYPE_AXE = 128;
when you shot a monster you need to know:
what weapon i am using?
is the monster still alive?
you can know if a monster die for example in W_FireAxe function
Code:if (trace_ent.takedamage) { trace_ent.axhitme = 1; SpawnBlood (org, '0 0 0', 20); T_Damage (trace_ent, self, self, 20); [COLOR="Lime"]if (trace_ent.health < 0) trace_ent.deathtype = DEATHTYPE_AXE; [/COLOR] }
with this new float the monster will get a new death animation.
For example. for a dog.
Code:void() dog_die = { // check for gib if (self.health < -35) { sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); ThrowGib ("progs/gib3.mdl", self.health); ThrowGib ("progs/gib3.mdl", self.health); ThrowGib ("progs/gib3.mdl", self.health); ThrowHead ("progs/h_dog.mdl", self.health); return; } // regular death sound (self, CHAN_VOICE, "dog/ddeath.wav", 1, ATTN_NORM); self.solid = SOLID_NOT; [COLOR="Lime"]if (self.deathtype == DEATHTYPE_AXE) dog_dieaxe1 ();[/COLOR] else if (random() > 0.5) dog_die1 (); else dog_dieb1 (); };
the invasion has begun! hide your children, grab the guns, and pack sandwiches.
syluxman2803
Comment
-
Unfortunately, dog_die() is called before the deathtype is set (T_Damage() will call self.th_die()). You can use this idea as-is in the dog_die1()/dog_dieb1() functions, but there will be one frame of the old animation.
One idea comes from a way to bugfix some obituary messages (these are the messages when a player kills another player). Typically, modders add a deathtype string to the arguments of T_Damage (for example, you can pass "axe" in the axe attack function when calling T_Damage). In this case, the string also needs to go through Killed() and ClientObituary(). I think you might be able to pass the string to the self.th_die() call in Killed(), and thus handle it in dog_die().
Comment
-
I actually ended up doing it a different way as I was getting errors (and I'm no coder), I ended up using
Code:if (self.enemy.weapon == IT_SUPER_SHOTGUN) { <do death code> }
Comment
-
Hello Bloodshot,
The smc already has weapon dependent death animations.
Read the source and the documentation for more information.
Every monster has an enemy weapon check at the very beginning of their death functions:
- It will trigger the lightning gun death animation types (there are different ones available).
- It will trigger the burning-and-running-around-in-panic (like in the Blood game).
- It will trigger all the custom smc death animations.
- �
It is all there in front of you. So use it.
The smc is more than you might think of.
Every feature is also explained / commented within the source code itself for your convenience.
Regards,
Seven
Comment
-
Looking at your code i actually ended up making it really similar to yours without realizing, it's done in mostly the same way, with the exception being I'm using extra enemy models for the additions I'm making to the gore, and a few small syntax differences here and there.Last edited by Bloodshot; 01-19-2016, 11:44 AM.
Comment
Comment