• 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 Items that buff!

Darad

New Member
Joined
Jun 23, 2009
Messages
119
Reaction score
1
Hi guys,

my latest script, items that buff the player temporarily.

Notice: The mana buff gives a GM character the extra 10% mana, but he cannot fill it up with a mana potion. Normal players can though.
Relogging and dying removes the buff.


actions.xml
PHP:
	<action itemid="1983" event="script" value="custom/buffer.lua"/>
	<action itemid="1984" event="script" value="custom/buffer.lua"/>
	<action itemid="1985" event="script" value="custom/buffer.lua"/>

buffer.lua
PHP:
local config = {
	[1983] = {
		type = "mana"
	},
	
	[1984] = {
		type = "hp"
	},
	
	[1985] = {
		type = "skills"
	}
}

local hpcondition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(hpcondition, CONDITION_PARAM_TICKS, 20 * 60 * 1000)
setConditionParam(hpcondition, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 110)
setConditionParam(hpcondition, CONDITION_PARAM_BUFF, TRUE)

local manacondition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(manacondition, CONDITION_PARAM_TICKS, 20 * 60 * 1000)
setConditionParam(manacondition, CONDITION_PARAM_STAT_MAXMANAPERCENT, 110)
setConditionParam(manacondition, CONDITION_PARAM_BUFF, TRUE)

local skillcondition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(skillcondition, CONDITION_PARAM_TICKS, 20 * 60 * 1000)
setConditionParam(skillcondition, CONDITION_PARAM_STAT_MAGICLEVELPERCENT, 120)
setConditionParam(skillcondition, CONDITION_PARAM_SKILL_FISTPERCENT, 120)
setConditionParam(skillcondition, CONDITION_PARAM_SKILL_CLUBPERCENT, 120)
setConditionParam(skillcondition, CONDITION_PARAM_SKILL_SWORDPERCENT, 120)
setConditionParam(skillcondition, CONDITION_PARAM_SKILL_AXEPERCENT, 120)
setConditionParam(skillcondition, CONDITION_PARAM_SKILL_DISTANCEPERCENT, 120)
setConditionParam(skillcondition, CONDITION_PARAM_SKILL_SHIELDPERCENT, 120)
setConditionParam(skillcondition, CONDITION_PARAM_BUFF, TRUE)



function onUse(cid, item, fromPosition, itemEx, toPosition)
	local type = config[item.itemid].type
	local pos = getPlayerPosition(cid)
	
	if(type == "hp") then
		doAddCondition(cid, hpcondition)
		doSendAnimatedText(pos, 'HP UP', TEXTCOLOR_YELLOW)
	elseif(type == "mana") then
		doAddCondition(cid, manacondition)
		doSendAnimatedText(pos, 'MANA UP', TEXTCOLOR_YELLOW)
	elseif(type == "skills") then
		doAddCondition(cid, skillcondition)
		doSendAnimatedText(pos, 'SKILLS UP', TEXTCOLOR_YELLOW)
	end
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)
	doRemoveItem(item.uid)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You are now buffed up! WARNING: Using another buff will replace this one!")	
	return true
end

Feel free to rep me if you like it :)
 
Last edited:
~tested on TFS 3.5.1

Great release it's all working!
REP++ FOR YOU!

~Feel free to if my post helped you :D
----------------------------------------------------------------

 
Back
Top Bottom