Tony32
Veteran OT User
- Joined
- Jun 6, 2008
- Messages
- 1,268
- Reaction score
- 353
I'm having trouble with stages. I am running rev 94 (0.6.5) but I just can't get the stages to work. I've tried to set expRate in config to stage, stages and 0. Still doesn't work. I'm trying to use the stages via creaturescripts.
creaturescripts.xml
stages.lua
I don't get any errors in the console, and yet I recive 1x experience from all monsters.
Anyone knows how this works on this distro? Would love to know. Thanks a lot in advance.
- - - Updated - - -
Edited this function to debug if it was working. It is indeed loading the output I get when I login. It says 150x exp for a new character. Still, when killing a rat. I get 5 experince (as in config lua). So somehow it doesn't really apply the change. D:
I've also tested setting the config.lua with stage/stages/staged and 0, still nothing changes.
Any help is appreciated.
Regards,
Tony
creaturescripts.xml
Code:
<creaturescripts>
<event type="login" name="stagesLogin" script="stages.lua" />
<event type="advance" name="stagesAdvance" script="stages.lua" />
</creaturescripts>
stages.lua
Code:
STAGES = {
{level = 10, rate = 150},
{level = 25, rate = 100},
{level = 50, rate = 75},
{level = 75, rate = 40},
{level = 100, rate = 20},
{level = 150, rate = 10}
}
DEFAULT_RATE = 5
function checkStages(cid)
local level = getPlayerLevel(cid)
for i = 1, # STAGES do
if level <= STAGES[i].level then
doPlayerSetRate(cid, LEVEL_EXPERIENCE, STAGES[i].rate)
return
end
end
doPlayerSetRate(cid, LEVEL_EXPERIENCE, DEFAULT_RATE)
end
function onLogin(cid)
registerCreatureEvent(cid, "stagesAdvance")
checkStages(cid)
return 1
end
function onAdvance(cid, type, oldlevel, newlevel)
if type == LEVEL_EXPERIENCE then
checkStages(cid)
end
return 1
end
I don't get any errors in the console, and yet I recive 1x experience from all monsters.
Anyone knows how this works on this distro? Would love to know. Thanks a lot in advance.
- - - Updated - - -
Edited this function to debug if it was working. It is indeed loading the output I get when I login. It says 150x exp for a new character. Still, when killing a rat. I get 5 experince (as in config lua). So somehow it doesn't really apply the change. D:
Code:
function checkStages(cid)
doPlayerSendTextMessage(cid,22,"checked stages")
local level = getPlayerLevel(cid)
for i = 1, # STAGES do
if level <= STAGES[i].level then
doPlayerSetRate(cid, LEVEL_EXPERIENCE, STAGES[i].rate)
doPlayerSendTextMessage(cid,22,STAGES[i].rate)
return
end
end
doPlayerSetRate(cid, LEVEL_EXPERIENCE, DEFAULT_RATE)
end
I've also tested setting the config.lua with stage/stages/staged and 0, still nothing changes.
Any help is appreciated.
Regards,
Tony