AlliedModders

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

schirodes 10-26-2014 17:11

TakeDamage from Monster
 
Sorry for my english, i'm from Argentina! :)

Hi! I want to catch when Monster attack a Player..

I tried whit Ham, and whit Orpheu (but Orpheu use the call of Ham if I didn't understand bad..), but i can't, I read all the post including this: https://forums.alliedmods.net/showth...7521?p=1087521

And couldn't!

This is TakeDamage of Orpheu I use:

PHP Code:

{
    
"name" "TakeDamage",
    
"class" "CBasePlayer"
    
"library" "mod",
    
"arguments" :
    [
        {
            
"type" "entvars_s *"
        
},
        {
            
"type" "entvars_s *"
        
},
        {
            
"type" "float"
        
},
        {
            
"type" "int"
        
}
    ],
    
"indexes" :
    [
        {
            
"os" "windows",
            
"mod" "cstrike",
            
"value" 12
        
},
        {
            
"os" "linux",
            
"mod" "cstrike",
            
"value" 14
        
}
    ]



Arkshine 10-26-2014 17:55

Re: TakeDamage from Monster
 
Monster is vague. MonsterMod? Monster from HL1? Other? You should anyway use Ham as it's the same.

schirodes 10-26-2014 17:56

Re: TakeDamage from Monster
 
MonsterMod (by Botman) in Cs 1.6

Arkshine 10-26-2014 17:59

Re: TakeDamage from Monster
 
Are you saying that just by hooking TakeDamage on "player", without filtering inside (just one line to show debug text), if a monster attacks a player, this forward is never called?

schirodes 10-26-2014 18:04

Re: TakeDamage from Monster
 
Yes, when Monster attack Player, not show results
Code:

PHP Code:

public fwd_HamTakeDamageiClientiInflictoriAttackerFloat:fDamagem_Damagebits )
{
    
client_print(0,print_chat,"%d entity was damaged by %d attacker with %f points",iClient,iAttacker,fDamage);

    return 
HAM_IGNORED;


If I hurt jumping, show the text.. But when monster attack me, no...

Arkshine 10-27-2014 04:32

Re: TakeDamage from Monster
 
Ah well, it makes sense, Ham uses the virtual table in the mod ; but MonsterMod is a bit special, it basically uses HLSDK as base but modified a bit to be a metamod plugin. So, you will need to hook TakeDamage in MonsterMod. You can probably use Orpheu, filling "library" with "monstermod", maybe removing "mod" and using the right indexes. This should be the same as HL1 (mod "valve"). Though it might be tricky and you may need to recompile MonsterMod the same way as the game.
You can also hook the CBasePlayer::TakeDamage with a signature in case you fail to deal with the virtual function. This should work if you don't forget to specify "monstermod".

schirodes 10-27-2014 15:43

Re: TakeDamage from Monster
 
Yes, that seems the only solution..

Thanks Arkshine! I need to read more about orpheu and modules to do this! Thx for all


All times are GMT -4. The time now is 17:29.

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