• 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 BUG] HP/MP Gem

180319

New Member
Joined
Oct 30, 2010
Messages
8
Reaction score
0
First of all, sorry for my 'engrish'.

This action is supposed to add hp or mana permanently, like this:

2000+MP for Druids and Sorcerers
1000+HP for Knights
500+MP and HP for paladins.

And here is my problem it works for the knight/druid/sorcerer but it doesnt work for the paladins and i dont know why.. i tried everything but it wont work :(

ACTION 8.6
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 8303 and isKnight(cid) then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 1000)
doSendAnimatedText(getThingPos(cid), "+1000HP", 180)
doRemoveItem(item.uid, 1)
elseif item.iteimd == 8301 and isPaladin(cid) then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 500)
setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 500)
doSendAnimatedText(getThingPos(Cid), "+500MP/HP", 210)
doRemoveItem(item.uid, 1)
elseif item.itemid == 8302 then
if isSorcerer(cid) or isDruid(cid) then
setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 2000)
doSendAnimatedText(getThingPos(cid), "+2000MP", 5)
doRemoveItem(item.uid, 1)
end
end
return true
end

can anyone fix this? please.. i really need this action :)
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 8303 and isKnight(cid) then
        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 1000)
        doSendAnimatedText(getThingPos(cid), "+1000HP", 180)
        doRemoveItem(item.uid, 1)
    elseif item.itemid == 8301 and isPaladin(cid) then
        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 500)
        setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 500)
        doSendAnimatedText(getThingPos(Cid), "+500MP/HP", 210)
        doRemoveItem(item.uid, 1)
    elseif item.itemid == 8302 and isSorcerer(cid) or isDruid(cid) then
        setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 2000)
        doSendAnimatedText(getThingPos(cid), "+2000MP", 5)
        doRemoveItem(item.uid, 1)
    end
return true
end
 
[25/01/2015 15:04:03] [Error - Action Interface]
[25/01/2015 15:04:03] data/actions/scripts/gems.lua:eek:nUse
[25/01/2015 15:04:03] Description:
[25/01/2015 15:04:03] (luaGetThingPosition) Thing not found
/\ error when i use it.. now its working the hp/mp part but its using a whole stack and its not showing the message 500MP/HP!

Nevermind, i fixed it just changed the Cid to cid.. Thanks bro
 
Code:
local config = {
    [8301] = {vocationIds = {3, 7}, bonusHealth = 500, bonusMana = 500},
    [8302] = {vocationIds = {1, 2, 5, 6}, bonusMana = 2000},
    [8303] = {vocationIds = {4, 8}, bonusHealth = 1000}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local useItem = config[item.itemid]
    if not useItem then
        return true
    end

    if isInArray(useItem.vocationIds, getPlayerVocation(cid)) then
        local playerPosition = getPlayerPosition(cid)
        if useItem.bonusHealth then
            setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + useItem.bonusHealth)
            doSendAnimatedText(playerPosition, "+".. useItem.bonusHealth .."HP", 180)
        end

        if useItem.bonusMana then
            setCreatureMaxMana(cid, getCreatureMaxMana(cid) + useItem.bonusMana)
            doSendAnimatedText(playerPosition, "+".. useItem.bonusMana .."MP", 210)
        end

        doRemoveItem(item.uid, 1)
    end

    return true
end
 
Back
Top