PDA

View Full Version : Quest question.


serivoth1234
05-01-2015, 04:06 PM
Okay I searched the forums i probably just missed it if so I apologize for this post. Is there a way too add AA exp through a quest? I've tried the few ideas that I had none of them seem to work.

chrsschb
05-01-2015, 04:14 PM
It's my understanding that there is only one way to earn/give exp:

quest::exp(0);

Whether or not the player receives AA or Regular exp would be based on their individual setting for AA/Exp ratio.

serivoth1234
05-01-2015, 04:43 PM
I was afraid of that, was hoping since you can add it via GM command we could pass it to the client through quest. Well thank you for your time.

serivoth1234
05-01-2015, 08:42 PM
Is there a way to turn on AA exp gain before 51?

dagulus2
05-01-2015, 08:47 PM
Is there a way to turn on AA exp gain before 51?

AFAIK, there is no way to move the slider that means exp will be diverted to AA before 51, that is hardcoded in the client.

However, you can have quests reward AA points (or even specific AA abilities), so you could have, for example, an NPC that gives AA points in exchange for plat that would work at any level.

ghanja
05-01-2015, 09:03 PM
You can use GetEXP/GetAAEXP and SetEXP.


my $currentaaexp = $client->GetAAEXP();
my $currentregularexp = $client->GetEXP();
my $aaexptogive = 1000;
$client->SetEXP($currentregularexp,($currentaaexp+$aaexptog ive));


Did unnecessary declaration to show you what's going on but:


$client->SetEXP($client->GetEXP(),($client->GetAAEXP()+1000));


Would be less code.

serivoth1234
05-01-2015, 10:28 PM
I appreciate the replies, however It doesn't seem to work. I'm calling it on the event death of a mob, not awarding any AA exp though.

ghanja
05-01-2015, 11:24 PM
No, it wouldn't, there is quite a bit more code than one line to do what I think you're after, and it's hackery/exploitable at best.


Is there a way too add AA exp through a quest?


I answered based on that, figured it was the normal everyday type of quest, but NPC's script would be different and what you're after.

ghanja
05-01-2015, 11:32 PM
It's not a very elegant way to do it and it is certainly untested (not even sure the NPC hasn't already cleared the hate list before the EVENT_DEATH call or not -- would need to look at the source) but, it may give you an idea:


sub EVENT_DEATH {
my @hate_list = $npc->GetHateList();
my $hate_count = @hate_list;
if ($hate_count > 0) {
foreach $ent (@hate_list) {
$hate_entity = $ent->GetEnt();
$hate_client = $hate_entity->CastToClient();
if (($hate_entity->IsClient()) && (!$hate_client->IsBecomeNPC())) {
$hate_client->SetEXP($hate_client->GetEXP(),($hate_client->GetAAExp()+1000));
}
}
}
}


If the hate list is clear by the time EVENT_DEATH is called, then, well, even more coding will be necessary but, I'm not quite up to that tonight (have a few projects piling up).

serivoth1234
05-02-2015, 03:16 AM
Thank you ghanja I appreciate it all. I will test it tomorrow and see how it goes. Again thank you for taking the time.

serivoth1234
05-02-2015, 11:02 AM
That doesn't work so I have a different question, is there a way to track a kill count on any mob that would award exp to player, then say after a set amount of kills award an AA point? Then reset the counter and start again? Basically give the illusion of AA exping?

NatedogEZ
05-02-2015, 02:52 PM
I just noticed but you have at least one typo in that quest.

GetAAEXP should be GetAAExp


If you want to use AA Exp before level 51... changing this line.. might work.. might not :p

https://github.com/EQEmu/Server/blob/master/zone/exp.cpp#L404


I might test this right now.. as it would allow me to use AAs without raising my level cap passed 50~ :)


This works. The code above had a typo

$client->SetEXP($client->GetEXP(),($client->GetAAExp()+5000));



It works.. the AA Exp bar moves nicely

http://i.imgur.com/uyJBoTk.png

ghanja
05-02-2015, 09:07 PM
Was a night for typos for me last night I guess <grin> TY for finding that, I admit, I started with SetEXP first and copy/pasted it and added an "AA" in between Set and EXP. Case sensitivity FTW.

Was the source line change turn out to be necessary?

serivoth1234
05-03-2015, 09:44 AM
For me it works however the exp bar does not update, the actual exp isn't reflected unless I zone and I never actually receive an aa point it just fills the exp bar.

NatedogEZ
05-03-2015, 03:49 PM
You need to remove that level check I posted.. it needs to SendAAStats();or whatever to characters at any level, then it will work just fine

serivoth1234
05-04-2015, 04:04 PM
Okay I removed the level check, compiled, no errors everything loads just fine, however still no AAexp updates being sent.

serivoth1234
05-04-2015, 04:20 PM
Okay it's working now. Now I just need to get it to run on the mobs death and actually pass it to the player.

ghanja
05-04-2015, 04:41 PM
Okay it's working now. Now I just need to get it to run on the mobs death and actually pass it to the player.

Show me the entire script where you tried using the code I provided for giving aa exp when a mob dies. Be sure to use [code ] blocks please.

serivoth1234
05-04-2015, 05:07 PM
I got it working now. Works perfectly, thanks everyone for the assist I appreciate it. Ghanja your code worked as it is, I had a declaration out of place is all.

serivoth1234
05-04-2015, 05:43 PM
Okay trying to get this to only fire off if the client is level 20 or above, however it works just fine without the if($ulevel >19)
sub EVENT_DEATH {
if ($ulevel > 19){
my @hate_list = $npc->GetHateList();
my $hate_count = @hate_list;
if ($hate_count > 0) {
foreach $ent (@hate_list) {
$hate_entity = $ent->GetEnt();
$hate_client = $hate_entity->CastToClient();
if (($hate_entity->IsClient()) && (!$hate_client->IsBecomeNPC())) {
$hate_client->SetEXP($hate_client->GetEXP(),($hate_client->GetAAExp()+1000));
}
}
}
}
}

ghanja
05-04-2015, 06:18 PM
sub EVENT_DEATH {
my @hate_list = $npc->GetHateList();
my $hate_count = @hate_list;
if ($hate_count > 0) {
foreach $ent (@hate_list) {
$hate_entity = $ent->GetEnt();
$hate_client = $hate_entity->CastToClient();
if (($hate_entity->IsClient()) && (!$hate_client->IsBecomeNPC())) {
if ($hate_client->GetLevel() > 19) {
$hate_client->SetEXP($hate_client->GetEXP(),($hate_client->GetAAExp()+1000));
}
}
}
}
}

serivoth1234
05-04-2015, 06:24 PM
Awesome, works perfectly, thank you

Shendare
05-04-2015, 06:44 PM
You da man, ghanja.

ghanja
05-04-2015, 08:14 PM
You da man, ghanja.

Appreciate that heh, but I pale in comparison to many others here.

NatedogEZ
05-04-2015, 08:37 PM
There is a sub event that already does that btw... you are just creating extra work for yourself :)


EVENT_KILLED_MERIT triggers for each client that was given CREDIT for the kill.

Example.. anyone in the raid / group, however, if you want it so that players can just run up and "tag" something while someone else is killing it.. that they get credit.

Meaning a non-grouped player could run around hitting mobs 1 time that other players are fighting and get credit with the way you have it written.


Changing to this would eliminate that.


sub EVENT_KILLED_MERIT {
if ($ulevel > 19) {
$client->SetEXP($client->GetEXP(), $client->GetAAExp()+1000);
}
}

Shendare
05-04-2015, 08:39 PM
Oooh, nice. I don't remember that event.

ghanja
05-04-2015, 08:42 PM
There is a sub event that already does that btw... you are just creating extra work for yourself :)


EVENT_KILLED_MERIT triggers for each client that was given CREDIT for the kill.

Example.. anyone in the raid / group, however, if you want it so that players can just run up and "tag" something while someone else is killing it.. that they get credit.

Meaning a non-grouped player could run around hitting mobs 1 time that other players are fighting and get credit with the way you have it written.


Changing to this would eliminate that.


sub EVENT_KILLED_MERIT {
if ($ulevel > 19) {
$client->SetEXP($client->GetEXP(), $client->GetAAExp()+1000);
}
}


I originally tried that, but found it was buggy. I dont recall precisely what was buggy with it, but, thus the work around.

I'll have to revisit the idea. That code I provided was a copy/paste from something done a year back, so, probably doesnt exist now. If not, well, then yes, that would be the best method to say the least.

So there you go, no shortage of options. :)

Akkadius
05-04-2015, 09:09 PM
Nothing should be buggy about the EVENT_KILLED_MERIT option

The only caveat is that you have to keep in mind is that each client does trigger the sub EVENT on its own as Natedog said.

serivoth1234
05-05-2015, 12:08 PM
EVENT_KILLED_MERIT works perfectly, thanks for the info on it.