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

Need Manarune 8.4

paola92

Member
Joined
Jan 14, 2009
Messages
105
Solutions
1
Reaction score
6
I need script for manarune an level and magic level. Tibia 8.4. TFS.
 
PHP:
--by Keraxel // for otcentrum.pl // based on Killavus code
function onUse(cid, item, frompos, item2, topos)

--Config
local config = {
exhausted_seconds == 1,  -- Przez ile sekund gracz musi odczekaæ, aby ponownie u¿yæ manaruny
exhausted_storagevalue = 70002, -- Storage Value do przechowywania exhaustu. MUSI byæ wolne.
minValue = 450, --minimalna wartosc jaka dodaje manaruna // 0 dla braku wartoœci minimalnej
	multiplers = { --ta linie zostaw :) edytuj ponizsze wartosci (mozna równiez podawac procentowo, np. dla levela domyslnie byloby to 250%)
		level = {2.5, 2.5},		--poziom
		magicLevel = {6, 6},	--poziom magiczny
		clubFighting = {0, 0},	--skill w clubie
		swordFighting = {0, 0},	--skill w swordzie
		axeFighting = {0, 0}, --skill w axe
		distance = {1, 1.2}, --skill w diœcie
		fistFighting = {1, 2}, --skill w fist fighting
		shielding = {0, 0}, --skill w shieldingu
		other = {(-150), 150} --dodatkowa mana, któr¹ dostanie gracz // dla odebrania Y many podaj (-Y)
	}
}
--/Config

	local multipler = config.multiplers
	local level = getPlayerLevel(cid)
	local magicLevel = getPlayerMagLevel(cid)
	local swordFighting = getPlayerSkill(cid, 4)
	local clubFighting = getPlayerSkill(cid, 4)
	local axeFighting = getPlayerSkill(cid, 4)
	local distance = getPlayerSkill(cid, 4)
	local fistFighting = getPlayerSkill(cid, 0)
	local shielding = getPlayerSkill(cid, 6)
	
	local addValue = math.max(math.random((level * multipler.level[1]), (level * multipler.level[2])) + math.random((magicLevel * multipler.magicLevel[1]), (magicLevel * multipler.magicLevel[2])) + math.random((swordFighting * multipler.swordFighting[1]), (swordFighting * multipler.swordFighting[2])) + math.random((clubFighting * multipler.clubFighting[1]), (clubFighting * multipler.clubFighting[2])) + math.random((axeFighting * multipler.axeFighting[1]), (axeFighting * multipler.axeFighting[2])) + math.max(math.random((fistFighting * multipler.fistFighting[1]), (fistFighting * multipler.fistFighting[2])) + math.random((distance * multipler.distance[1]), (distance * multipler.distance[2])) + math.random((level * multipler.shielding[1]), (level * multipler.shielding[2])), config.minValue)

			if(os.time() > getPlayerStorageValue(cid, config.exhausted_storagevalue)) then
				if(isPlayer(item2.uid) == 1) then
					doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
					doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
					doSendAnimatedText(topos, addValue, TEXTCOLOR_LIGHTBLUE)
					doPlayerAddMana(item2.uid, addValue)
					setPlayerStorageValue(cid, config.exhausted_storagevalue, os.time() + config.exhausted_seconds)
					if(item.type > 1) then
						doChangeTypeItem(item.uid, item.type - 1)
					else
						doRemoveItem(item.uid, 1)
					end
				else
					doSendMagicEffect(frompos, CONST_ME_POFF)
					doPlayerSendCancel(cid, "You can use this rune only on players.")
				end
			else
				doSendMagicEffect(frompos, CONST_ME_POFF)
				doPlayerSendCancel(cid, "You are exhausted.")
			end
						
	return TRUE
end
Don't mind the comments.
 
Its not mine, but i hope this help u :p..

manarune with magic level, and level balance ;)!

This in action.xml
Code:
<action itemid="2270" aggressive="0" script="manarune.lua"/>

data\actions\scripts
Code:
-- 90% made by Colandus (Except exhaustion system).
-- If you edit on this script, be sure that you leave the credits to me, Colandus.

-- 10% Modified by Arthur, aka artofwork
-- changes made were added magic level formula to minMana & maxMana anything not needed was commented out.
 
function onUse(cid, item, frompos, item2, topos)
-- beginning of changes made are below
		local ml = getPlayerMagLevel(cid, true)
		local level = getPlayerLevel(cid)
		minMana = (level * 1 + ml * 4) * 2.08
		maxMana = (level * 1 + ml * 4) * 2.7
		local total = math.random(minMana, maxMana)
-- end of changes made
---------------------------------------------------------------------------------------------
        magToUse = 0 -- What magic level do you need to be to use the rune?
		runeID = 2270 -- Enter the item Id of the rune.
		loseCharges = true -- Write "true" if it shall lose charges. If not, then write something else such as "false".
		storeValue = 3567 -- Value where exhaust is saved.
		exhaustTime = 2 -- 1 = 1 second of exhaustion.
		animationColor = 41 -- The color of the "animation".
		mLvlLowMsg = "Your magic level is too low." -- Appears when player got too low magic level.
		missPlayerMsg = "You can only use this rune on players."-- Appears when you don't shoot on a player.
		exhaustMsg = "You are exhausted." -- Appears when you are exhausted.
 
		if item.itemid == runeID then
			if getThingfromPos({x=topos.x, y=topos.y, z=topos.z, stackpos=253}).itemid > 0 then
				if getPlayerMagLevel(cid) >= magToUse then
					if (exhaust(cid, storeValue, 1) > 0) then
						if loseCharges == true or loseCharges == True then
					--if item.type > 1 then
						--doChangeTypeItem(item.uid, item.type-1)
					--else
						--doRemoveItem(item.uid, 1)
					end
						end
					mana = math.random(minMana, maxMana)
					newMana = mana+getPlayerLevel(cid)+getPlayerMagLevel(cid)
					manaNow = getPlayerMana(item2.uid)
					doPlayerAddMana(item2.uid, total, FALSE)
					manaMax = getPlayerMana(item2.uid)
					doPlayerAddMana(item2.uid, - manaMax + manaNow, FALSE)
					nMana = manaMax - manaNow
				if newMana > nMana then
					newMana = nMana
				end
				if getPlayerMana(item2.uid) == manaMax then
					if getPlayerPosition(cid).x == getPlayerPosition(item2.uid).x and getPlayerPosition(cid).y == getPlayerPosition(item2.uid).y then
						--doPlayerSendCancel(item2.uid, "Your mana is already full.")
						--doChangeTypeItem(item.uid, item.type)
						else
						--doPlayerSendCancel(cid, "" .. getPlayerName(item2.uid) .. " mana is already full.")
						--doChangeTypeItem(item.uid, item.type)
						end
					else
				if getPlayerPosition(cid).x == getPlayerPosition(item2.uid).x and getPlayerPosition(cid).y == getPlayerPosition(item2.uid).y then
					doSendMagicEffect(getPlayerPosition(cid), 12)
					--doPlayerSendTextMessage(cid, 23, "You received " .. newMana .. " mana.")
				else
					doSendMagicEffect(getPlayerPosition(cid), 14)
					doSendMagicEffect(getPlayerPosition(item2.uid), 12)
					--doPlayerSendTextMessage(item2.uid, 23, "You received " .. newMana .. " mana.")
					--doPlayerSendTextMessage(cid, 23, "You gave " .. getPlayerName(item2.uid) .. " " .. newMana .. " mana.")
				end
					doPlayerAddMana(item2.uid, newMana, FALSE)
					doSendAnimatedText(getPlayerPosition(item2.uid), newMana, animationColor)
				end
			else
				doPlayerSendCancel(cid, exhaustMsg)
			end
			else
				--doSendMagicEffect(getPlayerPosition(cid), 2)
				--doPlayerSendCancel(cid, mLvlLowMsg)
			end
			else
				--doSendMagicEffect(getPlayerPosition(cid), 2)
                --doPlayerSendCancel(cid, missPlayerMsg)
			end
	  return 1
	end
 -- end
 
 
-- Exhaustion system (Made by Alreth, bugfix by me)
-- DO NOT EDIT!
function exhaust(cid, storeValue, exhaustTime)
 
    newExhaust = os.time()
    oldExhaust = getPlayerStorageValue(cid, storeValue)
    if (oldExhaust == nil or oldExhaust < 0) then
        oldExhaust = 0
    end
    if (exhaustTime == nil or exhaustTime < 0) then
        exhaustTime = 1
    end
    diffTime = os.difftime(newExhaust, oldExhaust)
    if (diffTime >= exhaustTime) then
        setPlayerStorageValue(cid, storeValue, newExhaust) 
        return 1
    else
        return 0
    end
end
 
1: Go in to yourotfolder/data/spells/scripts

2: Make an new folder with name custom

3: add an .lua file into the custom map and name it to "manarune"

4: open the lua file "manarune" and put this script in

PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(cid, var)
doPlayerAddMana(cid, 550) 
return doCombat(cid, combat, var)
end

4: Go to yourotfolder/data/spells and open spells.xml and add
PHP:
<rune name="manarune" id="2298" charges="20" maglv="1" exhaustion="430" blocktype="solid" allowfaruse="1" aggressive="0" script="custom/manarune.lua"/>

Under "healing runes"

Hope i helped you :D

Rep++ please ;)
 
[01/03/2009 09:53:30] Error: [RuneSpell::configureSpell] Rune spell without id.
[01/03/2009 09:53:30] Warning: [BaseEvents::loadFromXml] Can not configure event
[01/03/2009 09:53:30] Warning: [Event::loadScript] Can not load script. data/spells/scripts/ostra.lua
[01/03/2009 09:53:30] data/spells/scripts/ostra.lua:35: ')' expected (to close '(' at line 33) near 'if'
[01/03/2009 09:53:31] Reloaded spells.

;(
 
Working on all TFS:
data/spells/scripts
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(cid, var)

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
local pos = getPlayerPosition(cid)

-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 3) + (mlevel * 3) - 50
local mana_maximum = (level * 4) + (mlevel * 3)
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
doSendMagicEffect(pos,28)
doPlayerAddMana(cid, mana_add)
doSendAnimatedText(pos, mana_add, TEXTCOLOR_LIGHTBLUE)
doCreatureSay(cid, "_+_MaNa PoWeR_+_", TALKTYPE_ORANGE_1)
return doCombat(cid, combat, var)
end
 
Simple
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(cid, var)
local mana = math.random(300, 500)
doPlayerAddMana(cid, mana)
--doSendAnimatedText(getPlayerPosition(cid), '+' .. mana, TEXTCOLOR_GOLD)
return doCombat(cid, combat, var)
end
 
OMG

Working on all TFS:
data/spells/scripts
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(cid, var)

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
local pos = getPlayerPosition(cid)

-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 3) + (mlevel * 3) - 50
local mana_maximum = (level * 4) + (mlevel * 3)
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
doSendMagicEffect(pos,28)
doPlayerAddMana(cid, mana_add)
doSendAnimatedText(pos, mana_add, TEXTCOLOR_LIGHTBLUE)
doCreatureSay(cid, "_+_MaNa PoWeR_+_", TALKTYPE_ORANGE_1)
return doCombat(cid, combat, var)
end

This manarun is working on all TFS !
And this manarun is in spells.
 
spells/scripts
manarune.lua

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(cid, var)
    local mana = math.random(600, 600)
    doPlayerAddMana(cid, mana)
    return doCombat(cid, combat, var)	   	
end

spells.xml
Code:
<rune name="mana rune" id="IDRune" needtarget="1"  charges="4" lvl="10" maglv="2" mana="0" aggressive="0" soul="0" exhaustion="1000" prem="0" enabled="1" allowfaruse="1" script="manarune.lua"></rune>
 
Back
Top