• 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
Best answers
0
Reaction score
13
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:

tetra20

DD
Joined
Jan 17, 2009
Messages
1,305
Best answers
4
Reaction score
290
Location
Egypt
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
 

DestinationSer

@echo off
Joined
Mar 7, 2009
Messages
2,793
Best answers
0
Reaction score
589
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
 

Erexo

Kage
Premium User
Joined
Mar 27, 2010
Messages
723
Best answers
5
Reaction score
145
Location
Pr0land
doCreatureAddMana(cid, (getCreatureMaxMana(cid)-getCreatureMana(cid)), false)
 
OP
jypy

jypy

Polyvalent
Joined
Nov 15, 2012
Messages
69
Best answers
0
Reaction score
13
Location
Canada
Thanks for your tips guys! I appreciate! :)
 
Top