• 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 Help! [XML] Tibia 8.1 vocation manarune both scripts

Status
Not open for further replies.

Angelika1993

New Member
Joined
Oct 6, 2014
Messages
46
Reaction score
2
Hello i have two scripts, and both working but i need this both in one. I try but not works..
I need vocation manarune :
Here is mine :

PHP:
[LIST=1]
[*]function onUse(cid, item, frompos, item2, topos)
[*]

[*]local level = getPlayerLevel(cid)
[*]local mlevel = getPlayerMagLevel(cid)
[*]

[*]-- Exhausted Settings --
[*]local exhausted_seconds = 1 -- How many seconds manarune will be unavailible to use. --
[*]local exhausted_storagevalue = 1000 -- Storage Value to store exhaust. It MUST be unused! --
[*]-- Exhausted Settings END --
[*]

[*]-- Mana Formula Settings --
[*]-- You can use "level" and "mlevel" --
[*]local mana_minimum = (level * 7) + (mlevel * 8)
[*]local mana_maximum = (level * 7) + (mlevel * 8)
[*]-- Mana Formula Settings END --
[*]

[*]local mana_add = math.random(mana_minimum, mana_maximum)
[*]

[*]-- We check the charges. --
[*]if(item.type > 1) then
[*]-- Exhausted check. --
[*]if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
[*]-- Entity is player? --
[*]if(isPlayer(item2.uid) == 1) then
[*]

[*]doSendMagicEffect(topos, CONST_ME_LOSEENERGY)
[*]

[*]doPlayerAddMana(item2.uid, mana_add)
[*]setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
[*]doChangeTypeItem(item.uid, item.type - 1)
[*]else
[*]doSendMagicEffect(frompos, CONST_ME_POFF)
[*]doPlayerSendCancel(cid, "This rune you can only use on players.")
[*]end
[*]else
[*]doSendMagicEffect(frompos, CONST_ME_POFF)
[*]doPlayerSendCancel(cid, "You are exhausted.")
[*]end
[*]else
[*]if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
[*]doSendMagicEffect(frompos, CONST_ME_POFF)
[*]doPlayerSendCancel(cid, "You are exhausted.")
[*]else
[*]if(isPlayer(item2.uid) == 1) then
[*]

[*]doSendMagicEffect(topos, CONST_ME_LOSEENERGY)
[*]

[*]doPlayerAddMana(item2.uid, mana_add)
[*]setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
[*]

[*]else
[*]doSendMagicEffect(frompos, CONST_ME_POFF)
[*]doPlayerSendCancel(cid, "This rune you can only use on players.")
[*]end
[*]end
[*]end
[*]

[*]return 1
[*]end
[/LIST]
Here is second with vocation.... :
PHP:
[LIST=1]
[*]function onUse(cid, item, frompos, item2, topos)
[*]

[*]local playerpos = getPlayerPosition(cid)
[*]local vocation = getPlayerVocation(cid)
[*]local manaadd = math.random(100,250)
[*]

[*]

[*]if (vocation == 4) or (vocation == 8) then
[*]doPlayerAddMana(cid, manaadd)
[*]doPlayerSay(cid,"Mniam...",1)
[*]doRemoveItem(item.uid, 1)
[*]doSendMagicEffect(playerpos, 12)
[*]else
[*]doPlayerSendTextMessage(cid,19,"You are not knight or elite knight.")
[*]end
[*]end
[/LIST]
Can you help me?
 
I can help, please change thread title to [your TFS version] example [TFS 0.3.6] Voc Manarune or [8.6] Voc Manarune so ppl know which functions you use and then they will be able to help you.

Good, please wait for my edit.
scripting in progress.. :p
 
Do you want 2 items working on 1 script? Please say exactly what you want script to do and with what itemid.
I need also your lines from actions.xml linked to this script.

The first script is manarune for players, really bad scripted and i see double codes.
Second script is normal potion for only knight.
 
Last edited:
Dziękuję że mi pomagasz. Chciałam żeby w "mojej" manarunie (ta pierwsza) była dla danej klasy tzn dla 5 i 6 czyli dla ED i MS, ale nie potrafiłam tego zrobić i znalazłam ten drugi, ale też nic z tego :(.

Trochę zamotałam chciałabym żeby w ta pierwsza manaruna była tylko dla elder druida i master sorcerera..
PHP:
<action itemid="2270" script="manarune.lua"/>
But you can do this first to vocation? :p
 
Code:
function onUse(cid, item, frompos, item2, topos)

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)

local exhausted_seconds = 1 -- exhausted in seconds
local exhausted_storagevalue = 759955 -- storage value to exhaust

local manaMin = (level * 7) + (mlevel * 8)
local ManaMax = (level * 7) + (mlevel * 8)

local mana = math.random(manaMin, ManaMax)

    if(item.type > 1) then
        if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
            if(isPlayer(item2.uid) == 1) and v == 1 or v == 2 or v == 5 or v == 6 then
                doSendMagicEffect(topos, CONST_ME_LOSEENERGY)
                doPlayerAddMana(item2.uid, mana)
                setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
                doChangeTypeItem(item.uid, item.type - 1)
            else
                doSendMagicEffect(frompos, CONST_ME_POFF)
                doPlayerSendCancel(cid, "Only druids and sorcerers can use this manarune.")
            end
        else
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You are exhausted.")
        end
    else
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, "You are exhausted.")
    end
    return true
end
I can't get this
Code:
if(item.type > 1) then
doChangeTypeItem(item.uid, item.type - 1)
I never worked with 8.1 only 8.6+
It looks like "if it is item then remove item".
But there is no need for that line because if you don't have runes there will be nothing to execute script xD

So final script is:
Code:
function onUse(cid, item, frompos, item2, topos)

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)

local exhausted_seconds = 1 -- exhausted in seconds
local exhausted_storagevalue = 759955 -- storage value to exhaust

local manaMin = (level * 7) + (mlevel * 8)
local ManaMax = (level * 7) + (mlevel * 8)

local mana = math.random(manaMin, ManaMax)

        if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
            if(isPlayer(item2.uid) == 1) and v == 1 or v == 2 or v == 5 or v == 6 then
                doSendMagicEffect(topos, CONST_ME_LOSEENERGY)
                doPlayerAddMana(item2.uid, mana)
                setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
                doChangeTypeItem(item.uid, item.type - 1)
            else
                doSendMagicEffect(frompos, CONST_ME_POFF)
                doPlayerSendCancel(cid, "Only druids and sorcerers can use this manarune.")
            end
        else
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You are exhausted.")
        end
    return true
end
 
Last edited:
Code:
function onUse(cid, item, frompos, item2, topos)

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)

local exhausted_seconds = 1 -- exhausted in seconds
local exhausted_storagevalue = 759955 -- storage value to exhaust

local manaMin = (level * 7) + (mlevel * 8)
local ManaMax = (level * 7) + (mlevel * 8)

local mana = math.random(manaMin, ManaMax)

    if(item.type > 1) then
        if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
            if(isPlayer(item2.uid) == 1) and v == 1 or v == 2 or v == 5 or v == 6 then
                doSendMagicEffect(topos, CONST_ME_LOSEENERGY)
                doPlayerAddMana(item2.uid, mana)
                setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
                doChangeTypeItem(item.uid, item.type - 1)
            else
                doSendMagicEffect(frompos, CONST_ME_POFF)
                doPlayerSendCancel(cid, "Only druids and sorcerers can use this manarune.")
            end
        else
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You are exhausted.")
        end
    else
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, "You are exhausted.")
    end
    return true
end
Dziękuję! Tylko jest mał problem :p, nikt nie może jej uzywać :D
 
Code:
function onUse(cid, item, frompos, item2, topos)

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)

local exhausted_seconds = 1 -- exhausted in seconds
local exhausted_storagevalue = 759955 -- storage value to exhaust

local manaMin = (level * 7) + (mlevel * 8)
local ManaMax = (level * 7) + (mlevel * 8)
local v = getPlayerVocation(cid)
local mana = math.random(manaMin, ManaMax)

        if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
            if(isPlayer(item2.uid) == 1) and v == 1 or v == 2 or v == 5 or v == 6 then
                doSendMagicEffect(topos, CONST_ME_LOSEENERGY)
                doPlayerAddMana(item2.uid, mana)
                setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
                doChangeTypeItem(item.uid, item.type - 1)
            else
                doSendMagicEffect(frompos, CONST_ME_POFF)
                doPlayerSendCancel(cid, "Only druids and sorcerers can use this manarune.")
            end
        else
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You are exhausted.")
        end
    return true
end
Teraz zobacz :p
 
Code:
function onUse(cid, item, frompos, item2, topos)

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)

local exhausted_seconds = 1 -- exhausted in seconds
local exhausted_storagevalue = 759955 -- storage value to exhaust

local manaMin = (level * 7) + (mlevel * 8)
local ManaMax = (level * 7) + (mlevel * 8)
local v = getPlayerVocation(cid)
local mana = math.random(manaMin, ManaMax)

        if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
            if(isPlayer(item2.uid) == 1) and v == 1 or v == 2 or v == 5 or v == 6 then
                doSendMagicEffect(topos, CONST_ME_LOSEENERGY)
                doPlayerAddMana(item2.uid, mana)
                setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
                doChangeTypeItem(item.uid, item.type - 1)
            else
                doSendMagicEffect(frompos, CONST_ME_POFF)
                doPlayerSendCancel(cid, "Only druids and sorcerers can use this manarune.")
            end
        else
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You are exhausted.")
        end
    return true
end
Teraz zobacz :p

Działa!!! Dziękuję tylko jeszcze jedna rzecz :D, runka ma jedno użycie i od razu się marnuje chciałabym żeby była nieskończona :pP a nie ma tu nigdzie doremoveitem czy coś takiego :p, ale dziękuję!!!
 
Proszę:
Code:
function onUse(cid, item, frompos, item2, topos)

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)

local exhausted_seconds = 1 -- exhausted in seconds
local exhausted_storagevalue = 759955 -- storage value to exhaust

local manaMin = (level * 7) + (mlevel * 8)
local ManaMax = (level * 7) + (mlevel * 8)
local v = getPlayerVocation(cid)
local mana = math.random(manaMin, ManaMax)

        if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
            if(v == 1 or v == 2 or v == 5 or v == 6) then
                doSendMagicEffect(topos, CONST_ME_LOSEENERGY)
                doPlayerAddMana(item2.uid, mana)
                setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
            else
                doSendMagicEffect(frompos, CONST_ME_POFF)
                doPlayerSendCancel(cid, "Only druids and sorcerers can use this manarune.")
            end
        else
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You are exhausted.")
        end
    return true
end
 
Proszę:
Code:
function onUse(cid, item, frompos, item2, topos)

local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)

local exhausted_seconds = 1 -- exhausted in seconds
local exhausted_storagevalue = 759955 -- storage value to exhaust

local manaMin = (level * 7) + (mlevel * 8)
local ManaMax = (level * 7) + (mlevel * 8)
local v = getPlayerVocation(cid)
local mana = math.random(manaMin, ManaMax)

        if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
            if(v == 1 or v == 2 or v == 5 or v == 6) then
                doSendMagicEffect(topos, CONST_ME_LOSEENERGY)
                doPlayerAddMana(item2.uid, mana)
                setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
            else
                doSendMagicEffect(frompos, CONST_ME_POFF)
                doPlayerSendCancel(cid, "Only druids and sorcerers can use this manarune.")
            end
        else
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, "You are exhausted.")
        end
    return true
end
Great!!! Działa, ale jeszcze ostatnia rzecz :
00:59 Using the last ultimate healing...
^ Manaruna nie wyświetla takiej informacji, jest puste pole :p
 
Ponieważ musisz ustawić na hotkeyu. Takie info jest jeśli z hotkeya używasz.
Jest na hotkeyu, ale jeszcze jedno gdy używam manaruny ona regeneruje mane, ale na dole jest napisane : You can not use this object.
Ale i tak wielkie dzięki ważne że działa :p
 
Status
Not open for further replies.

Similar threads

Back
Top