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

Manarune

Status
Not open for further replies.

Saj

Remember my name
Joined
Feb 26, 2008
Messages
2,127
Reaction score
6
Hey, could someone add so this manarune is only used by sorc and druids?

Code:
function onUse(cid, item, frompos, item2, topos)

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

-- Exhausted Settings --
local exhausted_seconds = 1 -- How many seconds manarune will be unavailible to use. --
local exhausted_storagevalue = 7000 -- Storage Value to store exhaust. It MUST be unused! --
-- Exhausted Settings END --

-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 1) + (mlevel * 2) - 100
local mana_maximum = (level * 1) + (mlevel * 2)
-- Mana Formula Settings END --

local mana_add = math.random(500, 1000)

-- We check the charges. --
if(item.type > 1) then
-- Exhausted check. --
if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
-- Entity is player? --
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doChangeTypeItem(item.uid, item.type - 1)
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
else
if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
else
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doRemoveItem(item.uid, 1)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You can use this rune only on players.")
end
end
end

return 1
end
 
Code:
function onUse(cid, item, frompos, item2, topos)

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

-- Exhausted Settings --
local exhausted_seconds = 1 -- How many seconds manarune will be unavailible to use. --
local exhausted_storagevalue = 7000 -- Storage Value to store exhaust. It MUST be unused! --
-- Exhausted Settings END --

-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 1) + (mlevel * 2) - 100
local mana_maximum = (level * 1) + (mlevel * 2)
-- Mana Formula Settings END --

local mana_add = math.random(500, 1000)
if (not(isSorcerer(cid))
doCreatureSay(cid, "Only for Sorcerer or Druid", TALKTYPE_ORANGE_1)
return TRUE
if (not(isDruid(cid))
doCreatureSay(cid, "Only for Sorcerer or Druid", TALKTYPE_ORANGE_1)
return TRUE
end
-- We check the charges. --
if(item.type > 1) then
-- Exhausted check. --
if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
-- Entity is player? --
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doChangeTypeItem(item.uid, item.type - 1)
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
else
if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
else
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doRemoveItem(item.uid, 1)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You can use this rune only on players.")
end
end
end

return 1
end
i´m beginer in lua but i think this wil help you =)
updated the code may it work now
 
Last edited:
try this ;)
PHP:
function onUse(cid, item, frompos, item2, topos)

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

-- Exhausted Settings --
local exhausted_seconds = 1 -- How many seconds manarune will be unavailible to use. --
local exhausted_storagevalue = 7000 -- Storage Value to store exhaust. It MUST be unused! --
-- Exhausted Settings END --

-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 1) + (mlevel * 2) - 100
local mana_maximum = (level * 1) + (mlevel * 2)
-- Mana Formula Settings END --

local mana_add = math.random(500, 1000)
-- We check the Voc. --
if getPlayerVocation(cid) == 1 or 2 or 5 or 6 then
else
doCreatureSay(cid, "Only for Sorcerer or Druid", TALKTYPE_ORANGE_1)
dosend
-- We check the charges. --
if(item.type > 1) then
-- Exhausted check. --
if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
-- Entity is player? --
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doChangeTypeItem(item.uid, item.type - 1)
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
else
if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
else
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doRemoveItem(item.uid, 1)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You can use this rune only on players.")
end
end
end

return 1
end
Made it real fast since I gtg
 
Last edited:
if getPlayerVocation(cid) == 1 or 2 or 3 or 4 then
else


You are saying that IF the vocation is a sorc,druid,pala or a knight then it doesnt do anything. If it has an other voc than it would work..
 
Why do it so extremely complicated? I can show you a trick I learned from Nahruto.

Will edit post soon~


EDIT1: open spells.xml
PHP:
	<rune name="manarune" id="xxxx" allowfaruse="1" charges="5" lvl="20" maglv="18" mana="0" needtarget="1" blocktype="solid" script="support/manarune.lua"/>
Ok we got this one, but hmmm, we want to make it for more vocations?

If you see ""support/manarune.lua"/>" you see that "/>" is an end tag. So why don't we remove that end tag so we can continue this tag? Lets try it out:
PHP:
	<rune name="manarune" id="xxxx" allowfaruse="1" charges="5" lvl="20" maglv="18" mana="0" needtarget="1" blocktype="solid" script="support/manarune.lua">
		<vocation name="Sorcerer"/>
		<vocation name="Druid"/>
		<vocation name="Master Sorcerer"/>
		<vocation name="Elder Druid"/>
	</rune>

As you see, we added vocation names, and we moved the end tag a bit ahead.
Tested with paralyze runes for druids. This works perfectly.

Guess who loves REP? (a)
 
Last edited:
Here:

Code:
function onUse(cid, item, frompos, item2, topos)

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

local exhausted_seconds = 1 -- How many seconds manarune will be unavailible to use. --
local exhausted_storagevalue = 7000 -- Storage Value to store exhaust. It MUST be unused! --

local mana_minimum = (level * 1) + (mlevel * 2) - 100
local mana_maximum = (level * 1) + (mlevel * 2)

local mana_add = math.random(500, 1000)

	if getPlayerVocation(cid) <= 2 then
		if(item.type > 1) then
			if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
				if(isPlayer(item2.uid) == 1) then
					doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
					doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
					doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
					doPlayerAddMana(item2.uid, mana_add)
					setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
					doChangeTypeItem(item.uid, item.type - 1)
				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
		else
			if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
				doSendMagicEffect(frompos, CONST_ME_POFF)
				doPlayerSendCancel(cid, "You are exhausted.")
			else
				if(isPlayer(item2.uid) == 1) then
					doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
					doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
					doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
					doPlayerAddMana(item2.uid, mana_add)
					setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
					doRemoveItem(item.uid, 1)
				else
					doSendMagicEffect(frompos, CONST_ME_POFF)
					doPlayerSendCancel(cid, "You can use this rune only on players.")
				end
			end
		end
	else
	doCreatureSay(cid, "Only Sorcerer and Druid can use this rune.", TALKTYPE_ORANGE_1)
	end
return 1
end
 
Last edited:
if getPlayerVocation(cid) == 1 or 2 or 3 or 4 then
else


You are saying that IF the vocation is a sorc,druid,pala or a knight then it doesnt do anything. If it has an other voc than it would work..
Updated my post sry didn't notice it.
I had to go fast so I just made real fast edit xD
 
Look at my edited post above ....

PWNE3D U ALL! Jonern~ Style. ^^
 
Why do it so extremely complicated? I can show you a trick I learned from Nahruto.

Will edit post soon~


EDIT1: open spells.xml
PHP:
	<rune name="manarune" id="xxxx" allowfaruse="1" charges="5" lvl="20" maglv="18" mana="0" needtarget="1" blocktype="solid" script="support/manarune.lua"/>
Ok we got this one, but hmmm, we want to make it for more vocations?

If you see ""support/manarune.lua"/>" you see that "/>" is an end tag. So why don't we remove that end tag so we can continue this tag? Lets try it out:
PHP:
	<rune name="manarune" id="xxxx" allowfaruse="1" charges="5" lvl="20" maglv="18" mana="0" needtarget="1" blocktype="solid" script="support/manarune.lua">
		<vocation name="Sorcerer"/>
		<vocation name="Druid"/>
		<vocation name="Master Sorcerer"/>
		<vocation name="Elder Druid"/>
	</rune>

As you see, we added vocation names, and we moved the end tag a bit ahead.
Tested with paralyze runes for druids. This works perfectly.

Guess who loves REP? (a)

Look at my edited post above ....

PWNE3D U ALL! Jonern~ Style. ^^

You just pawnedt yourself, this is not a spell rune its a actionscript rune. :) rep--; :(
 
WooT?! He calls it a "manarune" :C!

Just take and make a manarune then! As the topic of this thread is named.
 
Dude, not used to be global mod or? DO IT URSELF! xD

The threadname tricked me totaly! Aaaerrrghhhh!
 
Status
Not open for further replies.
Back
Top