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 |
Try this:
Code:
sub EVENT_LEVEL_UP { Edit 2: This is Perl, not Lua, I didn't notice you said you were putting it in a Lua file. |
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) |
oh crap ok. so is there a global quest that is perl that this can be placed in?
|
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.
|
Quote:
|
Let me know if it all works.
|
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.
|
No problem, just private message me or add my Skype (Kingly.krab) if you have any Perl/Lua related questions.
|
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); } |
fixed it got rid of part of code and moved rest and it works like a charm :)
|
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)); } |
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 05:22 PM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.