sub EVENT_SPAWN - Check for clients around npc. Need some help please.
I have an idea on how to buff temporary (swarm) pets based on the user's charisma but it requires that npc to check for the player with a certain item in their inventory && their charisma value.
Just an example below. This quest goes in the folder where that npc resides either templates or the zone folder with its name.pl 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-6,$x+6,$y-6,$y+6,$z-6,$z+6); } sub EVENT_???? (ENTER/EXIT WORK BUT ARE INCONVENIENT) { $cha = $client->GetCHA(); my $npcid = $npc->GetID(); if ($cha >= 50 && $cha <= 99 && $hasitem{1384}) { quest::say("Test"); $npc->CastSpell(777,$npcid); } The example above works on proximity tests (EVENT_ENTER/EXIT) but it's annoying as hell since you have to move towards and away from the mob. So, my question to anybody reading this: How would you make an NPC check for the client and these conditions as soon as it's spawned only using sub EVENT_SPAWN? |
I'm pretty sure you can take a look at how steadfast servant works to detect an owner on spawn and see how that goes. Best of luck!
|
Thank you very much! This helped a great deal!
|
Doesn't work with Offensive Swarm Pets.
They always spawn with an owner ID of 0 And their Follow ID is not the client that spawned them |
Figured out a work around... not sure how efficient this is yet. But it works!
Checks for an Item on the player ... So if they are holding X item the swarm pet will buff itself with a nice buff! So I guess you could make multiple different ranks of an item that make swarm pets more and more powerful.. heh Code:
|
All times are GMT -4. The time now is 01:44 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.