Raised This Month: $ Target: $400
 0% 

Monster dies?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fxfighter
Veteran Member
Join Date: Feb 2007
Location: Trollhättan
Old 01-08-2008 , 06:48   Monster dies?
Reply With Quote #1

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")
  ......
 }
}
...
__________________
If one of my plugins become broken, contact me by mail. [email protected]
fxfighter is offline
Send a message via MSN to fxfighter
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 01-08-2008 , 09:47   Re: Monster dies?
Reply With Quote #2

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) }
purple_pixie is offline
fxfighter
Veteran Member
Join Date: Feb 2007
Location: Trollhättan
Old 01-08-2008 , 10:36   Re: Monster dies?
Reply With Quote #3

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-.-
__________________
If one of my plugins become broken, contact me by mail. [email protected]
fxfighter is offline
Send a message via MSN to fxfighter
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 01-08-2008 , 11:44   Re: Monster dies?
Reply With Quote #4

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 is offline
Old 01-08-2008, 12:24
fxfighter
This message has been deleted by fxfighter. Reason: gfaw
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 01-11-2008 , 06:47   Re: Monster dies?
Reply With Quote #5

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.
purple_pixie is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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