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

Solved [OTHire] Use on yourself / Use on target

LuisPro

World War <3
Joined
May 10, 2009
Messages
425
Solutions
1
Reaction score
53
Hello.
I wonder how to do stuff like this by server side:
1. if player write "uh" effect will be like on 8.6 with UH and "Use on yourself" <-- spells
2. if player write "mf" effect will be like on 8.6 with mana potion and "Use on yourself" <- actions
3. if player attacking player/monster and write "sd" effect will be like on 8.6 with SD and "Use on target" <-- spells

uh, mf, sd is just text what should be written in "Hotkeys". Visiblity this text aboive head (like exura) is optionaly.

It should be done by talkactions or in spells?
Someone have idea how it can be done?

Greetings.

About UH if i do like this:
Code:
    <instant name="UH" words="uh" needlearn="0" lvl="8" maglv="4" mana="0" selftarget="1" aggressive="0" script="healing/ultimate_healing_rune.lua">
        <vocation name="Sorcerer"/> <vocation name="Master Sorcerer"/>
        <vocation name="Druid"/>    <vocation name="Elder Druid"/>
        <vocation name="Paladin"/>  <vocation name="Royal Paladin"/>
        <vocation name="Knight"/>  <vocation name="Elite Knight"/>
    </instant>

Its works well but it not do -1 uh charge from BP. Any sugestions? :P
 
Last edited by a moderator:
You will need to add to the spell script a check to see if the player has an iyem and another to remove it, else send a "sorry not possible".
 
You will need to add to the spell script a check to see if the player has an iyem and another to remove it, else send a "sorry not possible".
ok, works well. but:
Code:
doPlayerRemoveItem(cid,2273,1)
is removing one UH with 100 chages, how to remove just 1 charge?
 
You mean like a talkaction script?

Code:
function onSay(cid, words, param)
    if getPlayerItemCount(cid, 2006, 7) ~= 0 then
        doPlayerAddMana(cid, math.random(50,150))
        doPlayerSay(cid, "Aaaah...", 16)
        doPlayerRemoveItem(cid, 2006, 1, 7)
    end
    return true
end
 
You mean like a talkaction script?

Code:
function onSay(cid, words, param)
    if getPlayerItemCount(cid, 2006, 7) ~= 0 then
        doPlayerAddMana(cid, math.random(50,150))
        doPlayerSay(cid, "Aaaah...", 16)
        doPlayerRemoveItem(cid, 2006, 1, 7)
    end
    return true
end
Yeah, but when i spam manas, got mute not exhaust :D

So i try it in spells but then they got exhaust beetwen manafluid and exura vita :(
Any ideas guys ? :D
 
Not tested:
HTML:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onGetFormulaValues(cid, level, maglevel)
    min = ((level / 5) + (maglevel * 7.3) + 42)
    max = ((level / 5) + (maglevel * 12.4) + 90)
    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var, isHotkey)
    if getPlayerItemCount(cid, 2273) >= 1 then
        doPlayerRemoveItem(cid, 2273, 1)
        return doCombat(cid, combat, var)
    else
        doPlayerSendCancel(cid, "You do not have any ultimate healing runes.")
        return false
    end
end

HTML:
function onSay(player, words, param)
    local exhaust = Condition(CONDITION_EXHAUST_HEAL)
    exhaust:setParameter(CONDITION_PARAM_TICKS, 1000)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return false
    end
    if getPlayerItemCount(player, 7620) >= 1 then
        doPlayerRemoveItem(player, 7620, 1)
        doPlayerAddMana(player, math.random(75, 125))
        doCreatureSay(player, "Aaaah...", TALKTYPE_MONSTER_SAY)
        doSendMagicEffect(player, CONST_ME_MAGIC_BLUE)
        player:addCondition(exhaust)
        return false
    else
        doPlayerSendCancel(player, "You do not have any mana potions.")
        return false
    end
end
HTML:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

function onGetFormulaValues(cid, level, maglevel)
    min = -((level / 5) + (maglevel * 4.3) + 32)
    max = -((level / 5) + (maglevel * 7.4) + 48)
    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var, isHotkey)
    if getPlayerItemCount(cid, 2268) >= 1 then
        doPlayerRemoveItem(cid, 2268, 1)
        return doCombat(cid, combat, var)
    else
        doPlayerSendCancel(cid, "You do not have any sudden death runes.")
        return false
    end
end
 
Last edited:
Which distro are you using? It removes fine with me. and sorry about that, i see that's why you guys were talking about talkactions, i misunderstood, original post edited.
 
Last edited:
Should be something like this, I don't know the proper functions to use.

Code:
  local combat = createCombatObject()
   setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
   setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
   setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

   function onGetFormulaValues(cid, level, maglevel)
     min = -((level / 5) + (maglevel * 4.3) + 32)
     max = -((level / 5) + (maglevel * 7.4) + 48)
     return min, max
   end

   setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

   function onCastSpell(cid, var, isHotkey)
     local rune = getPlayerItemCount(cid, 2268)
     if rune.count >= 1 then
       if rune.type == 1 then
         doPlayerRemoveItem(cid, 2268, 1)
       else
         doChangeTypeItem(rune, rune.type-1)
       end
       return doCombat(cid, combat, var)
     else
       doPlayerSendCancel(cid, "You do not have any sudden death runes.")
       return false
     end
   end
 
Should be something like this, I don't know the proper functions to use.

Code:
  local combat = createCombatObject()
   setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
   setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
   setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

   function onGetFormulaValues(cid, level, maglevel)
     min = -((level / 5) + (maglevel * 4.3) + 32)
     max = -((level / 5) + (maglevel * 7.4) + 48)
     return min, max
   end

   setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

   function onCastSpell(cid, var, isHotkey)
     local rune = getPlayerItemCount(cid, 2268)
     if rune.count >= 1 then
       if rune.type == 1 then
         doPlayerRemoveItem(cid, 2268, 1)
       else
         doChangeTypeItem(rune, rune.type-1)
       end
       return doCombat(cid, combat, var)
     else
       doPlayerSendCancel(cid, "You do not have any sudden death runes.")
       return false
     end
   end
eVMEgCo.png
 
uh stuff:
hmm its looks like its heppend becouse runes are not stackable so they automaticly got charges.
for example if player say "uh" and in script is doPlayerRemoveItem(cid,Brown Mushroom,1) (remove 1 mushroom from stack of 100) it will working.
But when i set UH rune Count=100 its not stack of 100 runes but it becomes to 1 rune with 100 charges.
So when we got UH rune with x100 charges and player use it manualy on yourself rune change to x99 charges.
Is any way to simulate it in UH rune script?

mf staff:
still thinking about best solution ;p
 
uh stuff:
hmm its looks like its heppend becouse runes are not stackable so they automaticly got charges.
for example if player say "uh" and in script is doPlayerRemoveItem(cid,Brown Mushroom,1) (remove 1 mushroom from stack of 100) it will working.
But when i set UH rune Count=100 its not stack of 100 runes but it becomes to 1 rune with 100 charges.
So when we got UH rune with x100 charges and player use it manualy on yourself rune change to x99 charges.
Is any way to simulate it in UH rune script?

mf staff:
still thinking about best solution ;p
never used this distro or looked into it, but a hacky solution would be transforming the uh used into an uh with type-1 for 1 less charge i guess
 
never used this distro or looked into it, but a hacky solution would be transforming the uh used into an uh with type-1 for 1 less charge i guess

should i use doTransformItem(uid, toitemid, <optional> count/subtype) or doChangeTypeItem(uid, newtype) ?
and what should be as a uid if this rune not have unique id?
 
Last edited:
everything has a uniqueId, its just that if you set UID in a file its special and same forever
to change the type, you have to find the actual rune, getPlayerItemCount(id) only returns how many you have, not any actual item, in 1.2 i have
player:getItemById(itemId, deepSearch[, subType = -1])
which returns the first item found with that Id, if you have anything similar in OTHire use that, and doChangeTypeItem(item.uid, item.type-1)
 
everything has a uniqueId, its just that if you set UID in a file its special and same forever
to change the type, you have to find the actual rune, getPlayerItemCount(id) only returns how many you have, not any actual item, in 1.2 i have
player:getItemById(itemId, deepSearch[, subType = -1])
which returns the first item found with that Id, if you have anything similar in OTHire use that, and doChangeTypeItem(item.uid, item.type-1)

i have this:
getPlayerItemById(cid, deepSearch, itemId, <optional> subType)
can you help me please construct code? :)
 
local item = getPlayerItemById(cid, true, runeId)
doChangeTypeItem(item.uid, item.type-1)
maybe
lol love you :D so simple and working :D


about mf:
if is as talkaction player got mute when spam (i add exhaust 1s for manafluid but it just add mana with this exhaust, and player still can spam "mf" and got mute (its possible? to add something like if player say "mf" he cant say "mf" in next 1 sec? but not conflicted with mute system)? idk just random ideas...

if as spells got exhaust conflict with other healing spells. player have to choose exura or manas. player should be able to "mf" and exura gran in same time.
 
Last edited:
lol love you :D so simple and working :D


about mf:
if is as talkaction player got mute when spam (i add exhaust 1s for manafluid but it just add mana with this exhaust, and player still can spam "mf" and got mute (its possible? to add something like if player say "mf" he cant say "mf" in next 1 sec? but not conflicted with mute system)? idk just random ideas...

if as spells got exhaust conflict with other healing spells. player have to choose exura or manas. player should be able to "mf" and exura gran in same time.

Talkaction script on MF? If so, make the script return false
 
Back
Top