• 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!

Windows Full Refil On Level Up

shownam

New Member
Joined
Jan 18, 2013
Messages
15
Reaction score
0
ok, i have looked at every script on this forum that says will work to refil life and mana on levelup but nont of them work, i get no errors they ust plain dont work.
i am using tfs4.0 rev 3884 i have copy and pasted every levelup.lua i have found on site and none work...

here is what my levelup.lua consists of

Code:
function onAdvance(cid, newLevel)
local playerPos = getCreaturePosition(cid)
    if newLevel == SKILL__LEVEL then
        doSendMagicEffect(playerPos, CONST_ME_BIGCLOUDS)
        doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
        doCreatureAddMana(cid, getCreatureMaxMana(cid))
    end
    return TRUE
end

here is my login.lua

Code:
function onLogin(cid)
--configuration--
local config = {
        texttype = TALKTYPE_CHANNEL_W,
        channelID = 11,
        textprefix = "Login:",
        textsuffix = "has logged in!"
}
--end config--
local showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
        for _, pid in ipairs(getChannelUsers(config.channelID)) do
                if((showGamemasters or getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(cid) or getPlayerGhostAccess(pid) >= getPlayerGhostAccess(cid))) then
                        doPlayerSendChannelMessage(pid, cid, config.textprefix.." "..getCreatureName(cid).." "..config.textsuffix, config.texttype, config.channelID)
                end
		registerCreatureEvent(cid, "NewLevel")
        end
        return true
end

this is what i have entered on my creature scripts


Code:
<event type="advance" name="newlevel" event="script" value="levelUp.lua"/>

and yes SKILL__LEVEL is registered in my constant.lua.

i am on windows 7

again using tfs 4 rev 3884

for faster corilation please email me at

[email protected]
 
Last edited:
event name is case-sensitive

Code:
[COLOR=#333333]registerCreatureEvent(cid, "[/COLOR][COLOR=#ff0000][B]NewLevel[/B][/COLOR][COLOR=#333333]")[/COLOR]

Code:
[COLOR=#333333]<event type="advance" name="[/COLOR][COLOR=#ff0000][B]newlevel[/B][/COLOR][COLOR=#333333]" event="script" value="levelUp.lua"/>[/COLOR]

and wrong thread tag, but whatever


take a look at my fancy scripts
http://otland.net/f82/advanced-onadvance-best-onadvance-68309/
 
ok, capatilized my NewLevel and still nothing, doesnt refill my life and mana

tell me what all you need to help me figure this problem out.
 
LUA:
function onAdvance(cid, skill, oldLevel, newLevel)
local playerPos = getCreaturePosition(cid)
    if skill == SKILL__LEVEL then
        doSendMagicEffect(playerPos, CONST_ME_BIGCLOUDS)
        doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
        doCreatureAddMana(cid, getCreatureMaxMana(cid))
    end
    return TRUE
end
 
no the file name is levelUp.lua
Code:
local CONFIG = {
	[0] = {"+fist", 38},
	[1] = {"+club", 26},
	[2] = {"+sword", 24},
	[3] = {"+axe", 25},
	[4] = {"+distance", 2},
	[5] = {"+defense", 11},
	[6] = {"+fishing", 12},
	[7] = {"+magic", 35},
	[8] = {"+level", 37}
}
local USE_EFFECTS = true
function onAdvance(cid, skill, oldlevel, newlevel)
	if skill == SKILL__LEVEL then
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
		doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
	end
	if not CONFIG[skill] or USE_EFFECTS == false then
		return true
	end
	local p = getPlayerPosition(cid)
	local POSITIONS = { 
		[1] = {pos={x=p.x+1,y=p.y,z=p.z}, delay = 100, delay2 = 900},
		[2] = {pos={x=p.x+1,y=p.y+1,z=p.z}, delay = 200, delay2 = 980},
		[3] = {pos={x=p.x,y=p.y+1,z=p.z}, delay = 300, delay2 = 1060},
		[4] = {pos={x=p.x-1,y=p.y+1,z=p.z}, delay = 400, delay2 = 1140},
		[5] = {pos={x=p.x-1,y=p.y,z=p.z}, delay = 500, delay2 = 1220},
		[6] = {pos={x=p.x-1,y=p.y-1,z=p.z}, delay = 600, delay2 = 1300},
		[7] = {pos={x=p.x,y=p.y-1,z=p.z}, delay = 700, delay2 = 1380},
		[8] = {pos={x=p.x+1,y=p.y-1,z=p.z}, delay = 800, delay2 = 1460}
	} 
	for i = 1, #POSITIONS do
		addEvent(doSendDistanceShoot, POSITIONS[i].delay, POSITIONS[i].pos, p, CONFIG[skill][2])
		addEvent(doSendDistanceShoot, POSITIONS[i].delay2, POSITIONS[i].pos, p, CONFIG[skill][2])
	end 
	addEvent(doSendMagicEffect, 900, p, 49)
	doSendAnimatedText(p, CONFIG[skill][1] .. "["..newlevel.."]", math.random(255))
	doPlayerSave(cid, true)	
	return true
end

and creaturescripts
Code:
<event type="advance" name="levelUp" event="script" value="levelUp.lua"/>

login.lua
Code:
registerCreatureEvent(cid, 'advance')
 
Last edited:
Back
Top