• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[release] onAdvance

[18/02/2008 16:33:31] ./data/creaturescripts/scripts/onAdvance.lua:34: attempt to compare nil with number
[18/02/2008 16:33:31] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/think.lua
[18/02/2008 16:33:31] data/creaturescripts/scripts/login.lua:5: 'end' expected (to close 'function' at line 1) near 'OLD_LEVELS'
[18/02/2008 16:33:31] Reloaded creature events.
 
[18/02/2008 16:42:40] Lua Script Error: [CreatureScript Interface]
[18/02/2008 16:42:40] data/creaturescripts/scripts/login.lua

[18/02/2008 16:42:40] data/creaturescripts/scripts/login.lua:18: table index is nil
[18/02/2008 16:42:40] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/login.lua
 
when a player is kicked becouse he is afk in console show error.
when you relload creaturescript in console show error.

i fixed the errors
think.lua
Code:
function onThink(cid, interval)
if OLD_LEVELS[cid] == nil then
	OLD_LEVELS[cid] = getPlayerLevel(cid)
	OLD_MAGLEVELS[cid] = getPlayerMagLevel(cid)
	OLD_FIST[cid] = getPlayerSkill(cid,SKILL_FIST)
	OLD_CLUB[cid] = getPlayerSkill(cid,SKILL_CLUB)
	OLD_AXE[cid] = getPlayerSkill(cid,SKILL_AXE)
	OLD_SWORD[cid] = getPlayerSkill(cid,SKILL_SWORD)
	OLD_DISTANCE[cid] = getPlayerSkill(cid,SKILL_DISTANCE)
	OLD_SHIELD[cid] = getPlayerSkill(cid,SKILL_SHIELD)
	OLD_FISHING[cid] = getPlayerSkill(cid,SKILL_FISHING)
else

	dofile("./data/creaturescripts/scripts/onAdvance.lua")
	onAdvanceController(cid)
	return TRUE
end
end


sorry about my english
 
When I run my server with this script it spams and spams and freezes like crazy :/
 
Show us the console errors and tell us if you have edited the scripts in any way.
 
If a player gets debugged or closes his client without logging out, I get problems with onThink because it trys to update with the latest player skills.
 
Actually function "onAdvance" is in TFS sources. You don't have to use LUA function "onThink" to check is someone advanced. I'll post later how to use new function.
 
Actually function "onAdvance" is in TFS sources. You don't have to use LUA function "onThink" to check is someone advanced. I'll post later how to use new function.


Could you give us a quick example? becouse this script doesn't work for me, no error nothing...

//Massen
 
#Gesior
Do I have in every script to add?

Nope... Onlogin is only one function in creaturescripts/login.lua
so add it once and Its gonna work for all scripts


BTW Its not working for me :| Im using TFS 0.2 and nothing happends when I reach lvl or skill (yes I have good script) :| anyone who have done this on tfs 0.2?
 
Last edited:
Code:
--onAdvance system by 4220niller
--xmlReader might be implemented later so that you can have multiple scripts
function onAdvance(cid, oldlevel, newlevel)
local lvl = getPlayerLevel(cid)
local hp = getPlayerHealth(cid)
if newlevel == level+1
then
doPlayerHealth(cid,10*hp)
end
end
My code of Level.lua - I want to this script give all of hp when player adv from lvl xx to lvl yy - Where are error?:(
 
Code:
--onAdvance system by 4220niller
--xmlReader might be implemented later so that you can have multiple scripts
function onAdvance(cid, oldlevel, newlevel)
local lvl = getPlayerLevel(cid)
local hp = getPlayerHealth(cid)
if newlevel == level+1
then
doPlayerHealth(cid,10*hp)
end
end
My code of Level.lua - I want to this script give all of hp when player adv from lvl xx to lvl yy - Where are error?:(
doPlayerHealth(cid,10*hp) ??
doCreatureAddHealth(cid,hp) !!
Try this code:
PHP:
function onAdvance(cid, oldlevel, newlevel)
	doCreatureAddHealth(cid,999999)
end
 
Back
Top