trevius
05-25-2008, 04:32 AM
I have been trying to get this issue fixed for some time on my server. It seems like an odd issue to me, but no matter what I try so far, it doesn't seem to resolve the issue.
So, the problem is with my new level 71 - 75 levels which are gained via quests. It seems that the globals of the character with the highest global gets saved in the quest somehow so that the next person who attempts the quests will get the global of the previous person without actually having done any of the work. I know that I have to set the global as undef and I think I have tried doing that in just about every way I can think of and all of them still have this weird effect.
The ranks of my globals are supposed to match the level of what the player should be for max level. So, even though players can only experience up to level 70, they can still quest for levels up to 75. I think have a couple of quests that I use these globals in to keep track of what max level the player should be. So, a player with a max_level global of 73 has earned up to level 73 via the quests.
Well, here is the main quest I am having an issue with. It is my delevel quest with added stuff for access to a special zone and also added stuff for the level 71+ levels. The important section in question is highlighted in red, but I am posting the whole thing incase it is needed to help resolve the issue.
#Quest to de-level a character temporarily in exchange For an item
#that can be turned in to return to level 70
sub EVENT_SAY {
if(($text=~/hail/i)&&($ulevel <= 69)) {
quest::say("Hello, $name, I have an interesting deal for you, but you must reach 70 seasons before I can make my offer. Please return to me when you reach level 70. If you are here to return my trinket, please do so and I will restore your experience."); }
if(($text=~/hail/i)&&($ulevel >= 70)) {
quest::say("Hello, $name, I can lower your [level] temporarily if you would like. It is useful if you have friends that are lower level and would like to group with them, but don't want to make a new character and start over. If your friends are level 51+, you can group with them and work on AAs that will carry over when you return to level 70."); }
if(($text=~/level/i)&&($ulevel >= 70)) {
quest::say("The way it works is I take your experience from you and give you a trinket in exchange. When you are ready to go back to level 70 again, simply turn in the trinket to me and I will return your experience. Would you like to know the level [ranges] I can set you to? I can also tell you about some [issues] you may encounter when you lower your level."); }
if(($text=~/ranges/i)&&($ulevel >= 70)) {
quest::say("I can set you to level [70], [65], [60], [55], [52], [51], [50], [45], [40], [35], [30], [25], [20], [15], [10], [5], or all of the way back to level [1]. Just let me know which level you would like to return to."); }
if(($text=~/70/i)&&($ulevel >= 71)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(70);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/65/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(65);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/60/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(60);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/55/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(55);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/52/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(52);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/51/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(51);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/50/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(50);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/45/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(45);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/40/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(40);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/35/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(35);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/30/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(30);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/25/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(25);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/20/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(20);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/15/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(15);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/10/i)&&($ulevel >= 70)){
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(10);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/^5$/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(5);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/^1$/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(1);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/dragons/i)&&($ulevel >= 53)) {
$client->Message(0, "Rayna Levya whispers to you, Oh, so it is the great dragons you seek? Well, you can't likely fight them like that! They refuse to fight anyone who is too much of a threat and will [banish] you if you try.") }
if(($text=~/banish/i)&&($ulevel >= 53)) {
$client->Message(0, "Rayna Levya whispers to you, If you absolutely must battle the dragons, I can assist you by stealing your experience and returning you to level [52]. You can get the experience back from me whenever you like by returning the item I give you. Ask about the dragons again when you are the right level.") }
if(($text=~/dragons/i)&&($ulevel <= 52)) {
$client->Message(0, "Rayna Levya whispers to you, There! Now you are ready to travel to their [dungeons] whenever you wish. I can also tell you more about some [issues] with your new level as well.") }
if(($text=~/dungeons/i)&&($ulevel <= 52)) {
$client->Message(0, "Rayna Levya whispers to you, There are 2 great dragons that you should seek in this epic quest, and when you are ready, just ask to be sent to either the dungeon of [fire] or the dungeon of [ice].") }
if($text=~/issues/i) {
quest::say("The main issue is that any item above your level will show you as giving the proper stats, but they are lying. You gain no stats from items above your level and monsters are invulnerable to all attacks by weapons above your level. So, you will want to use a set of equipment and weapons that are useable at the level you currently are. Do you want to hear the [other] issue?"); }
if($text=~/other/i) {
quest::say("The other issues is that once you are returned to level 70, you will have lost any previous experience gained into that level and have to regain it again the hard way."); }
if ($text =~/fire/i) {
quest::say ("Good luck on your fight!");
$client->Message(6, "Rayna Levya creates a small ball of fire in her hands and you can feel your temperature rise as everything fades to black.");
quest::movepc(32, -824.1,-1273.2,86.2); }
if ($text =~/ice/i) {
quest::say ("Off ya go!");
$client->Message(6, "Rayna Levya starts breathing heavily and you begin to see the frost of her breath and then only darkness.");
quest::movepc(73, -32.1,1019,3.1); }
$temp_level=undef;
}
sub EVENT_ITEM {
if (plugin::check_handin(\%itemcount, 1659 => 1)){
if ($max_level == 71) {
quest::say("Looks like you took good care of it! Here are your levels back.");
$client->Message(6, "Rayna Levya casts a spell and you instantly feel more powerful! The rush makes you feel like you could take on anything in battle!");
quest::level(71);
quest::setglobal("temp_level", 2, 5, "F"); }
if ($max_level == 72) {
quest::say("Looks like you took good care of it! Here are your levels back.");
$client->Message(6, "Rayna Levya casts a spell and you instantly feel more powerful! The rush makes you feel like you could take on anything in battle!");
quest::level(72);
quest::setglobal("temp_level", 2, 5, "F"); }
if ($max_level == 73) {
quest::say("Looks like you took good care of it! Here are your levels back.");
$client->Message(6, "Rayna Levya casts a spell and you instantly feel more powerful! The rush makes you feel like you could take on anything in battle!");
quest::level(73);
quest::setglobal("temp_level", 2, 5, "F"); }
if ($max_level == 74) {
quest::say("Looks like you took good care of it! Here are your levels back.");
$client->Message(6, "Rayna Levya casts a spell and you instantly feel more powerful! The rush makes you feel like you could take on anything in battle!");
quest::level(74);
quest::setglobal("temp_level", 2, 5, "F"); }
if ($max_level == 75) {
quest::say("Looks like you took good care of it! Here are your levels back.");
$client->Message(6, "Rayna Levya casts a spell and you instantly feel more powerful! The rush makes you feel like you could take on anything in battle!");
quest::level(75);
quest::setglobal("temp_level", 2, 5, "F"); }
if ($max_level == undef) {
quest::say("Looks like you took good care of it! Here are your levels back.");
$client->Message(6, "Rayna Levya casts a spell and you instantly feel more powerful! The rush makes you feel like you could take on anything in battle!");
quest::level(70);
quest::setglobal("temp_level", 2, 5, "F"); }
$max_level=undef;
}
else {
plugin::return_items(\%itemcount);
quest::say("I have no use for this item, $name. Take it back.");
}
}
The problem here is that if a person who has earned level 75 uses this NPC to delevel and then level back up, the NPC will store the level 75 as the level to return all players to. So, any level 70 can delevel and turn in the item and instantly be 75. You can see where this would be annoying to me and my players... The odd thing is that if at that point they use the delevel quest again and turn the item in again, it will return them to their normal level that they should be according to their max_level global rank, which as a level 70 they would have none, so it would be undef.
I just can't figure out why it would send everyone back to a higher level even though it should have set the max_level global as undefined.
If I have to, I would be willing to depop and repop this NPC. Whatever it takes to get this quest working without the stupid bugs.
Also, here is my main quest leveling quest which is having a related problem:
sub EVENT_SAY {
if($text=~/hail/i)
{
quest::say("Hello, $name. I am a card collector and am willing to trade my personal experience for cards. If you have [minor], [godly] or the normal [card] of experience, I may be able to make a trade with you. I can also [return] your level if you have the correct status with me.");
}
if (($text =~/minor/i)&&($ulevel <= 44))
{
quest::say ("You must gain more experience before you can turn in this type of card to me. I hear they are attained in the Plane of Earth B.");
}
if (($text =~/minor/i)&&($ulevel >= 45))
{
quest::say ("If you happen to come across any Cards of Minor Experience, please bring them to me and I will kindly reward you. I am creating a collection and can always use more. Make sure to hand them to me unstacked. I hear they are attained in the Plane of Earth B.");
}
if (($text =~/card/i)&&($ulevel <= 64))
{
quest::say ("You must gain more experience before you can turn in this type of card to me. I hear they are attained in the Plane of Valor.");
}
if (($text =~/card/i)&&($ulevel >= 65))
{
quest::say ("If you happen to come across any Cards of Experience, please bring them to me and I will kindly reward you. I am creating a collection and can always use more. Make sure to hand them to me unstacked. You must be 65+ for me to reward you for these cards.");
}
if (($text =~/godly/i)&&($ulevel <= 69))
{
quest::say ("You must gain more experience before you can turn in this type of card to me. I hear they are attained in the Tower of Solusek Ro.");
}
if (($text =~/godly/i)&&($ulevel >= 70))
{
quest::say ("If you happen to come across any Cards of Godly Experience, please give 4 of them to me at once and I will kindly reward you. I hear they are attained in the Tower of Solusek Ro. Make sure to hand them to me unstacked.");
}
if (($text =~/return/i)&&($ulevel <= 69))
{
quest::say ("You must be at least level 70 for me to provide this service to you! Return when you have gained more experience.");
}
if (($text =~/return/i)&&($ulevel >= 70)) {
if ($max_level == 71) {
quest::say("You are now set back to your previous maximum level.");
quest::level(71); }
if ($max_level == 72) {
quest::say("You are now set back to your previous maximum level.");
quest::level(72); }
if ($max_level == 73) {
quest::say("You are now set back to your previous maximum level.");
quest::level(73); }
if ($max_level == 74) {
quest::say("You are now set back to your previous maximum level.");
quest::level(74); }
if ($max_level == 75) {
quest::say("You are now set back to your previous maximum level.");
quest::level(75); }
if ($max_level == undef){
quest::say("You are already at your current maximum level."); }
$max_level=undef;
}
}
sub EVENT_ITEM {
if ((plugin::check_handin(\%itemcount, 2275=>1))&&($ulevel >= 65)){
quest::say("I am always looking for more for my collection.");
$client->Message(6, "Maximus Serilious rewards you with experience." );
quest::exp(9999999); }
if ((plugin::check_handin(\%itemcount, 2834=>1))&&($ulevel >= 45)){
quest::say("I am always looking for more for my collection.");
$client->Message(6, "Maximus Serilious rewards you with experience." );
quest::exp(2000000); }
if (plugin::check_handin(\%itemcount, 2835=>4)) {
if ($max_level == 71) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 72, 5, "F");
quest::level(72); }
if ($max_level == 72) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 73, 5, "F");
quest::level(73); }
if ($max_level == 73) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 74, 5, "F");
quest::level(74); }
if ($max_level == 74) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
$client->Message(15, "You have reached the max level! Repeating this quest will give no further rewards!" );
quest::exp(9999999);
quest::setglobal("max_level", 75, 5, "F");
quest::level(75); }
if ($max_level == 75) {
quest::say("You have already reached the max level. I can no longer reward you for the Cards of Godly Experience. But if you want to give them to me anyway, I will take them for free. Ha ha ha!");
quest::level(75); }
if ($max_level == undef) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 71, 5, "F");
quest::level(71); }
$max_level=undef;
}
else {
plugin::return_items(\%itemcount);
}
}
This quest will remember the global reward of the last person to turn in the 4 items. So, if the last person was level 75, then anyone who turns in the 4 items will become 75, even if they were just level 70 and should have become 71.
So, the problem is with my new level 71 - 75 levels which are gained via quests. It seems that the globals of the character with the highest global gets saved in the quest somehow so that the next person who attempts the quests will get the global of the previous person without actually having done any of the work. I know that I have to set the global as undef and I think I have tried doing that in just about every way I can think of and all of them still have this weird effect.
The ranks of my globals are supposed to match the level of what the player should be for max level. So, even though players can only experience up to level 70, they can still quest for levels up to 75. I think have a couple of quests that I use these globals in to keep track of what max level the player should be. So, a player with a max_level global of 73 has earned up to level 73 via the quests.
Well, here is the main quest I am having an issue with. It is my delevel quest with added stuff for access to a special zone and also added stuff for the level 71+ levels. The important section in question is highlighted in red, but I am posting the whole thing incase it is needed to help resolve the issue.
#Quest to de-level a character temporarily in exchange For an item
#that can be turned in to return to level 70
sub EVENT_SAY {
if(($text=~/hail/i)&&($ulevel <= 69)) {
quest::say("Hello, $name, I have an interesting deal for you, but you must reach 70 seasons before I can make my offer. Please return to me when you reach level 70. If you are here to return my trinket, please do so and I will restore your experience."); }
if(($text=~/hail/i)&&($ulevel >= 70)) {
quest::say("Hello, $name, I can lower your [level] temporarily if you would like. It is useful if you have friends that are lower level and would like to group with them, but don't want to make a new character and start over. If your friends are level 51+, you can group with them and work on AAs that will carry over when you return to level 70."); }
if(($text=~/level/i)&&($ulevel >= 70)) {
quest::say("The way it works is I take your experience from you and give you a trinket in exchange. When you are ready to go back to level 70 again, simply turn in the trinket to me and I will return your experience. Would you like to know the level [ranges] I can set you to? I can also tell you about some [issues] you may encounter when you lower your level."); }
if(($text=~/ranges/i)&&($ulevel >= 70)) {
quest::say("I can set you to level [70], [65], [60], [55], [52], [51], [50], [45], [40], [35], [30], [25], [20], [15], [10], [5], or all of the way back to level [1]. Just let me know which level you would like to return to."); }
if(($text=~/70/i)&&($ulevel >= 71)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(70);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/65/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(65);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/60/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(60);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/55/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(55);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/52/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(52);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/51/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(51);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/50/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(50);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/45/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(45);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/40/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(40);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/35/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(35);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/30/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(30);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/25/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(25);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/20/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(20);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/15/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(15);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/10/i)&&($ulevel >= 70)){
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(10);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/^5$/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(5);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/^1$/i)&&($ulevel >= 70)) {
quest::say("Here you go! Remember, DO NOT lose that trinket! You will need it to turn into me when you want to restore your level back to 70. If you lose it, you will have to level up the normal way all over again!");
$client->Message(6, "Rayna Levya casts a spell and before you know it, you feel young and vibrant again. The world suddenly seems much larger and more intimidating!");
quest::summonitem(1659);
quest::level(1);
quest::selfcast(331);
quest::setglobal("temp_level", 1, 5, "F"); }
if(($text=~/dragons/i)&&($ulevel >= 53)) {
$client->Message(0, "Rayna Levya whispers to you, Oh, so it is the great dragons you seek? Well, you can't likely fight them like that! They refuse to fight anyone who is too much of a threat and will [banish] you if you try.") }
if(($text=~/banish/i)&&($ulevel >= 53)) {
$client->Message(0, "Rayna Levya whispers to you, If you absolutely must battle the dragons, I can assist you by stealing your experience and returning you to level [52]. You can get the experience back from me whenever you like by returning the item I give you. Ask about the dragons again when you are the right level.") }
if(($text=~/dragons/i)&&($ulevel <= 52)) {
$client->Message(0, "Rayna Levya whispers to you, There! Now you are ready to travel to their [dungeons] whenever you wish. I can also tell you more about some [issues] with your new level as well.") }
if(($text=~/dungeons/i)&&($ulevel <= 52)) {
$client->Message(0, "Rayna Levya whispers to you, There are 2 great dragons that you should seek in this epic quest, and when you are ready, just ask to be sent to either the dungeon of [fire] or the dungeon of [ice].") }
if($text=~/issues/i) {
quest::say("The main issue is that any item above your level will show you as giving the proper stats, but they are lying. You gain no stats from items above your level and monsters are invulnerable to all attacks by weapons above your level. So, you will want to use a set of equipment and weapons that are useable at the level you currently are. Do you want to hear the [other] issue?"); }
if($text=~/other/i) {
quest::say("The other issues is that once you are returned to level 70, you will have lost any previous experience gained into that level and have to regain it again the hard way."); }
if ($text =~/fire/i) {
quest::say ("Good luck on your fight!");
$client->Message(6, "Rayna Levya creates a small ball of fire in her hands and you can feel your temperature rise as everything fades to black.");
quest::movepc(32, -824.1,-1273.2,86.2); }
if ($text =~/ice/i) {
quest::say ("Off ya go!");
$client->Message(6, "Rayna Levya starts breathing heavily and you begin to see the frost of her breath and then only darkness.");
quest::movepc(73, -32.1,1019,3.1); }
$temp_level=undef;
}
sub EVENT_ITEM {
if (plugin::check_handin(\%itemcount, 1659 => 1)){
if ($max_level == 71) {
quest::say("Looks like you took good care of it! Here are your levels back.");
$client->Message(6, "Rayna Levya casts a spell and you instantly feel more powerful! The rush makes you feel like you could take on anything in battle!");
quest::level(71);
quest::setglobal("temp_level", 2, 5, "F"); }
if ($max_level == 72) {
quest::say("Looks like you took good care of it! Here are your levels back.");
$client->Message(6, "Rayna Levya casts a spell and you instantly feel more powerful! The rush makes you feel like you could take on anything in battle!");
quest::level(72);
quest::setglobal("temp_level", 2, 5, "F"); }
if ($max_level == 73) {
quest::say("Looks like you took good care of it! Here are your levels back.");
$client->Message(6, "Rayna Levya casts a spell and you instantly feel more powerful! The rush makes you feel like you could take on anything in battle!");
quest::level(73);
quest::setglobal("temp_level", 2, 5, "F"); }
if ($max_level == 74) {
quest::say("Looks like you took good care of it! Here are your levels back.");
$client->Message(6, "Rayna Levya casts a spell and you instantly feel more powerful! The rush makes you feel like you could take on anything in battle!");
quest::level(74);
quest::setglobal("temp_level", 2, 5, "F"); }
if ($max_level == 75) {
quest::say("Looks like you took good care of it! Here are your levels back.");
$client->Message(6, "Rayna Levya casts a spell and you instantly feel more powerful! The rush makes you feel like you could take on anything in battle!");
quest::level(75);
quest::setglobal("temp_level", 2, 5, "F"); }
if ($max_level == undef) {
quest::say("Looks like you took good care of it! Here are your levels back.");
$client->Message(6, "Rayna Levya casts a spell and you instantly feel more powerful! The rush makes you feel like you could take on anything in battle!");
quest::level(70);
quest::setglobal("temp_level", 2, 5, "F"); }
$max_level=undef;
}
else {
plugin::return_items(\%itemcount);
quest::say("I have no use for this item, $name. Take it back.");
}
}
The problem here is that if a person who has earned level 75 uses this NPC to delevel and then level back up, the NPC will store the level 75 as the level to return all players to. So, any level 70 can delevel and turn in the item and instantly be 75. You can see where this would be annoying to me and my players... The odd thing is that if at that point they use the delevel quest again and turn the item in again, it will return them to their normal level that they should be according to their max_level global rank, which as a level 70 they would have none, so it would be undef.
I just can't figure out why it would send everyone back to a higher level even though it should have set the max_level global as undefined.
If I have to, I would be willing to depop and repop this NPC. Whatever it takes to get this quest working without the stupid bugs.
Also, here is my main quest leveling quest which is having a related problem:
sub EVENT_SAY {
if($text=~/hail/i)
{
quest::say("Hello, $name. I am a card collector and am willing to trade my personal experience for cards. If you have [minor], [godly] or the normal [card] of experience, I may be able to make a trade with you. I can also [return] your level if you have the correct status with me.");
}
if (($text =~/minor/i)&&($ulevel <= 44))
{
quest::say ("You must gain more experience before you can turn in this type of card to me. I hear they are attained in the Plane of Earth B.");
}
if (($text =~/minor/i)&&($ulevel >= 45))
{
quest::say ("If you happen to come across any Cards of Minor Experience, please bring them to me and I will kindly reward you. I am creating a collection and can always use more. Make sure to hand them to me unstacked. I hear they are attained in the Plane of Earth B.");
}
if (($text =~/card/i)&&($ulevel <= 64))
{
quest::say ("You must gain more experience before you can turn in this type of card to me. I hear they are attained in the Plane of Valor.");
}
if (($text =~/card/i)&&($ulevel >= 65))
{
quest::say ("If you happen to come across any Cards of Experience, please bring them to me and I will kindly reward you. I am creating a collection and can always use more. Make sure to hand them to me unstacked. You must be 65+ for me to reward you for these cards.");
}
if (($text =~/godly/i)&&($ulevel <= 69))
{
quest::say ("You must gain more experience before you can turn in this type of card to me. I hear they are attained in the Tower of Solusek Ro.");
}
if (($text =~/godly/i)&&($ulevel >= 70))
{
quest::say ("If you happen to come across any Cards of Godly Experience, please give 4 of them to me at once and I will kindly reward you. I hear they are attained in the Tower of Solusek Ro. Make sure to hand them to me unstacked.");
}
if (($text =~/return/i)&&($ulevel <= 69))
{
quest::say ("You must be at least level 70 for me to provide this service to you! Return when you have gained more experience.");
}
if (($text =~/return/i)&&($ulevel >= 70)) {
if ($max_level == 71) {
quest::say("You are now set back to your previous maximum level.");
quest::level(71); }
if ($max_level == 72) {
quest::say("You are now set back to your previous maximum level.");
quest::level(72); }
if ($max_level == 73) {
quest::say("You are now set back to your previous maximum level.");
quest::level(73); }
if ($max_level == 74) {
quest::say("You are now set back to your previous maximum level.");
quest::level(74); }
if ($max_level == 75) {
quest::say("You are now set back to your previous maximum level.");
quest::level(75); }
if ($max_level == undef){
quest::say("You are already at your current maximum level."); }
$max_level=undef;
}
}
sub EVENT_ITEM {
if ((plugin::check_handin(\%itemcount, 2275=>1))&&($ulevel >= 65)){
quest::say("I am always looking for more for my collection.");
$client->Message(6, "Maximus Serilious rewards you with experience." );
quest::exp(9999999); }
if ((plugin::check_handin(\%itemcount, 2834=>1))&&($ulevel >= 45)){
quest::say("I am always looking for more for my collection.");
$client->Message(6, "Maximus Serilious rewards you with experience." );
quest::exp(2000000); }
if (plugin::check_handin(\%itemcount, 2835=>4)) {
if ($max_level == 71) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 72, 5, "F");
quest::level(72); }
if ($max_level == 72) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 73, 5, "F");
quest::level(73); }
if ($max_level == 73) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 74, 5, "F");
quest::level(74); }
if ($max_level == 74) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
$client->Message(15, "You have reached the max level! Repeating this quest will give no further rewards!" );
quest::exp(9999999);
quest::setglobal("max_level", 75, 5, "F");
quest::level(75); }
if ($max_level == 75) {
quest::say("You have already reached the max level. I can no longer reward you for the Cards of Godly Experience. But if you want to give them to me anyway, I will take them for free. Ha ha ha!");
quest::level(75); }
if ($max_level == undef) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 71, 5, "F");
quest::level(71); }
$max_level=undef;
}
else {
plugin::return_items(\%itemcount);
}
}
This quest will remember the global reward of the last person to turn in the 4 items. So, if the last person was level 75, then anyone who turns in the 4 items will become 75, even if they were just level 70 and should have become 71.