PDA

View Full Version : Checking if a zone is an instance


Nibiuno
02-22-2015, 11:17 AM
How can I check if a zone is an instance version or not?

I did a check on quest::GetInstanceID in player.pl when a player enters the zone, but it doesnt work for 100% of cases. This works if the instance returned is greater than 0, but, the issue with that is if a player had an instance and left it, then enters the regular version of that zone before the instance expires, that check reports the instance number of the instance they left.

Is there an easy way to detect if a zone is an instance? I need to signal NPCs if it is, and dont want to if its the regular zone.

ghanja
02-22-2015, 12:15 PM
Destroy the instance when they leave the instanced zone. Or is that not an option?

You may need to also utilize a means (qglobal, etc.) of tracking HOW they entered the zone in combination with the other tools (GetInstanceID), and/or the pre-parsed variables $instanceid / $instanceversion.

Nibiuno
02-22-2015, 12:22 PM
Im not sure how to destroy the instance when they leave it, and differentiate between if they evacuated or got resurrected, or Id do that.

I guess I could set a quest global when the instance npc sends them to the instance thats destroyed when they enter, so its a one time flag to fire the script.

edit: Thank you for the idea - that worked.

Asylum
03-08-2015, 08:24 PM
Here is an instance generator/destroyer npc I use in gfaydark to generate level-appropriate instances of crushbone.


sub EVENT_SAY {
my $EnterInst = quest::saylink("Enter the Instance", 2);
my $Destroy = quest::saylink("destroy", 2);
my $worse = quest::saylink("worse", 2);
my $evil = quest::saylink("evil", 2);
my $InstId = quest::GetInstanceID("crushbone", $version);

if($text=~/hail/i){
quest::say("Thank Tunare you're here, $name! Something dreadful is taking place inside Crushbone. Yes, yes, I realize that the whole place is dreadful to begin with. But it's much [$worse] now.");
}
if($text=~/worse/i){
quest::say("Some new evil has moved in and set up shop, destroying everything inside. Where the Crushbone Orcs were destructive and chaotic, this new [$evil] is much more of a threat to all of Tunare's creatures.");
}
if($text=~/evil/i){
quest::say("If you are willing to assist us, I will need to ensure your safe passage. Just say when you are ready and I can open a portal enabling you to [$EnterInst]. Also, if you are done fighting, or wish to start over, I can [$Destroy] any old instances that may be lingering.");
}
if ($text =~/Enter the Instance/i) {
my $j;
for($j=2; $j<=4; $j++) {
my $version = $j;
my $InstId = quest::GetInstanceID("crushbone", $version);
if ($InstId > 0) {
quest::MovePCInstance(58, $InstId, 166, -586, 3.13);
}
elsif ((quest::GetInstanceID("crushbone", $ulevel + 1)) > 0) {
quest::MovePCInstance(58, quest::GetInstanceID("crushbone", $ulevel + 1), 166, -586, 3.13);
}
elsif ((quest::GetInstanceID("crushbone", $ulevel - 1)) > 0) {
quest::MovePCInstance(58, quest::GetInstanceID("crushbone", $ulevel - 1), 166, -586, 3.13);
}
elsif (($ulevel >= (($version * 10) - 9)) && ($ulevel <= ($version * 10))) {
my $i_id = quest::CreateInstance("crushbone", $version, 21600);
quest::AssignGroupToInstance($i_id);
quest::AssignToInstance($i_id);
quest::MovePCInstance(58, $i_id, 166, -586, 3.13);
}
}
}
if($text=~/destroy/i){
my $i;
for($i=0; $i<=6; $i++) {
quest::DestroyInstance(quest::GetInstanceID("crushbone", $i));
}
}
if ($text =~/Daria sent me/i) {
my $InstId = quest::GetInstanceID("crushbone", $version);
if ($InstId > 0) {
quest::MovePCInstance(58, $InstId, 166, -586, 3.13);
}
elsif ($ulevel >= 50 && (plugin::check_hasitemoncursor($client, 4621))) {
my $i_id = quest::CreateInstance("crushbone", 6, 21600);
quest::AssignGroupToInstance($i_id);
quest::AssignToInstance($i_id);
quest::MovePCInstance(58, $i_id, 166, -586, 3.13);
}
}
}