AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Monster dies? (https://forums.alliedmods.net/showthread.php?t=65426)

fxfighter 01-08-2008 06:48

Monster dies?
 
Trying to catch when a monster dies in monstermod whit hamsandwich.
But this dont work? no errors or messages appears.

Code:

#include <hamsandwich>
......
public plugin_init() {
 RegisterHam( Ham_TakeDamage , "func_wall" , "Monster_TakeDamage" )
 ........
 
}
public Monster_TakeDamage( this , idmonster , idattacker , Float:damage , damagebits )
{
new Model[32],Float:Health
 pev(idmonster,pev_model,Model,32)
 pev(idmonster,pev_health,Health)
 if(equal("models/headcrab.mdl",Model) && Health-damage <= 0.0)
 {
 client_print(idattacker ,print_chat,"you killd a headcrab")
  ......
 }
}
...


purple_pixie 01-08-2008 09:47

Re: Monster dies?
 
Well Monster_TakeDamage() is missing a parameter, the "inflictor" argument.

Shouldn't affect you, but try putting 0 instead of idattacker to be sure you can see any message appearing.

I assume monsters *are* a func_wall ?

You might aswell take out all the checks anyway, and dump all the input.

Something like:
Code:
public Monster_TakeDamage( this , idmonster , idinflictor, idattacker , Float:damage , damagebits ) {     new model[64] ;     pev(idmonster,pev_model,model,63) ;     client_print(0,print_chat,"Damage to ent %i (model: %s)",idmonster,model)     client_print(0,print_chat,"user: %i (inflictor: %i)",idattacker,idinflictor)     client_print(0,print_chat,"damage: %d (bits: %i)",damage,damagebits) }

fxfighter 01-08-2008 10:36

Re: Monster dies?
 
i run some cheeks and look fro monstermods source code and found out it was func_wall and why i did the cheek was becase thare are others func_wall one the map-.-
and i dont think i am missing a argument becase
idattacker stands whare your idinflictor just difrent names-.-

purple_pixie 01-08-2008 11:44

Re: Monster dies?
 
There's both inflictor and attacker ;-)

And it seems like classname is actually meaningful in MonsterMod, and not just func_wall ... though that was only a very quick look.

purple_pixie 01-11-2008 06:47

Re: Monster dies?
 
Aha, I have an idea!

It might be an idea of purest fail, but it might work.

What you might want to do, is get a monster's entity ID and use RegisterHamFromEntity on it.


All times are GMT -4. The time now is 11:06.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.