After around eight hours of struggling with this, it's complete. It's very crude right now, has no "remember" factor and will only work if you're top on aggro.
Next version should have both of these fixed.
Insert into client_process.cpp:
Where the code for standing up is:
Code:
if (sa->parameter == 0x64)
{
// cout << "Client " << name << " standing" << endl;
appearance = 0;
this->SetFeigned(0);
}
Among skills code:
Code:
case OP_FeignDeath:
{
int feignchance = GetSkill(FEIGN_DEATH);
int primfeign = GetSkill(FEIGN_DEATH);
if (primfeign > 100) {
primfeign = 100;
}
int secfeign = GetSkill(FEIGN_DEATH);
if (secfeign < 101) {
secfeign = 0;
}
else {
secfeign = secfeign - 100;
secfeign = secfeign / 2;
}
int totalfeign = primfeign + secfeign;
if (rand()%160 > (totalfeign)) {
Message(0,"You have fallen to the ground");
this->SetFeigned(0);
appearance = 3;
}
else {
this->SetFeigned(1);
appearance = 3;
}
if (rand()%210 > feignchance && rand()%3 == 1 && GetSkill(FEIGN_DEATH) < 200 && GetSkill(FEIGN_DEATH) < this->GetLevel()*5+5 ) {
this->SetSkill(25,++pp.skills[25]);
UpdateWho();
}
break;
}
Client.cpp
Insert to bottom of Client:Client (below isgrouped=false)
Insert to bottom of client.cpp
Code:
void Client::SetFeigned(int8 in_feigned) {
feigned=in_feigned;
}
client.h
Insert below bool GetPVP() { return pp.pvp; }
Code:
void SetFeigned(int8 in_feigned);
int8 GetFeigned() { return feigned; }
Insert at bottom of client.h, just above
};
#endif
npcAI.cpp
Replace if (!sender->IsEngaged()) with:
Code:
if (!sender->IsEngaged() && currentmob->CastToClient()>GetFeigned() != 1)
npc.cpp
And finally, just above if (target->GetID() != this->ownerid && attack_timer->Check()) (line 334) add:
Code:
if (hate_list.GetTop()->CastToClient()->GetFeigned() == 1) {
RemoveFromHateList(GetHateTop());
}
There it is
