Quote:
Originally Posted by ChaosSlayer
but of course this wasnt what i was refering to - I want actual npc rogues =)
|
Here's how the server handles Hide when the client sends the OP_Hide packet:
zone/client_packet.cpp
Code:
void Client::Handle_OP_Hide(const EQApplicationPacket *app)
{
if(!HasSkill(HIDE)) {
return; //You cannot hide if you do not have hide
}
if(!p_timers.Expired(&database, pTimerHide, false)) {
Message(13,"Ability recovery time not yet met.");
return;
}
int reuse = HideReuseTime - GetAA(209);
p_timers.Start(pTimerHide, reuse-1);
float hidechance = ((GetSkill(HIDE)/250.0f) + .25) * 100;
float random = MakeRandomFloat(0, 100);
CheckIncreaseSkill(HIDE,15);
if (random < hidechance) {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer;
sa_out->spawn_id = GetID();
sa_out->type = 0x03;
sa_out->parameter = 1;
entity_list.QueueClients(this, outapp, true);
safe_delete(outapp);
if(GetAA(aaShroudofStealth)){
improved_hidden = true;
hidden = true;
}
else
hidden = true;
}
if(GetClass() == ROGUE){
EQApplicationPacket *outapp = new EQApplicationPacket(OP_SimpleMessage,sizeof(SimpleMessage_Struct));
SimpleMessage_Struct *msg=(SimpleMessage_Struct *)outapp->pBuffer;
msg->color=0x010E;
if (!auto_attack && entity_list.Fighting(this)) {
if (MakeRandomInt(0, 300) < (int)GetSkill(HIDE)) {
msg->string_id=343;
entity_list.Evade(this);
} else {
msg->string_id=344;
}
} else {
if (hidden){
msg->string_id=346;
}
else {
msg->string_id=345;
}
}
FastQueuePacket(&outapp);
}
return;
}
The code below the blue text is just the evasion code for rogues, which we don't really need to worry about.
Looking at the code, it looks like all that's done is, when the client hides, it sends out a
SpawnAppearance packet. It uses a
type of 0x03, which is visibility, and a paramater of 1 for hidden, 0 for not hidden. Elsewhere in the code, if you do something to break invis, it will send 0, otherwise it'll continue to stay 1. In the case of a Rogue NPC, you should be able to do the same thing, you just have to figure out how to trigger it in the first place, which would probably be on spawning, but also maybe with a variable, just in case you don't want rogues to hide on you. The unhide would more than likely come into the aggro or attack code (probably attack if memory serves me on how it worked in Live, but it also depends if your NPCs are Hiding & Sneaking at the same time). In addition, if you want to create NPCs, like the spiders in Crystal Caverns whose invis isn't removed on aggro, combat, moving, etc, you just wouldn't send the packet removing invis.
I know it's not the code to actually get it working, but hopefully this points someone in the right direction.