Exedion
Active Member
- Joined
- Jun 11, 2007
- Messages
- 628
- Reaction score
- 30
This is a small patch to give a better use of parameters in "onAdvance" creature event with "SKILL__EXPERIENCE", take a look:
if you use a script like this:
you will get a message like this:
because "oldLevel" and "newLevel" give the same result: the exp for next level.
with this small patch you can get the current experience gained with "oldLevel" and with "newLevel" you get the experience for next level.
in player.cpp fin this code:
[cpp]
CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE);
for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it)
(*it)->executeAdvance(this, SKILL__EXPERIENCE, tmp, experience);
[/cpp]
and remplace with:
[cpp]
CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE);
for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it)
(*it)->executeAdvance(this, SKILL__EXPERIENCE, gainExp, experience);
[/cpp]
now when you get 1200 exp for killing a monster, your message will be:
enjoy.
if you use a script like this:
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
if(skill == SKILL__EXPERIENCE) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Exp1: ".. oldLevel ..". Exp2: ".. newLevel ..".")
return false
end
you will get a message like this:
Code:
Exp1: 5320. Exp2: 5320.
because "oldLevel" and "newLevel" give the same result: the exp for next level.
with this small patch you can get the current experience gained with "oldLevel" and with "newLevel" you get the experience for next level.
in player.cpp fin this code:
[cpp]
CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE);
for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it)
(*it)->executeAdvance(this, SKILL__EXPERIENCE, tmp, experience);
[/cpp]
and remplace with:
[cpp]
CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE);
for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it)
(*it)->executeAdvance(this, SKILL__EXPERIENCE, gainExp, experience);
[/cpp]
now when you get 1200 exp for killing a monster, your message will be:
Code:
Exp1: 1200. Exp2: 5320.
enjoy.