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

xTremoxx

domasturb(cid, genital)
Joined
Aug 11, 2007
Messages
418
Reaction score
6
Location
Brazil

Information:

Hi, i'm noob in scripting area, this is my first script, please give suggestions for me, about my script:

When you use one item (2346) add +250 points in you health, and 500 points in you mana, this points you can edit. lets begin:


Script:

Create one file in Actions/Scripts, with name restore.lua

Copy & Paste this:

PHP:
--- CREATED BY BRYAN GROBMANN (XTREMOXX) ---

function onUse(cid, item, frompos, item2, topos)
local MANA = 500
local LIFE = 250

doCreatureAddMana(cid, MANA)
doCreatureAddHealth(cid, LIFE)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_MAGIC_BLUE)
doCreatureSay(cid, "Guuulp", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid)
end

In actions.xml:
PHP:
<action itemid="2346" script="restore.lua"/>

Editing & SS:

I'm using itemid 2346, (
imagemjtl.png
) but you can edit.


After you use:

imagemgki.png


Guuuulp.. : Message When player use Item
LIFE: Who much Health restore
MANA: Who much Mana restore



EDITED POST:

SCRIPT WITH RANDOM VALUES!!! SPECIAL THANKS TO Keraxel

PHP:
--- CREATED BY BRYAN GROBMANN (XTREMOXX) ---

function onUse(cid, item, frompos, item2, topos)

local MANA = math.random(102, 341)  
local LIFE = math.random (102, 341)

doCreatureAddMana(cid, MANA)
doCreatureAddHealth(cid, LIFE)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_MAGIC_BLUE)
doCreatureSay(cid, "Guuulp..", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid)
end
10198619.png


I don't add exhausted in this script, because for you add exhausted, you need go to, config.lua in you folder server, and edit the lines:
PHP:
	-- Item usage
	timeBetweenActions = 1700
	timeBetweenExActions = 1700

i'm using 1700, is good exhausted for actions, try it.

Suggestions Please!!! Remember, This is my first Script! :thumbup::thumbup:
 
Last edited:
Well... simple but may be useful :D
Anyway look:
PHP:
--(min, max)
local MANA = math.random(100, 600) 
local LIFE = math.random (100, 350)
Now the function will randomize mana and hp values, ex. it can be 162 or 259.
:)
 
PHP:
doPlayerAddMana(cid, MANA) 
doPlayerAddHealth(cid, LIFE)
Might want to change?

Other than that, good script.
 
Back
Top