|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Q&A This is the quest support section |
|
|
|
02-19-2015, 08:04 PM
|
|
Sarnak
|
|
Join Date: Jul 2009
Location: East Coast
Posts: 35
|
|
More efficient way to do this routine?
I was wondering if there was a more efficient way to do this.
Also I want to add a class check so that I particular class needs to be in the party or proximity of the trigger. I setup an invisible man trigger at a location and setup his proximity. I couldn't only get one mob to spawn while in the proximity so I opt'd to use depop. Though the spawned npc was set to unique it still kept spawning the NPC if I moved in and out of the proximity.
Code:
sub EVENT_SPAWN{
quest::set_proximity($x-5,$x+5,$y-5,$y+5,$z-5,$z+5);
}
sub EVENT_ENTER{
if($class eq 'Ranger'){
quest::spawn2(303091,0,0,1309,652,388,130);
$npc->Depop();
}
}
Any suggestions? I am reading over $class checks and tried if($class eq 'Ranger') but that didn't work under EVENT_ENTER. Thanks in advance for the help.
EDIT - I missed the squiggley's, class check works.. When you use the right syntax...
Last edited by Greyhelm; 02-19-2015 at 10:04 PM..
Reason: add right syntax for class check spawn condition
|
|
|
|
|
|
|
02-19-2015, 10:00 PM
|
Hill Giant
|
|
Join Date: Jun 2010
Posts: 231
|
|
this is what I used
Code:
$ProxDist = 40;
sub EVENT_SPAWN {
$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
quest::set_proximity($x - $ProxDist, $x + $ProxDist, $y - $ProxDist, $y + $ProxDist, $z - $ProxDist, $z + $ProxDist);
quest::settimer("setprox", 2);
}
sub EVENT_TIMER {
if ($timer eq "setprox") {
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
quest::clear_proximity();
quest::set_proximity($x - $ProxDist, $x + $ProxDist, $y - $ProxDist, $y + $ProxDist, $z - $ProxDist, $z + $ProxDist);
}
}
sub EVENT_ENTER {
$client->Message(14,"You hear a voice as something emerges from the crystalline walls.");
quest::spawn2(999341,0,0,2312,1120,459,187);
}
sub EVENT_EXIT {
$client->Message(14,"The image shimmers and fades into the shadows...");
quest::depopall(999341);
}
Doesn't check for class, but im pretty sure you can add a class check in and it should work fine... ill dig around in a second and see if I can get it to work.
|
|
|
|
02-19-2015, 10:15 PM
|
|
Sarnak
|
|
Join Date: Jul 2009
Location: East Coast
Posts: 35
|
|
edited my post.. found it for class check.. I just didn't use the right syntax for class check. I didn't put the curly brackets. I am still learning things.. In your code once the timer is reached it clears the proximity you used to trigger the event, then resets it, then will depop once exiting the proximity?
|
|
|
|
02-19-2015, 10:48 PM
|
|
Dragon
|
|
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
|
|
Code:
sub EVENT_SPAWN {
plugin::SetProx(40,40);
quest::settimer("setprox", 2);
}
sub EVENT_TIMER {
quest::clear_proximity();
plugin::SetProx(40,40);
}
sub EVENT_ENTER {
$client->Message(14,"You hear a voice as something emerges from the crystalline walls.");
quest::spawn2(999341,0,0,2312,1120,459,187);
}
sub EVENT_EXIT {
$client->Message(14,"The image shimmers and fades into the shadows...");
quest::depopall(999341);
}
NPC spawns set proximity with 40 z y z axes range, clears after 2 seconds, then another proximity is set (every two seconds). Upon entering the proximity it will spawn npctype 999341 with no grid assigned, no guildwarset assigned, at coordinates 2312, 1120, 459 with a heading of 187. When the entity (that entered the proximity triggering that npc spawn) leaves the proximity it will depop all npc types of 999341. Made it as "efficient" as I would know how I think or atleast, less lines of code to be concerned with.
|
|
|
|
02-19-2015, 11:19 PM
|
Hill Giant
|
|
Join Date: Jun 2010
Posts: 231
|
|
Yes my timer is set for 2 seconds once proximity is left to depop the npc and Ghanja's code is way more cleaner than mine lol
|
02-19-2015, 11:36 PM
|
|
Dragon
|
|
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
|
|
Quote:
Originally Posted by Maceblade
Yes my timer is set for 2 seconds once proximity is left to depop the npc and Ghanja's code is way more cleaner than mine lol
|
Meh, it all works the same is what I say, so.. heh
Greyhelm, I see you were looking into timers.
The reason there is a lack of conditional, i.e.:
Code:
if ($timer eq "setprox") {
}
Is that that particular code of Mace's only has one timer being dealt with, which will call the EVENT_TIMER subroutine every "2 seconds", so there is no need to check what the timers name is.
In case you were wondering why it may have looked a little screwy.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 04:48 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|