EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Custom globalplayer issues, please help (https://www.eqemulator.org/forums/showthread.php?t=43499)

Jorin 12-24-2021 11:04 AM

Custom globalplayer issues, please help
 
So I have these in my globalplayer.pl And made sure to remove the lua version.

The level up event does the autotrain up to lvl 51 no issues. My problem is its only scribing a few spells not lvl 1 to 51, which is probably pretty simple fix its just frustrated me. But the big issue im having with it is the 2nd part, I made a npc to set my global to Hardmode 1 but when I level up to 70 im not getting the message saying I completed.

Code:

sub EVENT_LEVEL_UP {
    if ($ulevel <= 51) {
                $client->Message( 15, "Your experiences across the realm have infused you with increased power and knowledge..." );
                # set all available skills to maximum for race/class at current level
                foreach my $skill ( 0 .. 42, 48 .. 54, 70 .. 74 ) {
                        next unless $client->CanHaveSkill($skill);
                        my $maxSkill = $client->MaxSkill( $skill, $client->GetClass(), $ulevel );
                        next unless $maxSkill > $client->GetRawSkill($skill);
                        $client->SetSkill( $skill, $maxSkill );
                }
                # scribe all spells for current level
                quest::scribespells( $ulevel, $ulevel - 1 );
                # train all discs for current level
                quest::traindiscs( $ulevel, $ulevel - 1 );
        }
        elsif((defined $qglobals{"Hardmode"} && $qglobals{"Hardmode"} == 1) && ($ulevel == 70)) {
        $client->Message( 15, "You have completed Hardmode! Congratulations here is your reward!" );
        quest::summonitem();
        quest::setglobal("Hardmode", 2, 5, "F");
    }
        }



The 2nd one im trying to make it reset your level when you die and delete your corpses if Hardmode = 1. It doesnt appear to work at all for some reason.

Code:

sub EVENT_DEATH {
    if((defined $qglobals{"Hardmode"} && $qglobals{"Hardmode"} == 1) && ($ulevel <= 69)) {
        quest::setlevel(51);
        $client->Message( 15, "Hardmode Enabled. Your level and skills have reset as punishment for your death!" );
                my $CorpseCount = 0;
                my $charid = $client->CharacterID();
                        my $corpse = $entity_list->GetCorpseByOwner($client);
            $client->Message(15,"Your corpse has been removed.");
            $corpse->Delete();
        }
    elsif((defined $qglobals{"Hardmode"} && $qglobals{"Hardmode"} == 1) && ($ulevel >= 70)) {
        quest::setlevel(70);
          $client->Message( 15, "Hardmode Enabled. Your level and skills have reset as punishment for your death!" );
                my $CorpseCount = 0;
                my $charid = $client->CharacterID();
                        my $corpse = $entity_list->GetCorpseByOwner($client);
            $client->Message(15,"Your corpse has been removed.");
            $corpse->Delete();
        }
    elsif((defined $qglobals{"Hardmode"} && $qglobals{"Hardmode"} == 2) && ($ulevel == 75)) {
        $client->Message( 15, "Hardmode Enabled. As a reward for completing Hardmode, your punishment is waved!" );
    }
}


Any insight would be awesome as Ive been messing with these for days and am getting nowhere.

Jorin 12-25-2021 12:22 PM

Fixed the spell scribe issue. Was just a dumb mistake on my end. However the Hardmode check and system message upon reaching 70 is still not working, cant seem to figure it out. And the death event is not working either. Does not reset level or delete your corpse.

c0ncrete 12-29-2021 06:59 PM

Code:

sub EVENT_DEATH {
  # leave early if hard mode not set
  return unless (defined $qglobals{'hardmode'});
  if ($qglobals{'hardmode'} == 1) {
    # $my CorpseCount = 0 does nothing
    # $charid isn't being used at all
    $client->Message(15, "LoL!");
    # one set level statement for both conditions
    quest::setlevel($ulevel < 70 ? 51 : 70);
  } elsif ($qglobals{'hardmode'} == 2) {
    # ...
  }
}

Cutting down on repetition and using things like strict mode will help you troubleshoot your scripts.

Jorin 02-07-2022 05:51 PM

Still doesnt appear to be working correctly will have to do more testing I suppose. Kind of left it on the back burner


All times are GMT -4. The time now is 03:01 AM.

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