• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Best manarune ever!

kumpelek93

New Member
Joined
Aug 8, 2010
Messages
39
Reaction score
2
Hi there
I want to present you manarune that we made on other Open Tibia forum.
It is newbie friendly script.
Works with 7.6-8.42, Im not sure about 8.42+.
Enjoy :)



PHP:
-- Manarune by Miziak, stages by Zellus, edit by kumpelek93 --

function onUse(cid, item, frompos, item2, topos) 
local config = { -- KONFIGURACJA 
    runeid = 2294, -- rune id //Miziak
    broadcast_gained_mana = false, -- show recovered mana in fancy text animation? (true/false) //kumpelek93
    turn_off = false, -- turn offon/turn on manarune(true - turn off/false - turn on) //kumpelek93
    turn_off_msg = "We are sorry, manarune is not working for a while.", -- text showed when turn_off = true //kumpelek93
    text_colour = 35, -- colour of text that recovered mana shows in (when broadcast_gained_mana = true) //Miziak
    mini_info = true, -- show how much mana points did you get in small white text at the bottom? (true/false) //kumpelek93
    effect_enable = true, -- show magic effect after using manarune? (true/false) //kumpelek93 
    effect = 12, -- magic effect that shows while using manarune //Miziak
    broadcast_text = true, -- You want character to broadcast text? Edit it below (true/false) //kumpelek93 
    text1 = "Mananation!", -- first level stage
    text2 = "Im near...", -- second level stage
    text3 = "Ive got the Power!", -- third level stage
    text4 = "Fuck Yes!", -- fourth level stage
    text5 = "I fell energy in my body!", -- fifth level stage
    text6 = "Its so fuckin awesome!", -- sixth level stage
    text_effect = 16, -- colour of broadcasted text. (1-yellow, 16-red)
    konczy_sie = true, -- does manarune finnish? (true/false) //Miziak
    end_effect_enable = true, -- show effect of the last use of manarune? (true/false) //kumpelek93
    end_effect = 22, -- magic effect of the last use of manarune (when end_effect_enable = true) //kumpelek93
    error_info_1 = "You only can use this rune on creatures.", -- error info when you choose wrong target //kumpelek93
    exh =  
    { 
        exh_enable = true, -- you want exhausted? (true/false) //Miziak
        co_ile = 0.4, -- how long? //Miziak
        stroge = 12345, //Miziak
        exh_info = "Jestes zmeczony", -- error info when you get exhausted //kumpelek93
    } 
}
 
 -- Zellus Stages --
   
local stages = { 
    stage1 = { 
        manamax=120, 
        manamin=50 
    }, 
    stage2 = { 
        manamax=240, 
        manamin=120 
    }, 
    stage3 = { 
        manamax=340, 
        manamin=240 
    }, 
    stage4 = { 
        manamax=440, 
        manamin=340 
    }, 
    stage5 = { 
        manamax=550, 
        manamin=440 
    }, 
    stage6 = { 
        manamax=800, 
        manamin=550 
    }, 
} 

    
local level = getPlayerLevel(cid) 

if level < 50 then -- If Player Level smaller than 60 
    stage = 'stage1' 
    text = config.text1
elseif level < 100 then -- Elseif player level smaller than 100 (and automatically bigger than 50) 
    stage = 'stage2'
    text = config.text2
elseif level < 150 then -- Elseif player level smaller than 150 (and automatically bigger than 100)   
    stage = 'stage3'
    text = config.text3 
elseif level < 200 then -- Elseif player level smaller than 200 (and automatically bigger than 150)   
    stage = 'stage4'
    text = config.text4 
elseif level < 250 then -- Elseif player level smaller than 250 (and automatically bigger than 200)   
    stage = 'stage5'
text = config.text5 
else                    -- Else player level bigger than 250  
    stage = 'stage6'
    text = config.text6 
end 
local manaplus = math.random(stages[stage].manamin, stages[stage].manamax) 

if(item.itemid == config.runeid)then 
    if(os.time() > getPlayerStorageValue(cid, config.exh.stroge)) then 
        if(item2.itemid == 1 and item2.uid ~= 0)then 
           if(config.turn_off) then
             doPlayerSendCancel(cid,config.turn_off_msg)

             else
            doPlayerAddMana(item2.uid, manaplus)
            
            
            if(config.broadcast_text) then
            doPlayerSay(cid,''..text..'',config.text_effect)
            end
            
            if(config.mini_info) then
            doPlayerSendCancel(cid,'You gained '..manaplus..' mana points.')
            end
           
            if(config.effect_enable) then
            doSendMagicEffect(topos,config.effect)
            end

            if(config.broadcast_gained_mana)then 
                doSendAnimatedText(topos,''.. manaplus ..'',config.text_colour)
            end
            if(config.exh.exh_enable)then 
                setPlayerStorageValue(cid, config.exh.stroge, os.time() + config.exh.co_ile) 
            end 
            if(config.konczy_sie)then 
                if(item.type > 1)then  
                    doChangeTypeItem(item.uid,item.type-1)  
                else 
                   if(config.end_effect_enable)then
                    doSendMagicEffect(topos,config.end_effect) 
                      end
                    doRemoveItem(item.uid,1)  
                end end 
            end 
        else 
            doPlayerSendCancel(cid,config.error_info_1) 
             
        end 
    else 
        doPlayerSendCancel(cid,config.exh.exh_info) 
        doSendMagicEffect(topos,2) 
    end 
end 
return 1 
end

So, what do you think?
 
Code:
    text5 = "I fell energy in my body!", -- fifth level stage

Best means worst grammar? :)

Bad tabbing aswell.
 
I don't believe you! Mana gain formula is better than stages. I have the best released manarune so far! :rolleyes:

Good work however though :D
 
Hi there
I want to present you manarune that we made on other Open Tibia forum.
It is newbie friendly script.
Works with 7.6-8.42, Im not sure about 8.42+.
Enjoy :)




PHP:
-- Manarune by Miziak, stages by Zellus, edit by kumpelek93 --

function onUse(cid, item, frompos, item2, topos) 
local config = { -- KONFIGURACJA 
    runeid = 2294, -- rune id //Miziak
    broadcast_gained_mana = false, -- show recovered mana in fancy text animation? (true/false) //kumpelek93
    turn_off = false, -- turn offon/turn on manarune(true - turn off/false - turn on) //kumpelek93
    turn_off_msg = "We are sorry, manarune is not working for a while.", -- text showed when turn_off = true //kumpelek93
    text_colour = 35, -- colour of text that recovered mana shows in (when broadcast_gained_mana = true) //Miziak
    mini_info = true, -- show how much mana points did you get in small white text at the bottom? (true/false) //kumpelek93
    effect_enable = true, -- show magic effect after using manarune? (true/false) //kumpelek93 
    effect = 12, -- magic effect that shows while using manarune //Miziak
    broadcast_text = true, -- You want character to broadcast text? Edit it below (true/false) //kumpelek93 
    text1 = "Mananation!", -- first level stage
    text2 = "Im near...", -- second level stage
    text3 = "Ive got the Power!", -- third level stage
    text4 = "Fuck Yes!", -- fourth level stage
    text5 = "I fell energy in my body!", -- fifth level stage
    text6 = "Its so fuckin awesome!", -- sixth level stage
    text_effect = 16, -- colour of broadcasted text. (1-yellow, 16-red)
    konczy_sie = true, -- does manarune finnish? (true/false) //Miziak
    end_effect_enable = true, -- show effect of the last use of manarune? (true/false) //kumpelek93
    end_effect = 22, -- magic effect of the last use of manarune (when end_effect_enable = true) //kumpelek93
    error_info_1 = "You only can use this rune on creatures.", -- error info when you choose wrong target //kumpelek93
    exh =  
    { 
        exh_enable = true, -- you want exhausted? (true/false) //Miziak
        co_ile = 0.4, -- how long? //Miziak
        stroge = 12345, //Miziak
        exh_info = "Jestes zmeczony", -- error info when you get exhausted //kumpelek93
    } 
}
 
 -- Zellus Stages --
   
local stages = { 
    stage1 = { 
        manamax=120, 
        manamin=50 
    }, 
    stage2 = { 
        manamax=240, 
        manamin=120 
    }, 
    stage3 = { 
        manamax=340, 
        manamin=240 
    }, 
    stage4 = { 
        manamax=440, 
        manamin=340 
    }, 
    stage5 = { 
        manamax=550, 
        manamin=440 
    }, 
    stage6 = { 
        manamax=800, 
        manamin=550 
    }, 
} 

    
local level = getPlayerLevel(cid) 

if level < 50 then -- If Player Level smaller than 60 
    stage = 'stage1' 
    text = config.text1
elseif level < 100 then -- Elseif player level smaller than 100 (and automatically bigger than 50) 
    stage = 'stage2'
    text = config.text2
elseif level < 150 then -- Elseif player level smaller than 150 (and automatically bigger than 100)   
    stage = 'stage3'
    text = config.text3 
elseif level < 200 then -- Elseif player level smaller than 200 (and automatically bigger than 150)   
    stage = 'stage4'
    text = config.text4 
elseif level < 250 then -- Elseif player level smaller than 250 (and automatically bigger than 200)   
    stage = 'stage5'
text = config.text5 
else                    -- Else player level bigger than 250  
    stage = 'stage6'
    text = config.text6 
end 
local manaplus = math.random(stages[stage].manamin, stages[stage].manamax) 

if(item.itemid == config.runeid)then 
    if(os.time() > getPlayerStorageValue(cid, config.exh.stroge)) then 
        if(item2.itemid == 1 and item2.uid ~= 0)then 
           if(config.turn_off) then
             doPlayerSendCancel(cid,config.turn_off_msg)

             else
            doPlayerAddMana(item2.uid, manaplus)
            
            
            if(config.broadcast_text) then
            doPlayerSay(cid,''..text..'',config.text_effect)
            end
            
            if(config.mini_info) then
            doPlayerSendCancel(cid,'You gained '..manaplus..' mana points.')
            end
           
            if(config.effect_enable) then
            doSendMagicEffect(topos,config.effect)
            end

            if(config.broadcast_gained_mana)then 
                doSendAnimatedText(topos,''.. manaplus ..'',config.text_colour)
            end
            if(config.exh.exh_enable)then 
                setPlayerStorageValue(cid, config.exh.stroge, os.time() + config.exh.co_ile) 
            end 
            if(config.konczy_sie)then 
                if(item.type > 1)then  
                    doChangeTypeItem(item.uid,item.type-1)  
                else 
                   if(config.end_effect_enable)then
                    doSendMagicEffect(topos,config.end_effect) 
                      end
                    doRemoveItem(item.uid,1)  
                end end 
            end 
        else 
            doPlayerSendCancel(cid,config.error_info_1) 
             
        end 
    else 
        doPlayerSendCancel(cid,config.exh.exh_info) 
        doSendMagicEffect(topos,2) 
    end 
end 
return 1 
end

So, what do you think?

Lua:
	stages = { 
		[50] = { 
			manamax=120, 
			manamin=50,
			text = "Mananation!"
		}, 
		[100] = { 
			manamax=240, 
			manamin=120,
			text = "I'm near..."
		}, 
		[150] = { 
			manamax=340, 
			manamin=240,
			text = "I've got the Power!"
		}, 
		[200] = { 
			manamax=440, 
			manamin=340,
			text = "Fuck Yes!"
		}, 
		[250] = { 
			manamax=550,
			manamin=440,
			text = "I feel energy in my body!"
		}, 
		[300] = { 
			manamax=800, 
			manamin=550,
			text = "It's so fuckin awesome!"
		}
	}  


	for levels, values in ipairs(stages) do
		if(levels == table.maxn(stages[levels])) then
			text = values.text
			manaplus = math.random(values.manamin, values.manamax)
			break
		end
		if(getPlayerLevel(cid) < levels) then
			text = values.text
			manaplus = math.random(values.manamin, values.manamax)
			break
		end
	end

Here you are, a clear loop how to make the stages part optimized.

And by the way, you can make
Lua:
doPlayerSay(cid, text, config.text_effect)
instead of
Lua:
doPlayerSay(cid,''..text..'',config.text_effect)
.

I don't believe you! Mana gain formula is better than stages.

It depends what you're after. But in most cases - yes mana gain formula is better than stages.
 
Back
Top