EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Custom (https://www.eqemulator.org/forums/forumdisplay.php?f=671)
-   -   Gain AA points each level (https://www.eqemulator.org/forums/showthread.php?t=39704)

lordnivek1 05-26-2015 04:41 PM

Gain AA points each level
 
I am trying to get 2 AA added to a character each level up to and including level 50. I have pieced this together from other peoples code to try and get it to work. I am placing this in the ...quest/global/global_player.lua file. I am not sure what I am doing but trying to learn lol.


Code:

sub EVENT_LEVEL_UP
        if ($ulevel < 51) {
                $client-AddAAPoints(2);
        }
}


Kingly_Krab 05-26-2015 04:45 PM

Try this:
Code:

sub EVENT_LEVEL_UP {
    if ($ulevel < 51) {
        $client->AddAAPoints(2);
    }
}

Edit: You were missing a { on the subroutine at the top and missing a > on $client->AddAAPoints.

Edit 2: This is Perl, not Lua, I didn't notice you said you were putting it in a Lua file.

lordnivek1 05-26-2015 04:56 PM

I still seem to be doing something wrong. It doesn't seem to do anything. This is what is looks like in the global_player.lua. After adding it the file has a red exclamation point in the icon instead of a green check that used to be there. All I did was past the code in the end. Did i add it correclty? Thank you for the reply.

Code:

function event_enter_zone(e)
        local qglobals = eq.get_qglobals(e.self);
        if(e.self:GetLevel() >= 15 and qglobals['Wayfarer'] == nil) then
                local zoneid = eq.get_zone_id();
                if(e.self:GetStartZone() ~= zoneid and (zoneid == 1 or zoneid == 2 or zoneid == 3 or zoneid == 8 or zoneid == 9
                or zoneid == 10 or zoneid == 19 or zoneid == 22 or zoneid == 23 or zoneid == 24 or zoneid == 29 or zoneid == 30
                or zoneid == 34 or zoneid == 35 or zoneid == 40 or zoneid == 41 or zoneid == 42 or zoneid == 45 or zoneid == 49
                or zoneid == 52 or zoneid == 54 or zoneid == 55 or zoneid == 60 or zoneid == 61 or zoneid == 62 or zoneid == 67
                or zoneid == 68 or zoneid == 75 or zoneid == 82 or zoneid == 106 or zoneid == 155 or zoneid == 202 or zoneid == 382
                or zoneid == 383 or zoneid == 392 or zoneid == 393 or zoneid == 408)) then
                        e.self:Message(15,
                                "A mysterious voice whispers to you, \'If you can feel me in your thoughts, know this -- "
                                .. "something is changing in the world and I reckon you should be a part of it. I do not know much, but I do know "
                                .. "that in every home city and the wilds there are agents of an organization called the Wayfarers Brotherhood. They "
                                .. "are looking for recruits . . . If you can hear this message, you are one of the chosen. Rush to your home city, or "
                                .. "search the West Karanas and Rathe Mountains for a contact if you have been exiled from your home for your deeds, "
                                .. "and find out more. Adventure awaits you, my friend.\'");
                end
        end
end

function event_combine_success(e)
        if (e.recipe_id == 10904 or e.recipe_id == 10905 or e.recipe_id == 10906 or e.recipe_id == 10907) then
                e.self:Message(1,
                "The gem resonates with power as the shards placed within glow unlocking some of the stone's power. "
                .. "You were successful in assembling most of the stone but there are four slots left to fill, "
                .. "where could those four pieces be?"
                );
        elseif(e.recipe_id == 10903 or e.recipe_id == 10346 or e.recipe_id == 10334) then
                local reward = { };
                reward["melee"] =  { ["10903"] = 67665, ["10346"] = 67660, ["10334"] = 67653 };
                reward["hybrid"] = { ["10903"] = 67666, ["10346"] = 67661, ["10334"] = 67654 };
                reward["priest"] = { ["10903"] = 67667, ["10346"] = 67662, ["10334"] = 67655 };
                reward["caster"] = { ["10903"] = 67668, ["10346"] = 67663, ["10334"] = 67656 };

                local ctype = eq.ClassType(e.self:GetClass());
                e.self:SummonItem(reward[ctype][tostring(e.recipe_id)]);
                e.self:SummonItem(67704);
                e.self:Message(1, "Success");
        end
end

function event_command(e)
        return eq.DispatchCommands(e);
end

sub EVENT_LEVEL_UP {
    if ($ulevel < 51) {
        $client->SetAAPoints(($client->GetAAPoints() + 2));
    }
}


lordnivek1 05-26-2015 04:57 PM

oh crap ok. so is there a global quest that is perl that this can be placed in?

Kingly_Krab 05-26-2015 05:01 PM

Yes, just make a global_player.pl in the quests/global folder. global_player.lua will have precedence though, so if you're not using that file you may want to delete it or rename it to something else.

lordnivek1 05-26-2015 05:05 PM

Quote:

Originally Posted by Kingly_Krab (Post 240423)
Yes, just make a global_player.pl in the quests/global folder. global_player.lua will have precedence though, so if you're not using that file you may want to delete it or rename it to something else.

Thats why my global_player.pl file never workes then lol. Great thank you for the help you are awesome.

Kingly_Krab 05-26-2015 05:15 PM

Let me know if it all works.

lordnivek1 05-26-2015 05:20 PM

It does work. It only seems to register one level up even if you get several, but that is almost a non issue as you should never get more then one level at a time. Thank you again for your time.

Kingly_Krab 05-26-2015 05:32 PM

No problem, just private message me or add my Skype (Kingly.krab) if you have any Perl/Lua related questions.

warbleeder 01-23-2017 07:35 PM

cant seem to get it working

im guessing im missing something

heres ho i have it

sub EVENT_LEVEL_UP {

AutoTrain();

}

sub AutoTrain {

$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 .. 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 );

}

}sub EVENT_LEVEL_UP {
if ($ulevel < 51) {
$client->AddAAPoints(3);
}

warbleeder 01-25-2017 07:01 AM

fixed it got rid of part of code and moved rest and it works like a charm :)

lordnivek1 10-07-2023 10:06 AM

I hate to necro my old thread but I am trying to remake my old server and having an issue getting this to work again. I have added the code to the global.player.pl file, but can not seem to get it to work. (I renamed the .lua file of the same name)

I see someone above had an issue and said they found a way to fix it but didn't post the fix. Is there a new way to write this code to get it to work?

this is what I put in the file

sub EVENT_LEVEL_UP {
if ($ulevel < 51) {
$client->SetAAPoints(($client->GetAAPoints() + 2));
}

lordnivek1 10-07-2023 12:21 PM

Ok so I have found out it has something to do with the level triggers is why it is not working. If I remove that line, it works fine. Below is what I used and it now works. Good enough for me.


sub EVENT_LEVEL_UP {
$client->SetAAPoints($client->GetAAPoints()+2);
}


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

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