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

Action My Some Scripts

GangsteR

RPG Maker
Joined
Jul 1, 2007
Messages
815
Reaction score
2
Location
Turkiye
Hi all !
Here! My noob scripting presents; "Teh Healing Herb" !!!
Create healingherb.lua in your actions/scripts folder.
Then paste this in your healingherb.lua ;

PHP:
function onUse(cid, item, frompos, item2, topos)
local hp = math.random(100,250)
local mp = math.random(50,150) 
    if doPlayerRemoveItem(cid, item.itemid, 1) == TRUE then
        doSendMagicEffect(getCreaturePosition(cid),13)
        doCreatureAddHealth(cid, hp)
        doCreatureAddMana(cid, mp)
        doSendAnimatedText(getCreaturePosition(cid), "Aaahhh..." , 192)
    else
        doPlayerSendCancel(cid, "Sorry, not possible!")
    end
return TRUE
end
And open your actions.xml file then paste this;

PHP:
<action itemid="5922" script="healingherb.lua"/>
(I am used Holy Orchid but you can change item id :thumbup:)

Hehe ! It's ready !
As you see when you use this it will add some health and mana !
P.S: I am newbie scripter as you see ;)

Comments are always welcome ;)

New !
Antidote Herb !
It will cure your poison or fire damage !

PHP:
function onUse(cid, item, frompos, item2, topos)
local PlayerPos = getCreaturePosition(cid)
    if getCreatureCondition(cid, 1) == TRUE then
        doSendMagicEffect(PlayerPos,14)
        doRemoveCondition(cid, 1)
        doSendAnimatedText(PlayerPos, "Aaahhh..." , 192)
        doRemoveItem(cid, item.uid, 1)
    else
        doPlayerSendCancel(cid, "You are not poisoned!")
    end
    if getCreatureCondition(cid, 2) == TRUE then
        doSendMagicEffect(PlayerPos,13)
        doRemoveCondition(cid, 2)
        doSendAnimatedText(PlayerPos, "Aaahhh..." , 192)
        doRemoveItem(cid, item.uid, 1)
    else
        doPlayerSendCancel(cid, "You are not burned!")
    end
return TRUE
end
Here is the HP Pill !
When you use this item it will raise your max hp by 10 !

PHP:
function onUse(cid, item, frompos, item2, topos)
local currenthp = getCreatureMaxHealth(cid)
local maxhp = 10
local playerpos = getCreaturePosition(cid)
    if doPlayerRemoveItem(cid, item.itemid, 1) == TRUE then
        doSendMagicEffect(playerpos,13)
        setCreatureMaxHealth(cid, currenthp + maxhp)
        doCreatureAddHealth(cid, currenthp)
        doPlayerSendTextMessage(cid, 22, "You gained " .. maxhp .. " extra health point!")
    else
        doPlayerSendCancel(cid, "Sorry, not possible!")
    end
return TRUE
end
Here is the MP Pill !
It's same as HP Pill but it will raise your mana by 15 !

PHP:
function onUse(cid, item, frompos, item2, topos)
local currentmp = getCreatureMaxMana(cid)
local maxmp = 15
local playerpos = getCreaturePosition(cid)
    if doPlayerRemoveItem(cid, item.itemid, 1) == TRUE then
        doSendMagicEffect(playerpos,14)
        setCreatureMaxMana(cid, currentmp + maxmp)
        doCreatureAddMana(cid, currentmp)
        doPlayerSendTextMessage(cid, 22, "You gained " .. maxmp .. " extra mana point!")
    else
        doPlayerSendCancel(cid, "Sorry, not possible!")
    end
return TRUE
end

Soul Crystal
When your soul point go under 10 use this item and you will gain 200 soul points.

PHP:
function onUse(cid, item, frompos, item2, topos)
local PlayerPos = getCreaturePosition(cid)
local lvl = getPlayerLevel(cid)
local soulpoint = getPlayerSoul(cid)
    if soulpoint >= 10 == TRUE then
        doSendMagicEffect(PlayerPos,12)
        doPlayerAddSoul(cid, 200)
        doPlayerSendTextMessage(cid, 22, "You gained 200 Soul Point!")
        doRemoveItem(cid, item.uid, 1)
    else
        doPlayerSendCancel(cid, "Sorry, you still have some soul points!")
      end
return TRUE
end
 
Last edited:
Move:
PHP:
local hp = math.random(100,250)
local mp = math.random(50,150)
into the function because the server randomize only on start/reload now.
 
Like this ?
PHP:
function onUse(cid, item, frompos, item2, topos)
local hp = math.random(100,250)
local mp = math.random(50,150) 
    if doPlayerRemoveItem(cid, item.itemid, 1) == TRUE then
        doSendMagicEffect(getCreaturePosition(cid),13)
        doCreatureAddHealth(cid, hp)
        doCreatureAddMana(cid, mp)
        doSendAnimatedText(getCreaturePosition(cid), "Aaahhh..." , 192)
    else
        doPlayerSendCancel(cid, "Sorry, not possible!")
    end
return TRUE
end

 
Yeah. Now it will take a number every time function is executed :), not every time server launches.

Try to extend this script with new options, some configuration (like text type as local, text as local, removing yes/no (if no, exhaust in ms, also as local). That will make this script more unique, and it will raise your LUA :D
 
@up
ofc with yes/no configuration :)

(it's easy, just if yes then it shows, elseif no then not :>)
 
PHP:
local showtext_hp = "yes"
local showtext_mp = "yes"

function onUse(cid, item, frompos, item2, topos)
local hp = math.random(100,250)
local mp = math.random(50,150)
local playerpos = getCreaturePosition(cid)
    if doPlayerRemoveItem(cid, item.itemid, 1) == TRUE then
        doSendMagicEffect(playerpos, 13)
        doCreatureAddHealth(cid, hp)
        doCreatureAddMana(cid, mp)
        doCreatureSay(item2.uid, "Aaaah...", TALKTYPE_ORANGE_1)
		
		if showtext_hp == yes then
			doSendAnimatedText(playerpos, "" ..hp.. "" , 18)
		end
		
			if showtext_mp == yes then
				doSendAnimatedText(playerpos, "" ..mp.. "" , 154)
			end
    else
        doPlayerSendCancel(cid, "Sorry, not possible!")
    end
return TRUE
end
 
okay thanks bro !
if i need any help you can be sure i will first ask you ;) cus we are bros :D
 
Back
Top