• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Error

Ghost Knight

New Member
Joined
Nov 12, 2012
Messages
25
Reaction score
0
well i use [21/11/2012 10:55:22] The OTX Server Version: (2.43 - 1424) - Codename: (Cray Claw)

and i have this error

[21/11/2012 10:59:57] [Error - CreatureScript Interface]
[21/11/2012 10:59:57] data/creaturescripts/scripts/advancesave.lua:onAdvance
[21/11/2012 10:59:57] Description:
[21/11/2012 10:59:57] attempt to index a nil value
[21/11/2012 10:59:57] stack traceback:
[21/11/2012 10:59:57] [C]: in function 'doSendMagicEffect'
[21/11/2012 10:59:57] data/creaturescripts/scripts/advancesave.lua:15: in function <data/creaturescripts/scripts/advancesave.lua:7>

LUA:
local config = {
	savePlayer = true,
	healPlayerOnLevel = true,
	effectType = 30
}

function onAdvance(cid, skill, oldLevel, newLevel)
	if(skill == SKILL__EXPERIENCE) then
		return true
	end

	if(skill == SKILL__LEVEL and config.healPlayerOnLevel) then
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
		doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
		doSendMagicEffect(pos, config.effectType)
	end

	if(config.savePlayer) then
		doPlayerSave(cid, true)
	end

	return true
end
 
Last edited:
Try this

LUA:
local config = {
	savePlayer = true,
	healPlayerOnLevel = true,
	effectType = 30
}
 
function onAdvance(cid, skill, oldLevel, newLevel,toPosition)
	if(skill == SKILL__EXPERIENCE) then
		return true
	end
 
	if(skill == SKILL__LEVEL and config.healPlayerOnLevel) then
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
		doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
		doSendMagicEffect(toPosition,config.effecType)
	end
 
	if(config.savePlayer) then
		doPlayerSave(cid, true)
	end
 
	return true
end
 
still the error

[21/11/2012 11:14:35] [Error - CreatureScript Interface]
[21/11/2012 11:14:35] data/creaturescripts/scripts/advancesave.lua:onAdvance
[21/11/2012 11:14:35] Description:
[21/11/2012 11:14:35] attempt to index a nil value
[21/11/2012 11:14:35] stack traceback:
[21/11/2012 11:14:35] [C]: in function 'doSendMagicEffect'
[21/11/2012 11:14:35] data/creaturescripts/scripts/advancesave.lua:15: in function <data/creaturescripts/scripts/advancesave.lua:7>
 
LUA:
local config = {
	savePlayer = true,
	healPlayerOnLevel = true,
	effectType = 30
}
 
function onAdvance(cid, skill, oldLevel, newLevel)
	if(skill == SKILL__EXPERIENCE) then
		return true
	end
 
	if(skill == SKILL__LEVEL and config.healPlayerOnLevel) then
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
		doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
		doSendMagicEffect(getCreaturePosition(cid), config.effecType)
	end
 
	if(config.savePlayer) then
		doPlayerSave(cid, true)
	end
 
	return true
end
 
Back
Top