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

Lua on use

Lbtg

Advanced OT User
Joined
Nov 22, 2008
Messages
2,398
Reaction score
165
Hello i wanna make it that if player clicks an stone it heals 100hp and gives 5%hp cooldown for5 minutes ,but if diferent player uses it he can use it and has hes cooldown for him.

or if posible to make that it gives for every person rondom stats
1.100hp/100mp 2sec ,regen for 1 hour
2.+5 all skills ecept magic 1h
3.7% more hp 1h
4.7% more mana 1h
5.+5 magic if mage , but rondom aswell 1h
6.+100 speed for 30 min
7. 1% chance of getting an item id "xxxx"
8. is it posible to make an 2x skills for 1 hour ?

theres is a script i trying to work on
PHP:
SOUNDS = {"7% MORE HP", "7% MORE MANA!", "SPEEED BOOSTED", "REGENERATION", "SKILLS BOOST", "MAGIC BOOST", "DOUBLE SKILL RATE", "ITEM"}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local random = math.random(1, table.maxn(SOUNDS))
local alreadyused
if (alreadyused == true) then
doCreatureSay(cid, "It is still on cooldown.", TALKTYPE_ORANGE_1, fromPosition)
return false
end
if(fromPosition.x ~= CONTAINER_POSITION) then
  doCreatureSay(cid, SOUNDS[random], TALKTYPE_ORANGE_1, fromPosition)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  doCreatureAddHealth(cid, 100*1000)
else
  doCreatureSay(cid, SOUNDS[random], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  doCreatureAddHealth(cid, 100*1000)
end
  alreadyused = true
  wait(60*2)
  alreadyused = false

return TRUE
end

function wait(seconds)
  local start = os.time()
  repeat until os.time() > start + seconds
end
 
Before anything.... what distro? also please reword question better please, im thinkin 10 different things here... do you want only 1 person to be able to use this stone? one person to have the 100 hp power? all people to be able to get this? Im just confused.
 
:D sorry hah :D
1.100hp/100mp 2sec ,regen for 1 hour
2.+5 all skills ecept magic 1h
3.7% more hp 1h
4.7% more mana 1h
5.+5 magic if mage , but rondom aswell 1h
6.+100 speed for 30 min
7. 1% chance of getting an item id "xxxx"
8. is it posible to make an 2x skills for 1 hour ?

thats the bonnuses , every person on use gets diferent bonusses from chose /\ . for 1 hour , but if player come and use after 10 min he gets cancel message saying "your bonus is still on "and after 1 hour bonnuses oon plauyers dissapear and they can use it again ^^


and yeah 0.3.6
 
Not Best Way to make it, but fulfil the Request

Code:
local speed = createConditionObject(CONDITION_HASTE)
setConditionParam(speed2, CONDITION_PARAM_TICKS, 3600)
setConditionParam(speed2, CONDITION_PARAM_SPEED, 100)
local sword = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(sword, CONDITION_PARAM_TICKS, 3600)
setConditionParam(sword, CONDITION_PARAM_SKILL_DISTANCE, 25)
setConditionParam(sword, CONDITION_PARAM_SKILL_SWORD, 25)
setConditionParam(sword, CONDITION_PARAM_SKILL_AXE, 25)

local mage = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(mage, CONDITION_PARAM_TICKS, 3600)
setConditionParam(mage, CONDITION_PARAM_STAT_MAGICLEVEL, 25)

local barbarian = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(barbarian, CONDITION_PARAM_TICKS, -1)

local regen = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3600)
setConditionParam(condition, CONDITION_PARAM_BUFF_SPELL, 1)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 20)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 5000)
setConditionParam(condition, CONDITION_PARAM_MANAGAIN, 20)
setConditionParam(condition, CONDITION_PARAM_MANATICKS, 5000)
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if exhaustion.check(cid, 19523) then
        doPlayerSendCancel(cid, "You Have To Wait "..math.floor(exhaustion.get(cid,19523) / 60) .." Minutes Before Using it Again.")
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        return true
    end
local sounds = {"7% MORE HP", "7% MORE MANA!", "SPEEED BOOSTED", "REGENERATION", "SKILLS BOOST", "MAGIC BOOST", "ITEM"}
local random = math.random(1,100)
local item = {2157,5} -- item quantity
    if random == 1 then
        doPlayerAddItem(cid,item[1],item[2])
        exhaustion.set(cid,19523,300)
        doCreatureSay(cid, SOUNDS[7], TALKTYPE_ORANGE_1)
        doSendMagicEffect(getCreaturePosition(cid), 2)
    elseif random > 1 and random <= 10 then
        setCreatureMaxHealth(cid, math.floor((getCreatureMaxHealth(cid) * 107) / 100))
        doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
        exhaustion.set(cid,19523,300)
        doCreatureSay(cid, SOUNDS[1], TALKTYPE_ORANGE_1)
        doSendMagicEffect(getCreaturePosition(cid), 2)
    elseif random > 10 and random <= 20 then
        setCreatureMaxMana(cid, math.floor((getCreatureMaxMana(cid) * 107) / 100))
        doCreatureAddMana(cid, getCreatureMaxMana(cid))
        exhaustion.set(cid,19523,300)
        doCreatureSay(cid, SOUNDS[2], TALKTYPE_ORANGE_1)
        doSendMagicEffect(getCreaturePosition(cid), 2)
    elseif random > 20 and random <= 30 then
        exhaustion.set(cid,19523,300)
        doCreatureSay(cid, SOUNDS[3], TALKTYPE_ORANGE_1)
        doSendMagicEffect(getCreaturePosition(cid), 2)
        doAddCondition(cid, speed)
    elseif random > 30 and random <= 40 then
        exhaustion.set(cid,19523,300)
        doCreatureSay(cid, SOUNDS[3], TALKTYPE_ORANGE_1)
        doSendMagicEffect(getCreaturePosition(cid), 2)
        doAddCondition(cid, speed)
    elseif random > 40 and random <= 50 then
        exhaustion.set(cid,19523,300)
        doCreatureSay(cid, SOUNDS[4], TALKTYPE_ORANGE_1)
        doSendMagicEffect(getCreaturePosition(cid), 2)
        doAddCondition(cid, regen)
    elseif random > 50 and random <= 60 then
        exhaustion.set(cid,19523,300)
        doCreatureSay(cid, SOUNDS[5], TALKTYPE_ORANGE_1)
        doSendMagicEffect(getCreaturePosition(cid), 2)
        doAddCondition(cid, sword)
    elseif random > 60 and random <= 70 then
        exhaustion.set(cid,19523,300)
        doCreatureSay(cid, SOUNDS[5], TALKTYPE_ORANGE_1)
        doSendMagicEffect(getCreaturePosition(cid), 2)
        doAddCondition(cid, mage)
    else
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        doPlayerSendCancel(cid,"You Had A Bad Luck This Time,Come Again Later")
        exhaustion.set(cid,19523,300)
    end
    return true
end
 
local sounds doesnt work for decent buff :( and i think the buff stays for like 4-6 seconds

+more hp stays for longer but like skills , drop fast

no errors at all , added as uniqueid
 
Last edited:
now i see errors somehow
PHP:
data/actions/scripts/healing.lua:57: attempt to index global 'SOUNDS' (a nil value)
stack traceback:
        data/actions/scripts/healing.lua:57: in function <data/actions/scripts/healing.lua:24>

[Error - Action Interface]
data/actions/scripts/healing.lua:onUse
Description:
data/actions/scripts/healing.lua:67: attempt to index global 'SOUNDS' (a nil value)
stack traceback:
        data/actions/scripts/healing.lua:67: in function <data/actions/scripts/healing.lua:24>

[Error - Action Interface]
data/actions/scripts/healing.lua:onUse
Description:
data/actions/scripts/healing.lua:42: attempt to index global 'SOUNDS' (a nil value)
stack traceback:
        data/actions/scripts/healing.lua:42: in function <data/actions/scripts/healing.lua:24>
 
Code:
local speed = createConditionObject(CONDITION_HASTE)
setConditionParam(speed2, CONDITION_PARAM_TICKS, 3600)
setConditionParam(speed2, CONDITION_PARAM_SPEED, 100)
local sword = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(sword, CONDITION_PARAM_TICKS, 3600)
setConditionParam(sword, CONDITION_PARAM_SKILL_DISTANCE, 25)
setConditionParam(sword, CONDITION_PARAM_SKILL_SWORD, 25)
setConditionParam(sword, CONDITION_PARAM_SKILL_AXE, 25)

local mage = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(mage, CONDITION_PARAM_TICKS, 3600)
setConditionParam(mage, CONDITION_PARAM_STAT_MAGICLEVEL, 25)

local barbarian = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(barbarian, CONDITION_PARAM_TICKS, -1)

local regen = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3600)
setConditionParam(condition, CONDITION_PARAM_BUFF_SPELL, 1)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 20)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 5000)
setConditionParam(condition, CONDITION_PARAM_MANAGAIN, 20)
setConditionParam(condition, CONDITION_PARAM_MANATICKS, 5000)
function onUse(cid, item, fromPosition, itemEx, toPosition)
  if exhaustion.check(cid, 19523) then
  doPlayerSendCancel(cid, "You Have To Wait "..math.floor(exhaustion.get(cid,19523) / 60) .." Minutes Before Using it Again.")
  doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
  return true
  end
local SOUNDS = {"7% MORE HP", "7% MORE MANA!", "SPEEED BOOSTED", "REGENERATION", "SKILLS BOOST", "MAGIC BOOST", "ITEM"}
local random = math.random(1,100)
local item = {2157,5} -- item quantity
  if random == 1 then
  doPlayerAddItem(cid,item[1],item[2])
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[7], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  elseif random > 1 and random <= 10 then
  setCreatureMaxHealth(cid, math.floor((getCreatureMaxHealth(cid) * 107) / 100))
  doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[1], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  elseif random > 10 and random <= 20 then
  setCreatureMaxMana(cid, math.floor((getCreatureMaxMana(cid) * 107) / 100))
  doCreatureAddMana(cid, getCreatureMaxMana(cid))
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[2], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  elseif random > 20 and random <= 30 then
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[3], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  doAddCondition(cid, speed)
  elseif random > 30 and random <= 40 then
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[3], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  doAddCondition(cid, speed)
  elseif random > 40 and random <= 50 then
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[4], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  doAddCondition(cid, regen)
  elseif random > 50 and random <= 60 then
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[5], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  doAddCondition(cid, sword)
  elseif random > 60 and random <= 70 then
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[5], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  doAddCondition(cid, mage)
  else
  doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
  doPlayerSendCancel(cid,"You Had A Bad Luck This Time,Come Again Later")
  exhaustion.set(cid,19523,300)
  end
  return true
end
 
all skill type lossing after couple of seconds and regeneration is is regenerating , + it posible to make it show up like +20hp pops up like heal on character, evrything else looks working perfecly
 
all skill type lossing after couple of seconds and regeneration is is regenerating , + it posible to make it show up like +20hp pops up like heal on character, evrything else looks working perfecly
about +20 thats in config, make it show in onhealing,the skills,i will check it out
 
not really sure if regeneration show on healing, just exura and such. so will have to make source edits for those or globalevent, i can do it later not now
 
Code:
local speed = createConditionObject(CONDITION_HASTE)
setConditionParam(speed2, CONDITION_PARAM_TICKS, 3600000)
setConditionParam(speed2, CONDITION_PARAM_SPEED, 100)
local sword = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(sword, CONDITION_PARAM_TICKS, 3600000)
setConditionParam(sword, CONDITION_PARAM_SKILL_DISTANCE, 25)
setConditionParam(sword, CONDITION_PARAM_SKILL_SWORD, 25)
setConditionParam(sword, CONDITION_PARAM_SKILL_AXE, 25)

local mage = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(mage, CONDITION_PARAM_TICKS, 3600000)
setConditionParam(mage, CONDITION_PARAM_STAT_MAGICLEVEL, 25)

local barbarian = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(barbarian, CONDITION_PARAM_TICKS, -1)

local regen = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3600000)
setConditionParam(condition, CONDITION_PARAM_BUFF_SPELL, 1)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 20)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 5000)
setConditionParam(condition, CONDITION_PARAM_MANAGAIN, 20)
setConditionParam(condition, CONDITION_PARAM_MANATICKS, 5000)
function onUse(cid, item, fromPosition, itemEx, toPosition)
  if exhaustion.check(cid, 19523) then
  doPlayerSendCancel(cid, "You Have To Wait "..math.floor(exhaustion.get(cid,19523) / 60) .." Minutes Before Using it Again.")
  doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
  return true
  end
local SOUNDS = {"7% MORE HP", "7% MORE MANA!", "SPEEED BOOSTED", "REGENERATION", "SKILLS BOOST", "MAGIC BOOST", "ITEM"}
local random = math.random(1,100)
local item = {2157,5} -- item quantity
  if random == 1 then
  doPlayerAddItem(cid,item[1],item[2])
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[7], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  elseif random > 1 and random <= 10 then
  setCreatureMaxHealth(cid, math.floor((getCreatureMaxHealth(cid) * 107) / 100))
  doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[1], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  elseif random > 10 and random <= 20 then
  setCreatureMaxMana(cid, math.floor((getCreatureMaxMana(cid) * 107) / 100))
  doCreatureAddMana(cid, getCreatureMaxMana(cid))
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[2], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  elseif random > 20 and random <= 30 then
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[3], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  doAddCondition(cid, speed)
  elseif random > 30 and random <= 40 then
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[3], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  doAddCondition(cid, speed)
  elseif random > 40 and random <= 50 then
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[4], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  doAddCondition(cid, regen)
  elseif random > 50 and random <= 60 then
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[5], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  doAddCondition(cid, sword)
  elseif random > 60 and random <= 70 then
  exhaustion.set(cid,19523,300)
  doCreatureSay(cid, SOUNDS[5], TALKTYPE_ORANGE_1)
  doSendMagicEffect(getCreaturePosition(cid), 2)
  doAddCondition(cid, mage)
  else
  doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
  doPlayerSendCancel(cid,"You Had A Bad Luck This Time,Come Again Later")
  exhaustion.set(cid,19523,300)
  end
  return true
end
 
Back
Top