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

CreatureEvent Promotion_OnAdvance [worth to see it]

just know I'm not flaming or nothin, just lettin ya know man. Appreciate your releases.
 
yeah, u requested it
 
Lua:
  --[[    
         Promotion_OnAdvance
        |-------------------|
        (> Author: Cybermaster
        (> Revision: Shawak
        (> Scripted in: TFS 0.3.6pl1
--]]

function onAdvance(cid, skill, oldLevel, newLevel)

local _SETUP = {
        level = 30,                             --level where the player will obtain the promotion when he reaches it
        type = MESSAGE_STATUS_CONSOLE_ORANGE,   --the message class
        text = "You have just been promoted to " .. getPlayerVocationName(cid) .."!",
        effect = 37,                             --the effect for the leveling up animation
        premmy = true                        --requires premium account?
}

        if skill == SKILL__LEVEL and newLevel < _SETUP.level then
                return true
        end

        if getPlayerPromotionLevel(cid) ~= 0 or _SETUP.premmy == true and not isPremium(cid) then
                return true
        end

        local p = getPlayerPosition(cid)

        local positions = {
                { pos= {x=p.x+1,y=p.y,z=p.z}, delay = 100, delay2 = 900},
                { pos= {x=p.x+1,y=p.y+1,z=p.z}, delay = 200, delay2 = 980},
                { pos= {x=p.x,y=p.y+1,z=p.z}, delay = 300, delay2 = 1060},
                { pos= {x=p.x-1,y=p.y+1,z=p.z}, delay = 400, delay2 = 1140},
                { pos= {x=p.x-1,y=p.y,z=p.z}, delay = 500, delay2 = 1220},
                { pos= {x=p.x-1,y=p.y-1,z=p.z}, delay = 600, delay2 = 1300},
                { pos= {x=p.x,y=p.y-1,z=p.z}, delay = 700, delay2 = 1380},
                { pos= {x=p.x+1,y=p.y-1,z=p.z}, delay = 800, delay2 = 1460}
        }

        for i = 1, 8 do
                addEvent(doSendDistanceShoot, positions[i].delay, positions[i].pos, p, _SETUP.effect)
                addEvent(doSendDistanceShoot, positions[i].delay2, positions[i].pos, p, _SETUP.effect)
        end

        addEvent(doSendMagicEffect, 900, p, 49)
        setPlayerPromotionLevel(cid, 1)
        doPlayerSendTextMessage(cid, _SETUP.type, _SETUP.text)
        doSendAnimatedText(p, "Promoted!", math.random(1,255))
        doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
        doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
        doPlayerSave(cid, true)
        return true
end
 
I didn't get the promotion in the same level -.-.. I changed the level = 30 to 100 but I still got the prom in lvl 30 -.-..
 
Lua:
local _SETUP =  {
        level = 100,                             --level where the player will obtain the promotion when he reaches it
        type = MESSAGE_STATUS_CONSOLE_ORANGE,   --the message class
        text = "You have just been promoted to " .. getPlayerVocationName(cid) .."!",
        effect = 37                             --the effect for the leveling up animation
}
???
 
Nice OnAdvance lua engine you got there! Mind if I practice my LUA a little? :3

  • Can only get reward 1 time. (Anti repeat function).
  • Even if you are promoted, you will get an optional reward instead of the promotion.
  • Support for custom promotions. (e.g sorc, master sorc, epic sorc, legend sorc).
Lua:
  --[[    
         Promotion_OnAdvance
        |-------------------|
        (> Author: Cybermaster
        (> Revision: Shawak, Znote
        (> Scripted in: TFS 0.3.6pl1
--]]

function onAdvance(cid, skill, oldLevel, newLevel)

local _SETUP = {
        level = 30,                             --level where the player will obtain the promotion when he reaches it
        type = MESSAGE_STATUS_CONSOLE_ORANGE,   --the message class
        text = "You have just been promoted to " .. getPlayerVocationName(cid) .."!",
		effect = 37,                             --the effect for the leveling up animation
		premmy = true                        --requires premium account?
		-- This part of config is created by Znote --
		Storage = 1234, -- Anti repeat system. Make sure to use a value that is not already in use.
		textIfAlreadyPromoted = "Since you are already promoted, you will get this reward instead!", -- If he manages to buy promotion before reaching level, he will get an award instead!
        itemIdAP = 2160, -- If already promoted, what itemID should reward be instead?
		ItemCountAP = 5, -- In case itemIdAP is stackable, how many counts? eg itemIdAP 2160 ItemCountAP 5 = 5 crystal coins. 
		promotion = 1,	-- promotion level, default = 1 . Ignore if you don't have new vocations. <<Taken from slawkens version>>
		-- End of Znotes config --
}

        if skill == SKILL__LEVEL and newLevel < _SETUP.level then
                return true
        end

        if getPlayerPromotionLevel(cid) ~= 0 or _SETUP.premmy == true and not isPremium(cid) then
                return true
        end

        local p = getPlayerPosition(cid)

        local positions = {
                { pos= {x=p.x+1,y=p.y,z=p.z}, delay = 100, delay2 = 900},
                { pos= {x=p.x+1,y=p.y+1,z=p.z}, delay = 200, delay2 = 980},
                { pos= {x=p.x,y=p.y+1,z=p.z}, delay = 300, delay2 = 1060},
                { pos= {x=p.x-1,y=p.y+1,z=p.z}, delay = 400, delay2 = 1140},
                { pos= {x=p.x-1,y=p.y,z=p.z}, delay = 500, delay2 = 1220},
                { pos= {x=p.x-1,y=p.y-1,z=p.z}, delay = 600, delay2 = 1300},
                { pos= {x=p.x,y=p.y-1,z=p.z}, delay = 700, delay2 = 1380},
                { pos= {x=p.x+1,y=p.y-1,z=p.z}, delay = 800, delay2 = 1460}
        }

        for i = 1, 8 do
                addEvent(doSendDistanceShoot, positions[i].delay, positions[i].pos, p, _SETUP.effect)
                addEvent(doSendDistanceShoot, positions[i].delay2, positions[i].pos, p, _SETUP.effect)
        end

	AntiRepeat = getPlayerStorageValue(cid,Storage)
		if AntiRepeat >= 1 then
			doPlayerSendCancel(cid, "You have already archived this level on your character before.")
		else
			if(getPlayerPromotionLevel(cid) >= _SETUP.promotion) then
				setPlayerStorageValue(cid,Storage,1)
				doPlayerSendTextMessage(cid, _SETUP.type, _SETUP.textIfAlreadyPromoted)
				doPlayerAddItem(cid,_SETUP.itemIdAP,_SETUP.ItemCountAP)
				doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
				addEvent(doSendMagicEffect, 900, p, 49)
				doPlayerSave(cid, true)
			else
		
				addEvent(doSendMagicEffect, 900, p, 49)
				setPlayerPromotionLevel(cid, 1)
				doPlayerSendTextMessage(cid, _SETUP.type, _SETUP.text)
				doSendAnimatedText(p, "Promoted!", math.random(1,255))
				doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
				doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
				doPlayerSave(cid, true)
			return true
			end
		end
	end


Lol script looks like a mess, looks way better in notepad++. x)
 
Last edited:
Nice OnAdvance lua engine you got there! Mind if I practice my LUA a little? :3

  • Can only get reward 1 time. (Anti repeat function).
  • Even if you are promoted, you will get an optional reward instead of the promotion.
  • Support for custom promotions. (e.g sorc, master sorc, epic sorc, legend sorc).
Lua:
  --[[    
         Promotion_OnAdvance
        |-------------------|
        (> Author: Cybermaster
        (> Revision: Shawak, Znote
        (> Scripted in: TFS 0.3.6pl1
--]]

function onAdvance(cid, skill, oldLevel, newLevel)

local _SETUP = {
        level = 30,                             --level where the player will obtain the promotion when he reaches it
        type = MESSAGE_STATUS_CONSOLE_ORANGE,   --the message class
        text = "You have just been promoted to " .. getPlayerVocationName(cid) .."!",
		effect = 37,                             --the effect for the leveling up animation
		premmy = true                        --requires premium account?
		-- This part of config is created by Znote --
		Storage = 1234, -- Anti repeat system. Make sure to use a value that is not already in use.
		textIfAlreadyPromoted = "Since you are already promoted, you will get this reward instead!", -- If he manages to buy promotion before reaching level, he will get an award instead!
        itemIdAP = 2160, -- If already promoted, what itemID should reward be instead?
		ItemCountAP = 5, -- In case itemIdAP is stackable, how many counts? eg itemIdAP 2160 ItemCountAP 5 = 5 crystal coins. 
		promotion = 1,	-- promotion level, default = 1 . Ignore if you don't have new vocations. <<Taken from slawkens version>>
		-- End of Znotes config --
}

        if skill == SKILL__LEVEL and newLevel < _SETUP.level then
                return true
        end

        if getPlayerPromotionLevel(cid) ~= 0 or _SETUP.premmy == true and not isPremium(cid) then
                return true
        end

        local p = getPlayerPosition(cid)

        local positions = {
                { pos= {x=p.x+1,y=p.y,z=p.z}, delay = 100, delay2 = 900},
                { pos= {x=p.x+1,y=p.y+1,z=p.z}, delay = 200, delay2 = 980},
                { pos= {x=p.x,y=p.y+1,z=p.z}, delay = 300, delay2 = 1060},
                { pos= {x=p.x-1,y=p.y+1,z=p.z}, delay = 400, delay2 = 1140},
                { pos= {x=p.x-1,y=p.y,z=p.z}, delay = 500, delay2 = 1220},
                { pos= {x=p.x-1,y=p.y-1,z=p.z}, delay = 600, delay2 = 1300},
                { pos= {x=p.x,y=p.y-1,z=p.z}, delay = 700, delay2 = 1380},
                { pos= {x=p.x+1,y=p.y-1,z=p.z}, delay = 800, delay2 = 1460}
        }

        for i = 1, 8 do
                addEvent(doSendDistanceShoot, positions[i].delay, positions[i].pos, p, _SETUP.effect)
                addEvent(doSendDistanceShoot, positions[i].delay2, positions[i].pos, p, _SETUP.effect)
        end

	AntiRepeat = getPlayerStorageValue(cid,Storage)
		if AntiRepeat >= 1 then
			doPlayerSendCancel(cid, "You have already archived this level on your character before.")
		else
			if(getPlayerPromotionLevel(cid) >= _SETUP.promotion) then
				setPlayerStorageValue(cid,Storage,1)
				doPlayerSendTextMessage(cid, _SETUP.type, _SETUP.textIfAlreadyPromoted)
				doPlayerAddItem(cid,_SETUP.itemIdAP,_SETUP.ItemCountAP)
				doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
				addEvent(doSendMagicEffect, 900, p, 49)
				doPlayerSave(cid, true)
			else
		
				addEvent(doSendMagicEffect, 900, p, 49)
				setPlayerPromotionLevel(cid, 1)
				doPlayerSendTextMessage(cid, _SETUP.type, _SETUP.text)
				doSendAnimatedText(p, "Promoted!", math.random(1,255))
				doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
				doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
				doPlayerSave(cid, true)
			return true
			end
		end
	end


Lol script looks like a mess, looks way better in notepad++. x)

it wont work =(
PHP:
[19/03/2010 10:42:13] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/changepvp.lua:18: '}' expected (to close '{' at line 11) near 'Storage'
[19/03/2010 10:42:13] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/changepvp.lua)
[19/03/2010 10:42:13] data/creaturescripts/scripts/changepvp.lua:18: '}' expected (to close '{' at line 11) near 'Storage'
 
Back
Top