EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=590)
-   -   Sneaking and Hiding NPCs? (https://www.eqemulator.org/forums/showthread.php?t=26232)

ChaosSlayer 09-19-2008 09:36 PM

Sneaking and Hiding NPCs?
 
Question: is it posible to tell npc to hide or sneak? Specialy if they rogues by class?

I know that giving npc air elemental spells will make it cast invis on itself, but is there any other way?

I belive there were some hiding rogues in Dulak Harbor on Guntak they would suddenly appear and attack. On other hand they could have been just trigered trap-spawns

Overall it woudl be nice if npc rogues would all be hiden until you agro them

Also I belive back in Crustal Coverns (or Dragon Necropolis?) the phase spiders were actualy able to become invisable while attacking - it was imposible to fight them wihout see invis ability

do any of these work or can be implemented?

KLS 09-19-2008 09:56 PM

Currently no but they're really interesting ideas so I wouldn't put it out of the question of being implemented in the future.

ChaosSlayer 09-19-2008 10:10 PM

I am glad to hear that you like it =)

Specialy would be interesting if Rogue npc would first start out hidden, and when player walks into agro range, rather than just to rush at him, they would sneak up to him quetly and open up with a backstab =)

paaco 09-19-2008 11:58 PM

Yeah I remember the Dulak Harbor Rogues, they weren't trap spawns, they were actually there hiding. You could see them with see invis on. Very nice idea though, I haven't even though about that :)

merb 09-22-2008 10:06 PM

It would be possible, but it'd take watcher mobs or something of that sort.

For example, you could place an invisible watcher mob at the entrance to a cave with a proximity set so that when a player gets close enough, a mob will spawn and probably emote or shout something.

I'm no quest expert, so I'm not too sure how to set up proximity signals on mobs, but I've seen things like that done before.

trevius 09-22-2008 11:09 PM

This would be pretty simple just using the new quest commands.

Create your sneaking NPC as race 240 and I think gender 0. Then run this script:

Code:

sub EVENT_AGGRO {

  quest::npcrace(433);
  quest::npcgender(2);
  quest::say("DIE!");

}

That should do what you want. Though, I am sure you could customize it and add more wherever you like.

ChaosSlayer 09-23-2008 12:12 AM

you can also make a simple prox trap.
You make an invis npc triger holder with folowing script (below) who will spawn an actual npc, and then can either be set of wait timer or depop to prevent chain spawning (unles its your intent) (in PoJ on death Row there are crates in the ground- when steped on it will spawn a banshee every 60 seconds)

Quote:


sub EVENT_SPAWN
{

my $x;
my $y;
my $z;
my $h;

$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
$h = $npc->GetHeading();

quest::set_proximity( $x-25,$x+25,$y-25,$y+25,$z-25,$z+25);
}


sub EVENT_ENTER
{
my $x;
my $y;
my $z;
my $h;

$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
$h = $npc->GetHeading();

quest::spawn2(9999,0,0,$x,$y,$z,$h);
quest::depop();
}



but of course this wasnt what i was refering to - I want actual npc rogues =)

AndMetal 09-23-2008 02:13 AM

Quote:

Originally Posted by ChaosSlayer (Post 156636)
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.


All times are GMT -4. The time now is 04:27 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.