Shadowsong
Game Developer & Graphic Designer
- Joined
- Feb 23, 2010
- Messages
- 3,446
- Solutions
- 21
- Reaction score
- 3,001
- Location
- Bosnia & Herzegovina
- YouTube
- ShivaShadowsong
For all the RPG developers out there, I bring you a nice little amulet to add to that RPG touch.
Poisondrop Amulet
For: TFS 0.3.6
What does it do?
It has 100 charges, protecting you from up to 15% earth/poison damage you receive.
The fun part is its [Remove Poison] effect, that you can use up to 10 times to cleanse yourself
of a nasty poison. The amulet will not disappear once you use up its special effect.
Action script:
HTML:
-- Poisondrop amulet
-- by Shiva Shadowsong
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- A single storage that is free to use:
local storageUsed = 25105
-- NOTE: Action IDs assigned with this item must not be used anywhere else.
-- If the values I placed here overlap with another script of yours,
-- change them to something that won't interfere
if not (getCreatureCondition(cid, CONDITION_POISON)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not currently poisoned.")
return false
end
if not(exhaustion.check(cid,storageUsed)) then
if item.actionid < 25430 then
doItemSetAttribute(item.uid, 'aid', 25446)
doItemSetAttribute(item.uid, 'specialdescription', "\n[Remove Poison] charges: [9/10]")
elseif item.actionid == 25437 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Can not use the [Remove Poison] effect anymore. Not enough stacks left on the amulet.")
return false
else
doItemSetAttribute(item.uid, 'aid', item.actionid-1)
doItemSetAttribute(item.uid, 'specialdescription', "\n[Remove Poison] charges: [" ..(9-((25447)-(item.actionid))).. "/10]")
end
exhaustion.set(cid, storageUsed, 35)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Poisondrop Amulet]: You were cured of poisoning.")
doRemoveCondition(cid, CONDITION_POISON)
doSendMagicEffect(getThingPos(cid), 463)
else
doPlayerSendCancel(cid, "You need to wait "..exhaustion.get(cid, storageUsed).." seconds before you can use it.")
end
return true
end
Put that script in your actions/scripts/tools/ and name it poisondropamulet.lua
Then in actions.xml, add:
<action itemid="IDOFAMULET" event="script" value="tools/poisondropamulet.lua"/>
In items.xml, you should add this:
<attribute key="weight" value="500" />
<attribute key="slotType" value="necklace" />
<attribute key="charges" value="100" />
<attribute key="showcharges" value="1" />
<attribute key="absorbPercentEarth" value="15" />
<attribute key="showattributes" value="1" />
<attribute key="description" value="It looks like a green tear because Snakes can only cry once you wear it against them.
[Remove Poison]: You can [Use] this amulet to cure poisoning up to 10 times. The amulet will not disappear once all stacks are used up.
Cooldown: 35 seconds." />
</item>
And in movements.xml, add this:
<movevent type="Equip" itemid="IDOFAMULET" slot="necklace" event="function" value="onEquipItem"/>
<movevent type="DeEquip" itemid="IDOFAMULET" slot="necklace" event="function" value="onDeEquipItem"/>