- Joined
- May 18, 2013
- Messages
- 852
- Reaction score
- 323
So this is what I'M personally using
Even tried to add
To see if it would take melee damage. (i tried every part of the body)
Also
I added my own reward, so when the AI do die, i get 1000 XP ![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Hopefully GigaToni can shed some light, or any of the smart coder on ragezone.
I would tag them, but i don't want to annoy them.
Please shoot me a PM if you have any idea.
Code:
bool obj_Guard::ApplyDamage(GameObject* fromObj, float damage, int bodyPart, STORE_CATEGORIES damageSource)
{
if(GuardState == PLAYER_DIE)
return false;
float dmg = damage;
GuardHealth -= dmg;
if(GuardHealth <= 0.0f)
{
DoDeath();
PKT_S2C_KillPlayer_s n;
n.targetId = toP2pNetId(this->GetNetworkID());
n.killerWeaponCat = (BYTE)damageSource;
n.forced_by_server = true;
gServerLogic.p2pBroadcastToActive(fromObj, &n, sizeof(n));
if(fromObj->Class->Name == "obj_ServerPlayer")
{
obj_ServerPlayer* plr = (obj_ServerPlayer*)fromObj;
gServerLogic.AddPlayerReward(plr, RWD_GuardKill,0); //XP For Guard
}
return true;
}
// direct hit, switch to that player anyway if it is new or closer that current one
float distSq = (fromObj->GetPosition() - GetPosition()).LengthSq();
const GameObject* trg = GameWorld().GetObject(hardObjLock);
if((trg == NULL) || (trg && distSq < (trg->GetPosition() - GetPosition()).LengthSq()))
{
StartAttack(fromObj);
}
return false; // false as zombie wasn't killed
}
Code:
if(damageSource != storecat_MELEE && bodyPart == 1) // everything except for melee: one shot in head = kill
damage = 1000;
Also
Code:
gServerLogic.AddPlayerReward(plr, RWD_GuardKill,0); //XP For Guard
Hopefully GigaToni can shed some light, or any of the smart coder on ragezone.
I would tag them, but i don't want to annoy them.
Please shoot me a PM if you have any idea.
Last edited by a moderator: