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

Custom Potion HP to knights, MANA to Sorc/Druid and less mana/hp to Palas (RELEASE)

Pheenix

Mr.Plain Awesome
Joined
Mar 28, 2011
Messages
152
Reaction score
14
Location
Sweden
First custom action item.. i replaced Strong Spirit potion herpa derp, what cha'll think?

EDIT: So i replaced it again and made it a rune instead with id 2307 (ppl with manarune usually use this id)

goto /data/actions/ in your tfs folder, make a new line in actions.xml and paste:
Code:
	<action itemid="2307" script="customrune.lua" allowfaruse="1"/>

after that make a new file in /data/actions/scripts/ called customrune.lua and paste this:

PHP:
--  Config Start
local minLVL = 150 	-- Minimum Level required to use the rune
local minLT = "This is the message sent to players below the minimum level required"  -- Change to whatever you want but leave the quotations
local potSay = "This is the message sent to the player when the rune has been used" -- Change to whatever you want but leave the quotations
local mEff = 36 -- Change magic effect to whatever you want it to be, test with /z [param] command (displayed on target)


local HMIN = 900 	-- Minimum health to knights
local HMAX = 1100	-- Maximum health to knights

local MMIN = 250 	-- Minimum mana to sorc/druids
local MMAX = 350 	-- Maximum mana to sorc/druids

local PHMI = 300 	-- Minimum health to paladins
local PHMA = 500 	-- Maximum health to paladins
local PMMI = 160 	-- Minimum mana to paladins
local PMMA = 250 	-- Maximum mana to paladins

-- Config End




local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPos, itemEx, toPos)

	if isPlayer(itemEx.uid) == FALSE then
		return FALSE
	end

	if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
	end

	if getPlayerLevel(itemEx.uid) < minLVL and getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) == FALSE then
		doCreatureSay(cid, minLT, TALKTYPE_ORANGE_1)
		return TRUE
	end

	if ((isSorcerer(itemEx.uid) or isDruid(itemEx.uid) or getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) == TRUE)) then
			doCreatureAddMana(itemEx.uid, math.random(MMIN, MMAX))
	
	elseif (isKnight(itemEx.uid) or getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) == TRUE) then
			doCreatureAddHealth(itemEx.uid, math.random(HMIN, HMAX))

	elseif (isPaladin(itemEx.uid) or getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) == TRUE) then
			doCreatureAddHealth(itemEx.uid, math.random(PHMI, PHMA))
			doCreatureAddMana(itemEx.uid, math.random(PMMI, PMMA))

 	end

	doSendMagicEffect(getThingPos(itemEx.uid), mEff)
	doAddCondition(cid, exhaust)
	doCreatureSay(itemEx.uid, potSay, TALKTYPE_ORANGE_1)
	doRemoveItem(item.uid, 1)
	 return TRUE
end

edit the config to your needs, save it, reload actions and voila!


to change the name of the rune from "spellrune" to something else, go to items.xml and search for id 2307


this should probably be moved to actions forum aswell.. my bad
 
Last edited:
Back
Top