PDA

View Full Version : Deleveling npc


Dabloon
02-12-2013, 08:26 PM
Is it possible to have an npc reset your level to one and keep track of how many times it delevels you so a limit can be set for how many times you can use the npc? I have seen many deleveling scripts on here but they all seem to allow the player to choose what level to go back to. I would like to find one that only sets your level to one and limits the amount of times you can do it or a tutorial so i can make my own

ghanja
02-12-2013, 08:33 PM
... an oddity thusfar

Zamthos
02-12-2013, 08:35 PM
The language of scripting, is Perl.

c0ncrete
02-12-2013, 08:35 PM
yes. you can use quest globals to store persistent information for characters.

there is information here (http://www.eqemulator.net/wiki/wikka.php?wakka=QuestTutorial) (towards the bottom of the page), and there are hundreds of examples you can use as a reference in your quests directory.

Dabloon
02-12-2013, 08:40 PM
Thanks c0ncrete that was excellent info. Things will deffinatly go much quicker. Thank you so much

Dunge0nMastr
02-12-2013, 08:58 PM
i would use quest globals.


sub EVENT_SAY {
my $globalname = "delvl"; #w/e you want

if (!defined $qglobals{$globalname}) {
quest::level(1); #or w/e level you want here
quest::setglobal("$globalname",1,5,'F');
}
}



#this would prevent the player from doing it more than 1 time by using a quest global, obviously you can spruce up the script but this is the basics for what your looking for, ill let ya play with it form there :P

Zamthos
02-12-2013, 09:09 PM
Something like this maybe? This limits you to two resets.

sub EVENT_SAY
{
if($text=~/Hail/i && !defined $qglobals{Resets} && $ulevel == 70)
{
quest::level(1);
quest::setglobal("Resets", "1", "5", "F");
plugin::Whisper("You are now 1st Rebirth!");
}
elsif($text=~/Hail/i && $ulevel == 70 && defined $qglobals{Resets} == 1)
{
quest::level(1);
quest::setglobal("Resets", "2", "5", "F");
plugin::Whisper("You are now 2nd Rebirth!");
}
elsif($text=~/Hail/i && $ulevel == 70 && defined $qglobals{Resets} == 2)
{
plugin::Whisper("You are the highest rebirth allowed, 2.");
}
}

c0ncrete
02-12-2013, 09:36 PM
defined $qglobals{Resets} == 2 will always return false.

Zamthos
02-12-2013, 09:58 PM
How do you come to that conclusion?

c0ncrete
02-12-2013, 10:13 PM
because defined will only return 1 (true) or nothing (false)

Returns a Boolean value telling whether EXPR has a value other than the undefined value undef. If EXPR is not present, $_ is checked.

http://perldoc.perl.org/functions/defined.html

Zamthos
02-12-2013, 10:41 PM
Thank you kind sir.

Dabloon
02-14-2013, 08:58 PM
i would use quest globals.


sub EVENT_SAY {
my $globalname = "delvl"; #w/e you want

if (!defined $qglobals{$globalname}) {
quest::level(1); #or w/e level you want here
quest::setglobal("$globalname",1,5,'F');
}
}



#this would prevent the player from doing it more than 1 time by using a quest global, obviously you can spruce up the script but this is the basics for what your looking for, ill let ya play with it form there :P
That worked great. Thank you for the excellent start. Now let the tinkering begin

Dabloon
02-17-2013, 11:12 AM
I have successfully written a deleveling script with a level requirement. Will post it here later if anyone is interested. It works great. Thanks to all who helped especially c0ncrete for the link to the perl lessons