EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::Linux Servers (https://www.eqemulator.org/forums/forumdisplay.php?f=588)
-   -   Guide to creating instanced zones? (https://www.eqemulator.org/forums/showthread.php?t=32470)

Templus 11-12-2010 04:46 PM

Guide to creating instanced zones?
 
Where can I find some kind of a guide for creating / working with zone instances? I can't seem to find anything about that :(

Thanks :D

Templus 11-14-2010 12:46 AM

Found out basic instancing techniques.. here's how I'm doing it:
Code:

my $instanceID = quest::CreateInstance("freportn", $charid, 6400);
quest::AssignToInstance($instanceID);
quest::MovePCInstance(8, $instanceID, 277, -162, 18);

However it seems that the zone that my character enters has no NPCs spawned and any buffs I cast only last 3 minutes.. seems buggy.. not sure what's going on ;\

songie 11-14-2010 01:38 AM

This is more or less what we use on EQ-Heroes for our instancing, i deleted some parts that use custom code that you can't use but it should show a bit how they work, it should also just work fine but havent tested it in this format. It also uses a credit system, feel free to to use it, i know i had to look around for it and reverse engineer some scripts to get one to work a while ago :) GL

Code:

# Instance NPC

sub EVENT_SPAWN
{
        ### DATA ###
        $NPCName                = $npc->GetCleanName();
        ############
}

sub EVENT_SAY
{
        my $answer1 = quest::saylink("Create your instance", 1); #Multiple Choice Answer 1 go in here
        my $answer3 = quest::saylink("Purchase more instance credits", 1); #Multiple Choice Answer 3 go in here
        my $answer6 = quest::saylink("Destroy my previous instance", 1);
       
        ### Instances ###
        my @SoloZonelist =
                                (
                                        "Befallen",
                                        "Crushbone",
                                        "Runnyeye Citadel",
                                        "Najena",
                                        "Upperguk",
                                        "Estate of Unrest",
                                        "Solusek A",
                                        "Solusek B",
                                        "The Hole",
                                        "Castle Mistmoore",
                                        "Permafrost Caverns",
                                        "Cazic Thule"
                                );
       
        if ($text =~/hail/i)
        {
                if (defined($globals{"Instance_CR"}) && $globals{"Instance_CR"} == 0)       
                {       
                        if(!defined($qglobals{"Daily_Credit"}))
                        {
                                quest::setglobal("Instance_CR","3","5","F");       
                                quest::setglobal("Daily_Credit","1","5","H24");
                        }
                }
       
                if (!defined($qglobals{"Instance_CR"}))        {        quest::setglobal("Instance_CR","30","5", "F");        }
                my $Instance_cr = $qglobals{"Instance_CR"};                #Player total instance Credit
                $client->Message(7, "-----------");
                $client->Message(14,"$NPCName says: Hi there friend, You wish to construct another instance for training purposes? I can help! Let me see...");
                $client->Message(15,"--Choices--");
                $client->Message(14,"$name says: $answer1 ");
                $client->Message(14,"$name says: $answer3 ");
                $client->Message(7, "-----------");
                $client->Message(14,"$name says: $answer6 ");
                $client->Message(14,"Info: You have currently have $Instance_cr Credits, please note that you recieve 3 instance credits daily for free if you happen to have 0 credit!.");
                $client->Message(7, "-----------");
        }
       
        if ($text =~/\bdestroy my previous instance\b/i) #is used to destroy a solo or group instance
        {
                quest::delglobal("Instance_Number");
                my $QGlobalValue = undef;
                my $instanceID = undef;
                $client->Message(14,"Done!");
        }
       
        elsif($text=~/\bCreate your instance\b/i)       
        {
                my $count = 1;
                my $n = 0;

                while ($SoloZonelist[$n])
                {
                        if ($SoloZonelist[$n])
                        {
                                my $ZoneName = quest::saylink($SoloZonelist[$n]);
                                $client->Message(315, "$NPCName says: Go to $ZoneName");
                        }
                        $n++;
                        $count++;
                }
        }
       
        elsif($text=~/\bPurchase more instance credits\b/i)       
        {
                $client->Message(14,"For 100pp i will give you 10 Instance Credits.");
        }
       
        elsif ($text=~/\bBefallen\b/i)                                {        @Data = undef;        @Data = ("befallen", 36, 35.22, -75.27, 2.19);                GoToInstance();        }
        elsif ($text=~/\bCrushbone\b/i)                                {        @Data = undef;        @Data = ("crushbone", 58, 158, -644, 4);                        GoToInstance();        }
        elsif ($text=~/\bRunnyeye Citadel\b/i)                {        @Data = undef;        @Data = ("runnyeye", 11, -21.85, -108.88, 3.75);        GoToInstance();        }
        elsif ($text=~/\bNajena\b/i)                                {        @Data = undef;        @Data = ("najena", 44, -22.6, 229.1, -41.8);                GoToInstance();        }
        elsif ($text=~/\bUpperguk\b/i)                                {        @Data = undef;        @Data = ("guktop", 65, 7, -36, 4);                                        GoToInstance();        }
        elsif ($text=~/\bEstate of Unrest\b/i)                {        @Data = undef;        @Data = ("unrest", 63, 52, -38, 3.75);                                GoToInstance();        }
        elsif ($text=~/\bSolusek A\b/i)                                {        @Data = undef;        @Data = ("soldunga", 31, -485.77, -476.04, 73.72);        GoToInstance();        }
        elsif ($text=~/\bSolusek B\b/i)                                {        @Data = undef;        @Data = ("soldungb", 32, -262.7, -423.99, -108.22);        GoToInstance();        }
        elsif ($text=~/\bThe Hole\b/i)                                {        @Data = undef;        @Data = ("hole", 39, -1049.98, 640.04, -77.22);                GoToInstance();        }
        elsif ($text=~/\bCastle Mistmoore\b/i)                {        @Data = undef;        @Data = ("mistmoore", 59, 123, -295, -177);                        GoToInstance();        }
        elsif ($text=~/\bPermafrost Caverns\b/i)        {        @Data = undef;        @Data = ("permafrost", 73, 0, 0, 3.75);                                GoToInstance();        }
        elsif ($text=~/\bCazic Thule\b/i)                        {        @Data = undef;        @Data = ("cazicthule", 48, -80, 80, 5.5);                        GoToInstance();        }
}

sub GoToInstance
{
        my $limit = $qglobals{"Instance_CR"};

        if ($limit)
        {
                if ($limit > 0)
                {
                        if (defined($qglobals{"Instance_Number"}))
                        {
                                quest::say("Instance found now moving you to the instance!");
                                my $instanceID = $qglobals{"Instance_Number"};
                                quest::AssignToInstance($instanceID);
                                quest::MovePCInstance($Data[1], $instanceID, $Data[2],$Data[3],$Data[4]);
                        }
                        else
                        {
                                $client->Message(14,"No instance existed, so creating one");
                                quest::setglobal("Instance_CR", $qglobals{"Instance_CR"}-1, 5,"F");
                                my $instanceID = quest::CreateInstance($Data[0], 0, -1);
                                quest::setglobal("Instance_Number",$instanceID,5,"H20");
                                quest::AssignToInstance($instanceID);
                                quest::MovePCInstance($Data[1], $instanceID, $Data[2],$Data[3],$Data[4]);
                        }
                }
                else
                {
                        $client->Message(14, "You have no more credit in your account!");
                }       
        }
}

sub EVENT_ITEM
{
        if($platinum == 100)
        {
                my $Instance_cr = $qglobals{"Instance_CR"};
                quest::setglobal("Instance_CR", $qglobals{"Instance_CR"}+10, 5, "F");
                $client->Message(14,"$NPCName says: 10 instance credits have been added to your account.");
                $client->Message(14,"Info: You have currently have $Instance_cr Credits.");
                quest::write("$NPCName.txt","Playername: $name , has payed 100pp for 10 Credits");        }
        }
}


Templus 11-14-2010 11:01 AM

Cool. Thank you :)

I still can't seem to find out why my instance has no NPCs and buffs that last only 3 minutes .. perhaps I need to find some kind of a database update...

Templus 11-14-2010 12:23 PM

..... Went and got pretty much every database update and now I can't login to my server anymore =\\\ ....

starting from scratch again ..... =\

Still would like to get this instance bug resolved (without my attempts that cause my server to crash) =\

Templus 11-14-2010 02:56 PM

Ok I see now.. I fixed the issue with there being no spawns.. (basically I figured out what that variable meant in createzone)

here's the new code:
Code:

my $instanceID = quest::CreateInstance("freportn", 0, 6400);
quest::AssignToInstance($instanceID);
quest::MovePCInstance(8, $instanceID, 277, -162, 18);

I'm still however having problems with buffs that I cast only lasting 3 minutes ...


All times are GMT -4. The time now is 10:37 AM.

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