Raised This Month: $32 Target: $400
 8% 

Entity - take damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 01-30-2018 , 08:22   Entity - take damage
Reply With Quote #1

Hi, i'm trying to figure it out how this works, taking damage from a custom/created entity.
creating entity:
PHP Code:
new fTarget engfunc(EngFunc_AllocString"func_breakable");
new 
ent engfunc(EngFunc_CreateNamedEntityfTarget );
set_pev(entpev_classname"testbox");
set_pev(entpev_solidSOLID_TRIGGER);
set_pev(entpev_movetypeMOVETYPE_TOSS);
set_pev(entpev_ownerid);
set_pev(ent,pev_takedamage1.0)
set_pev(ent,pev_health100.0
registering Ham_TakeDamage
PHP Code:
RegisterHam(Ham_TakeDamage,"func_breakable","hm_entDmg"
and hm_entDmg
PHP Code:
public hm_entDmg(thisinflictorattackerFloat:damagedamagebits) {
        
    new 
targetname[32], classname[32]
    
pev(thispev_targetnametargetname31)
    
pev(thispev_classnameclassname31)
    if(
equal(classname,"testbox")) {
       new 
Float:life;
       
pev(ent,pev_health,life)
       
set_pev(ent,pev_healthlife-10.0)
    }

    
server_print("%s - %s",enttargetnameclassname);
    return 
HAM_HANDLED

But i don't get anything from server_print.. most likely hm_entDmg isn't executing when i shoot in that entity
Clauu is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-30-2018 , 09:40   Re: Entity - take damage
Reply With Quote #2

Maybe because you are the owner's of the entity
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
E1_531G
Senior Member
Join Date: Dec 2017
Old 01-30-2018 , 13:56   Re: Entity - take damage
Reply With Quote #3

Quote:
set_pev(ent, pev_solid, SOLID_TRIGGER);
Try BBOX or SLIDEBOX.
__________________
My English is A0
E1_531G is offline
DeMNiX
Veteran Member
Join Date: Nov 2011
Location: Russia
Old 01-30-2018 , 17:33   Re: Entity - take damage
Reply With Quote #4

try use EngFunc_TraceModel
__________________
My channel with test codes
https://www.youtube.com/user/demnix03

Zombie Riot [Scenario & bots-zombie 11.11.2023]
https://youtu.be/8ZZan-aq2sc
DeMNiX is offline
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 01-31-2018 , 09:10   Re: Entity - take damage
Reply With Quote #5

Thanks for the info. After owner removing and changing the solid type i'm now able to track the damage.

Last edited by Clauu; 01-31-2018 at 09:12.
Clauu is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 01-31-2018 , 10:24   Re: Entity - take damage
Reply With Quote #6

How i know, for the owner of the entity only touch (solidity) are ignored.
__________________
My English is A0
E1_531G is offline
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 01-31-2018 , 14:58   Re: Entity - take damage
Reply With Quote #7

Hmm another question, it is possible to have on a entity both non blocking box and the capability to hook touch?

Last edited by Clauu; 01-31-2018 at 14:58.
Clauu is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 01-31-2018 , 16:31   Re: Entity - take damage
Reply With Quote #8

Quote:
#define SOLID_NOT 0 // No interaction with other objects
#define SOLID_TRIGGER 1 // Touch on edge, but not blocking
#define SOLID_BBOX 2 // Touch on edge, block
#define SOLID_SLIDEBOX 3 // Touch on edge, but not an onground
#define SOLID_BSP 4 // BSP clip, touch on edge, block
SOLID_TRIGGER, but it can't take damage.
__________________
My English is A0

Last edited by E1_531G; 01-31-2018 at 16:32.
E1_531G is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-31-2018 , 16:58   Re: Entity - take damage
Reply With Quote #9

Try set entity owner to the toucher id on fwd touch pre then set it back to 0 on touch post
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 01-31-2018 , 17:00   Re: Entity - take damage
Reply With Quote #10

Ups sorry, i forgot to mention about taking damage too
So is there any way having solid_trigger with tracing damage?
Clauu is offline
Reply


Thread Tools
Display Modes

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 16:36.


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