Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Request] Bandit AI need to receive damage.

Joined
May 18, 2013
Messages
852
Reaction score
323
So this is what I'M personally using
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
}
Even tried to add
Code:
if(damageSource != storecat_MELEE && bodyPart == 1) // everything except for melee: one shot in head = kill
		damage = 1000;
To see if it would take melee damage. (i tried every part of the body)

Also
Code:
gServerLogic.AddPlayerReward(plr, RWD_GuardKill,0); //XP For Guard
I added my own reward, so when the AI do die, i get 1000 XP :)

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:
Back
Top