|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
Quests::Q&A This is the quest support section |

09-05-2010, 08:41 PM
|
Discordant
|
|
Join Date: Aug 2007
Posts: 307
|
|
I haven't talked to you in a while, plus figured I'd see what everyone thought about the instance thing, multiple opinions.
Half the code was from example that Trevius posted here, and half from your example as well.
Do these zones take up a dynamic zone? Users complaining they can't enter a new zone that isn't already booted.
|
 |
|
 |

09-07-2010, 01:53 PM
|
 |
Administrator
|
|
Join Date: Feb 2009
Location: MN
Posts: 2,072
|
|
Quote:
Originally Posted by thepoetwarrior
I haven't talked to you in a while, plus figured I'd see what everyone thought about the instance thing, multiple opinions.
Half the code was from example that Trevius posted here, and half from your example as well.
Do these zones take up a dynamic zone? Users complaining they can't enter a new zone that isn't already booted.
|
Yes, they take up a dynamic. Here is the script you are looking for, I haven't tested it but it should do what you want it to do. I cleaned up some parts of it and also added the ability to use the Waypoint credit system that I made for you as well, but not add to the NPC for credits.
You also were using objects that you made that were conflicting with the perl objects in the source. I made this just as flexible as you desired it to be before, and the qglobals and instances should not expire... Period.
You should be able to see the instances in your qglobals table up after they become populated by players, and will never go away unless you manually deleted them yourself. The qglobals get created and read by everyone for Instance 1 and 2 for all players.
Code:
sub EVENT_SAY {
my $Cx = $client->GetX();
my $Cy = $client->GetY();
my $Cz = $client->GetZ();
my $npc_name = $npc->GetCleanName();
my $Enter1Inst = quest::saylink("Enter Instance 1", 1);
my $Enter2Inst = quest::saylink("Enter Instance 2", 1);
my $Waypoint1Inst = quest::saylink("Waypoint Credit Instance 1", 1);
my $Waypoint2Inst = quest::saylink("Waypoint Credit Instance 2", 1);
my $ExitInst = quest::saylink("Exit Instance", 1);
my $accountname1 = $client->AccountName();
my $accountname = "<c \"#FBB117\">$accountname1</c>";
my $accountid = $client->AccountID();
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
if ($text =~/hail/i)
{
$client->Message(315, "$npc_name says, 'Please make a choice:'");
$client->Message(315, "..::[LDON Instance: $zonln]::..");
$client->Message(315, "[$Enter1Inst]");
$client->Message(315, "[$Enter2Inst]");
$client->Message(315, "[$ExitInst]");
} # End hail
if ($text =~/Enter Instance 1/i)
{
$client->Message(315, "$npc_name says, 'Give me 1000 platinum to enter $zonesn Instance Version (1)'");
$client->Message(315, "Or enter with [$Waypoint1Inst]");
} # End Instance 1
if ($text =~/Enter Instance 2/i)
{
$client->Message(315, "$npc_name says, 'Give me 2000 platinum to enter $zonesn Instance Version (2)'");
$client->Message(315, "Or enter with [$Waypoint2Inst]");
} # End Instance 2
if ($text =~ /^Exit Instance$/i)
{
$client->Message(315, " " );
$client->Message(315, "Moving player $name to a non-instance version of $zoneln.");
quest::movepc($zoneid, $Cx, $Cy, $Cz);
}
if ($text =~ /Waypoint Credit Instance 1/i){
my $InstanceCost = 1000; ###1,000 Entry Fee
if ($bankcredit < $InstanceCost)
{
$client->Message(315,"You need "
. ($InstanceCost - $bankcredit) . " more plat!");
}
else {
$bankcredit -= $InstanceCost;
quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
$client->Message(15, "[ACCOUNT BALANCE]: [$accountname] You now have $bankcredit platinum in [$accountname]");
$timestamp = localtime(time);
my $npc_name = $npc->GetCleanName();
my $accountname1 = $client->AccountName();
quest::write("InstanceLogs/Instance$zonesn.txt","[$timestamp] : $name the $class at $ulevel has used $InstanceCost on $npc_name for an instance, this player now has $bankcredit in his account: $accountname1.");
$client->Message(315, "$npc_name says, 'Checking Instance 1.'");
if (defined($qglobals{"Inst1$zonesn"}))
{
my $instance_1 = $qglobals{"Inst1$zonesn"};
quest::AssignToInstance($instance_1);
quest::MovePCInstance($zoneid, $instance_1, $Cx, $Cy, $Cz);
$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
}
else
{
$client->Message(315, "$npc_name says, 'No instances exist, creating one ...'");
my $instanceID = quest::CreateInstance("$zonesn", 0, 0);
quest::AssignToInstance($instanceID);
quest::setglobal("Inst1$zonesn",$instanceID, 7, 0);
quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
}
}
}
if ($text =~ /Waypoint Credit Instance 2/i){
my $InstanceCost = 2000; ###2,000 Entry Fee
if ($bankcredit < $InstanceCost)
{
$client->Message(315,"You need "
. ($InstanceCost - $bankcredit) . " more plat!");
}
else {
$bankcredit -= $InstanceCost;
quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
$client->Message(15, "[ACCOUNT BALANCE]: [$accountname] You now have $bankcredit platinum in [$accountname]");
$timestamp = localtime(time);
my $npc_name = $npc->GetCleanName();
my $accountname1 = $client->AccountName();
quest::write("InstanceLogs/Instance$zonesn.txt","[$timestamp] : $name the $class at $ulevel has used $InstanceCost on $npc_name for an instance, this player now has $bankcredit in his account: $accountname1.");
$client->Message(315, "$npc_name says, 'Checking Instance 2.'");
if (defined($qglobals{"Inst2$zonesn"}))
{
my $instance_2 = $qglobals{"Inst2$zonesn"};
quest::AssignToInstance($instance_2);
quest::MovePCInstance($zoneid, $instance_2, $Cx, $Cy, $Cz);
$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
}
else
{
$client->Message(315, "$npc_name says, 'No instances exist, creating one ...'");
my $instanceID = quest::CreateInstance("Inst2$zonesn", 0, 0);
quest::AssignToInstance($instanceID);
quest::setglobal("Inst2$zonesn", $instanceID, 7, 0);
quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
}
}
}
}
sub EVENT_ITEM
{
my $Cx = $client->GetX();
my $Cy = $client->GetY();
my $Cz = $client->GetZ();
my $npc_name = $npc->GetCleanName();
if ($platinum == 1000) # IF 1k+ plat for instance 2
{
$client->Message(315, "$npc_name says, 'Checking Instance 1.'");
if (defined($qglobals{"Inst1$zonesn"}))
{
my $instance_1 = $qglobals{"Inst1$zonesn"};
quest::AssignToInstance($instance_1);
quest::MovePCInstance($zoneid, $instance_1, $Cx, $Cy, $Cz);
$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
}
else
{
$client->Message(315, "$npc_name says, 'No instances exist, creating one ...'");
my $instanceID = quest::CreateInstance("$zonesn", 0, 0);
quest::AssignToInstance($instanceID);
quest::setglobal("Inst1$zonesn",$instanceID, 7, 0);
quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
}
} # End plat > 1000
elsif ($platinum == 2000) # IF 2k+ plat for instance 2
{
$client->Message(315, "$npc_name says, 'Checking Instance 2.'");
if (defined($qglobals{"Inst2$zonesn"}))
{
my $instance_2 = $qglobals{"Inst2$zonesn"};
quest::AssignToInstance($instance_2);
quest::MovePCInstance($zoneid, $instance_2, $Cx, $Cy, $Cz);
$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
}
else
{
$client->Message(315, "$npc_name says, 'No instances exist, creating one ...'");
my $instanceID = quest::CreateInstance("Inst2$zonesn", 0, 0);
quest::AssignToInstance($instanceID);
quest::setglobal("Inst2$zonesn", $instanceID, 7, 0);
quest::MovePCInstance($zoneid, $instanceID, $Cx, $Cy, $Cz);
$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
}
} # End plat > 2000
else # If not enough plat, return everything.
{
plugin::return_items(\%itemcount);
}
} # End sub EVENT_ITEM
Here's this too lol
Code:
UPDATE `items` SET `idfile` = 'IT166', `icon` = `588` WHERE NAME LIKE '%Sword of the Eternal Power Epic 4.0%';
|
 |
|
 |
 |
|
 |

09-08-2010, 11:56 PM
|
 |
Administrator
|
|
Join Date: Feb 2009
Location: MN
Posts: 2,072
|
|
Okay senior chief, this is tested and confirmed working between both instances across all zones...
Enjoy bro, if you need anything else let me know.
Code:
sub EVENT_SAY {
my $Cx = $client->GetX();
my $Cy = $client->GetY();
my $Cz = $client->GetZ();
my $npc_name = $npc->GetCleanName();
my $Enter1Inst = quest::saylink("Enter Instance 1", 1);
my $Enter2Inst = quest::saylink("Enter Instance 2", 1);
my $Waypoint1Inst = quest::saylink("Waypoint Credit Instance 1", 1);
my $Waypoint2Inst = quest::saylink("Waypoint Credit Instance 2", 1);
my $ExitInst = quest::saylink("Exit Instance", 1);
my $accountname = $client->AccountName();
my $accountid = $client->AccountID();
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
if ($text =~/hail/i)
{
$client->Message(315, "$npc_name says, 'Please make a choice:'");
$client->Message(315, "..::[LDON Instance: $zoneln]::..");
$client->Message(315, "[$Enter1Inst]");
$client->Message(315, "[$Enter2Inst]");
$client->Message(315, "[$ExitInst]");
} # End hail
if ($text =~/Enter Instance 1/i)
{
$client->Message(315, "$npc_name says, 'Give me 1000 platinum to enter [$zoneln] Instance Version (1)'");
$client->Message(315, "Or enter with [$Waypoint1Inst]");
} # End Instance 1
if ($text =~/Enter Instance 2/i)
{
$client->Message(315, "$npc_name says, 'Give me 2000 platinum to enter [$zoneln] Instance Version (2)'");
$client->Message(315, "Or enter with [$Waypoint2Inst]");
} # End Instance 2
if ($text =~ /^Exit Instance$/i)
{
$client->Message(315, " " );
$client->Message(315, "Moving player $name to a non-instance version of [$zoneln].");
quest::movepc($zoneid, $Cx, $Cy, $Cz);
}
if ($text =~ /Waypoint Credit Instance 1/i){
my $InstanceCost = 1000; ###1,000 Entry Fee
if ($bankcredit < $InstanceCost)
{
$client->Message(315,"You need "
. ($InstanceCost - $bankcredit) . " more plat!");
}
else {
$bankcredit -= $InstanceCost;
quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
$client->Message(15, "[ACCOUNT BALANCE]: [$name] You now have $bankcredit platinum in account: [$accountname]");
$timestamp = localtime(time);
my $npc_name = $npc->GetCleanName();
my $accountname1 = $client->AccountName();
quest::write("InstanceLogs/Instance$zonesn.txt","[$timestamp] : $name the $class at $ulevel has used $InstanceCost on $npc_name for an instance, this player now has $bankcredit in his account: $accountname1.");
$client->Message(315, "$npc_name says, 'Checking Instance 1.'");
if (defined($qglobals{"LDONInsta1$zonesn"})) { ### IF THERE IS AN INSTANCE ASSIGNED!
$LDONInst1 = $qglobals{"LDONInsta1$zonesn"};
quest::AssignToInstance($LDONInst1);
quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
}
else { ### IF THERE ISN'T AN INSTANCE ASSIGNED, ASSIGN IT!
$LDONInst1 = quest::CreateInstance("$zonesn", 0, 604800); ### Set to 7 day IN SECONDS
quest::AssignToInstance($LDONInst1);
quest::setglobal("LDONInsta1$zonesn",$LDONInst1,7,"D7"); ### Set to 7 day QGLOBAL
quest::write("InstanceLogs/LDONInst1$zonesn.txt","[$timestamp] : $name has created instance $zoneln");
quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
$client->Message(315, "$npc_name says, 'Instance not created, creating and moving you to [$zoneln Instance] (1) now.'");
}
}
}
if ($text =~ /Waypoint Credit Instance 2/i){
my $InstanceCost = 2000; ###2,000 Entry Fee
if ($bankcredit < $InstanceCost)
{
$client->Message(315,"You need "
. ($InstanceCost - $bankcredit) . " more plat!");
}
else {
$bankcredit -= $InstanceCost;
quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
$client->Message(15, "[ACCOUNT BALANCE]: [$accountname] You now have $bankcredit platinum in [$accountname]");
$timestamp = localtime(time);
my $npc_name = $npc->GetCleanName();
my $accountname1 = $client->AccountName();
quest::write("InstanceLogs/Instance$zonesn.txt","[$timestamp] : $name the $class at $ulevel has used $InstanceCost on $npc_name for an instance, this player now has $bankcredit in his account: $accountname1.");
$client->Message(315, "$npc_name says, 'Checking Instance 2.'");
if (defined($qglobals{"LDONInsta2$zonesn"})) { ### IF THERE IS AN INSTANCE ASSIGNED!
$LDONInst1 = $qglobals{"LDONInsta2$zonesn"};
quest::AssignToInstance($LDONInst1);
quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
}
else { ### IF THERE ISN'T AN INSTANCE ASSIGNED, ASSIGN IT!
$LDONInst1 = quest::CreateInstance("$zonesn", 0, 604800); ### Set to 7 day IN SECONDS
quest::AssignToInstance($LDONInst1);
quest::setglobal("LDONInsta2$zonesn",$LDONInst1,7,"D7"); ### Set to 7 day QGLOBAL
quest::write("InstanceLogs/LDONInst1$zonesn.txt","[$timestamp] : $name has created instance $zoneln");
quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
$client->Message(315, "$npc_name says, 'Instance not created, creating and moving you to [$zoneln Instance] (2) now.'");
}
}
}
}
sub EVENT_ITEM
{
my $Cx = $client->GetX();
my $Cy = $client->GetY();
my $Cz = $client->GetZ();
my $npc_name = $npc->GetCleanName();
if ($platinum == 1000) # IF 1k+ plat for instance 2
{
$client->Message(315, "$npc_name says, 'Checking Instance 1.'");
if (defined($qglobals{"LDONInsta1$zonesn"})) { ### IF THERE IS AN INSTANCE ASSIGNED!
$LDONInst1 = $qglobals{"LDONInsta1$zonesn"};
quest::AssignToInstance($LDONInst1);
quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (1) now.'");
}
else { ### IF THERE ISN'T AN INSTANCE ASSIGNED, ASSIGN IT!
$LDONInst1 = quest::CreateInstance("$zonesn", 0, 604800); ### Set to 7 day IN SECONDS
quest::AssignToInstance($LDONInst1);
quest::setglobal("LDONInsta1$zonesn",$LDONInst1,7,"D7"); ### Set to 7 day QGLOBAL
quest::write("InstanceLogs/LDONInst1$zonesn.txt","[$timestamp] : $name has created instance $zoneln");
quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
$client->Message(315, "$npc_name says, 'Instance not created, creating and moving you to [$zoneln Instance] (1) now.'");
}
}
} # End plat > 1000
elsif ($platinum == 2000) # IF 2k+ plat for instance 2
{
$client->Message(315, "$npc_name says, 'Checking Instance 2.'");
if (defined($qglobals{"LDONInsta2$zonesn"})) { ### IF THERE IS AN INSTANCE ASSIGNED!
$LDONInst1 = $qglobals{"LDONInsta2$zonesn"};
quest::AssignToInstance($LDONInst1);
quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
$client->Message(315, "$npc_name says, 'Moving you to [$zoneln Instance] (2) now.'");
}
else { ### IF THERE ISN'T AN INSTANCE ASSIGNED, ASSIGN IT!
$LDONInst1 = quest::CreateInstance("$zonesn", 0, 604800); ### Set to 7 day IN SECONDS
quest::AssignToInstance($LDONInst1);
quest::setglobal("LDONInsta2$zonesn",$LDONInst1,7,"D7"); ### Set to 7 day QGLOBAL
quest::write("InstanceLogs/LDONInst1$zonesn.txt","[$timestamp] : $name has created instance $zoneln");
quest::MovePCInstance($zoneid, $LDONInst1, $Cx, $Cy, $Cz); ### SENDS PLAYER TO SAME ZONE WITH SAME COORDS
$client->Message(315, "$npc_name says, 'Instance not created, creating and moving you to [$zoneln Instance] (2) now.'");
}
}
} # End plat > 2000
else # If not enough plat, return everything.
{
plugin::return_items(\%itemcount);
}
} # End sub EVENT_ITEM
|
 |
|
 |
Thread Tools |
|
Display Modes |
Hybrid Mode
|
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 10:54 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |