Answered A check for getting a hitmarker/Damaging a player

The Dark Side

Former Staff Member
Messages
1,012
Reaction score
784
Points
993
Anybody know one? Couldn't find anything in the GSC dumps. :disappointed:

Much love. Respect in the comments!
 

zerker24

Developer
Messages
35
Reaction score
42
Points
218
Here is part of the detection from my Freezetag gametype. Hope it helps.

Code:
fDamageMoniter()
{
    self endon("disconnect");

    for(;;)
    {
        self waittill("damage", damage, attacker, direction_vec, point, type, modelname, tagname, partname, weaponname);
        if(weaponname == "knife_mp")
        {
            if(type == "MOD_MELEE")
            {
                 //Player has been knifed. use attacker as the person who delt the damage, self as the person who got damaged.
            }
        }
    }
}
 

The Dark Side

Former Staff Member
Messages
1,012
Reaction score
784
Points
993
Yep. What do you need specifically? DM me because I will be much more explicit about the answer; Not like cursing, moreso as detailed as possible.
Dm'd.

Here is part of the detection from my Freezetag gametype. Hope it helps.

Code:
fDamageMoniter()
{
    self endon("disconnect");

    for(;;)
    {
        self waittill("damage", damage, attacker, direction_vec, point, type, modelname, tagname, partname, weaponname);
        if(weaponname == "knife_mp")
        {
            if(type == "MOD_MELEE")
            {
                 //Player has been knifed. use attacker as the person who delt the damage, self as the person who got damaged.
            }
        }
    }
}
Tried messing with it for about 2 hours. Got nowhere. :disappointed: Thank you anyway! I hope it's not just me being stupid!
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,745
Reaction score
2,829
Points
1,053
Forgot to reply here. Thread can be closed. Issue is solved. :grinning:
That's awesome to hear! How did you solve the problem? Would be cool if you share your solution to the people who are also struggling with it! :smile:
 

The Dark Side

Former Staff Member
Messages
1,012
Reaction score
784
Points
993
That's awesome to hear! How did you solve the problem? Would be cool if you share your solution to the people who are also struggling with it! :grinning:
SeriousHD- and zerker24 helped me out, but in the end, zerker solved it for me. On top of that, the way of detecting a player getting hit with your gun was a challenge for me. It made me feel pretty stupid considering I couldn't figure it out. Bottom line, there is no check for damaging a player. You have to define it yourself. Like this.

Code:
Playerdamagecheck()
{
   self endon("disconnect");
   level endon("TURTLESTOP");
   for(;;)
   {
       self waittill("damage", damage, attacker, direction_vec, point, type, modelname, tagname, partname, weaponname);
       if(weaponname == "kard_wager_mp+reflex+silencer" && attacker.turtlegunactive)
       {
           attacker playerturtle(self);
           self.health = self.maxhealth;
           wait 0.5;
       }
   }
}
There may be an easier more simple way of coding this. But this works. :grinning:
 

zerker24

Developer
Messages
35
Reaction score
42
Points
218
That's awesome to hear! How did you solve the problem? Would be cool if you share your solution to the people who are also struggling with it! :grinning:
SeriousHD- and zerker24 helped me out, but in the end, zerker solved it for me. On top of that, the way of detecting a player getting hit with your gun was a challenge for me. It made me feel pretty stupid considering I couldn't figure it out. Bottom line, there is no check for damaging a player. You have to define it yourself. Like this.

Code:
Playerdamagecheck()
{
   self endon("disconnect");
   level endon("TURTLESTOP");
   for(;;)
   {
       self waittill("damage", damage, attacker, direction_vec, point, type, modelname, tagname, partname, weaponname);
       if(weaponname == "kard_wager_mp+reflex+silencer" && attacker.turtlegunactive)
       {
           attacker playerturtle(self);
           self.health = self.maxhealth;
           wait 0.5;
       }
   }
}
There may be an easier more simple way of coding this. But this works. :grinning:
Happy I could help! Also, this method is pretty simple lol and I am not sure there is any other way. Well, any other simple way. I suppose you could use button presses and player health checks, but that would be REALLY inefficient and ugly in my opinion.
 

The Dark Side

Former Staff Member
Messages
1,012
Reaction score
784
Points
993
Happy I could help! Also, this method is pretty simple lol and I am not sure there is any other way. Well, any other simple way. I suppose you could use button presses and player health checks, but that would be REALLY inefficient and ugly in my opinion.
After you got it done, i thought why couldnt you just do something like this? No need for a check in this way. But i tried it and it didnt work. :disappointed:

Code:
    if( self getcurrentweapon() == "kard_wager_mp+reflex+silencer" )
    {
        tracebull = bullettrace( self gettagorigin( "j_head" ), self gettagorigin( "j_head" ) + anglestoforward( self getplayerangles() ) * 1000000, 1, self );
    }
    tracebull[ "entity"] thread playerturtle();
 
Top