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

MoveEvent Health/Mana Tiles Tutorial Tfs 0.4

jypy

Polyvalent
Joined
Nov 15, 2012
Messages
69
Reaction score
19
Location
Canada
Hello Otlanders, I tried to find a health/mana tiles tutorial for my highexp server and I did not find anything, so I thought it would be useful to make one :)

  1. Create a file in data/movements/scripts/hptile.lua and put this :

    Code:
    -- Script Made by Jypy
    function onStepIn(cid, item, position)
    if getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
    doCreatureAddHealth(cid, 1000000000, FALSE)
    doSendAnimatedText(getThingPos(cid), "Refilled!", TEXTCOLOR_RED)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Refilled!")
    else
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You are already refilled!")
    end
    return true
    end

  2. Create a file in data/movements/scripts/manatile.lua and put this :

    Code:
    -- Script Made by Jypy
    function onStepIn(cid, item, position)
    if getCreatureMana(cid) < getCreatureMaxMana(cid) then
    doCreatureAddMana(cid, 1000000000, FALSE)
    doSendAnimatedText(getThingPos(cid), "Refilled!", TEXTCOLOR_BLUE)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Refilled!")
    else
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are already refilled!")
    end
    return true
    end

  3. In data/movements/movements.xml put this :

    Code:
    <movevent type="StepIn" actionid="9562" event="script" value="hptile.lua"/>
    <movevent type="StepIn" actionid="9563" event="script" value="manatile.lua"/>

  4. In your map editor, set your mana tile action id to 9563 and for health tile action id to 9562
Hope it helped :)
 
Last edited:
Nice Script For a Newbie :)
Few tips for better scripting
1-
Code:
doCreatureAddMana(cid, 1000000000, FALSE)
don't use 100000000.Use it Like This
Code:
doCreatureAddMana(cid, getCreatureMaxMana(cid), FALSE)
2-Tab your scripts
 
It depends how much he wants the player to be healed tho, its easier to state that you want the player to regain maxhealth/maxmana
 
doCreatureAddMana(cid, (getCreatureMaxMana(cid)-getCreatureMana(cid)), false)
 
Back
Top