View Single Post
  #1  
Old 07-26-2013, 10:26 AM
jshows1
Sarnak
 
Join Date: Jun 2009
Location: Baton Rouge,LA
Posts: 79
Default Dynamic instancing by level range

This community has been overwhelmingly helpful in assisting me with getting my server up and running. When I first started I had a plethora of questions (will have more I'm sure!) But you guys have been patient and extremely positive.

Now it's time for me to give back to the community. A friend and I have been trying to find a way to create instances that would change level ranges based on the quest requestor's level. Yes this is similar to what LDON's do. With this PL file, however, you canmodify it to make instances of any zone.

In my example below, we've used Crushbone. With this, all you would have to do is populate each version of the instance with the appropriate level of mobs. This, of course, can be any range you want. You determine.

I apologize if this is not as neat as some PL files. We've just recently begun to learn how PL files work and most of the ones we've made have been simply trial nad error to see what works. So it may not be as neat as some, but it works perfectly.

Code:
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 Castle 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.  The new evil inside Crushbone has not yet reached our dimension.  However, he has infilftrated alternate diminsions.  If we can defeat him in these other planes of existence, perhaps we can prevent him from finding our current diminsion.  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=1; $j<=6; $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);
		}
		else {
		}
		}
	}
	if($text=~/destroy/i){
		my $i;
		for($i=0; $i<=6; $i++) {
			quest::DestroyInstance(quest::GetInstanceID("crushbone", $i));
		}
	}
}
We also had to find a way to have the player zone back out of the instance. For this, there may be a better way, but we created an NPC that acts like a zone line. Below is his PL file. Basically we put an NPC where we want the zone line, changed him to an invisible man, made his name ___ so it does not show up, and simply made him untargetable and made it to where players can't aggro or damage him. Again, there may be an easier way, but this works perfectly for us.

Code:
sub EVENT_SPAWN {
	$x = $npc->GetX();
	$y = $npc->GetY();
	quest::set_proximity($x - 70, $x + 70, $y - 70, $y + 70);
}

sub EVENT_ENTER {
	$client->Message(315, "Greater Faydark");
	quest::movepc(54,-56.33,2552.77,18.97,125);
}

sub EVENT_EXIT {
	quest::set_proximity($x - 70, $x + 70, $y - 70, $y + 70);
}
If anyone has any questions, I'd be more than happy to answer them. Again, thank you guys kindly for helping me get started. I hope this can help even a few people.
Reply With Quote