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
buffer.lua
Feel free to rep me if you like it
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: