• 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 Shoot range

Materion

New Member
Joined
Feb 18, 2012
Messages
81
Reaction score
2
Hello i made this script for custom passive spell that make player who have it to add shootrange to bow:
Lua:
function onEquip(cid, item, slot, uid)
    local skill_level = getPlayerStorageValue(cid, 9000)
    local original_item_range = getItemInfo(item.itemid).shootRange
    setPlayerStorageValue(cid,9001,original_item_range)
    if item.itemid == 2456 then
        if skill_level == 1 then
            doItemSetAttribute(item.uid, item.shootRange, 4)
        elseif skill_level == 2 then
            doItemSetAttribute(item.uid, item.shootRange, 5)
        elseif skill_level == 3 then
            doItemSetAttribute(item.uid, item.shootRange, 6)
        elseif skill_level == 4 then
            doItemSetAttribute(item.uid, item.shootRange, 7)
        end
    end
    return true
end

and function when you put down a bow (then it's range gonna change back to original)
Lua:
function onDeEquip(cid, item, slot)
    local original_item_range = getPlayerStorageValue(cid, 9001)
    if item.itemid == 2456 then
        doItemSetAttribute(item.uid, item.shootRange, original_item_range)
    end
    return true
end

It does change shoot range of weapon, i have other script that shows on console range of weapon and it changes, but when im trying to shoot some monster it have original shootrange, not that modyfied by script ;/. Can someone tell me why ? Example : bow have range 3 originally, I'm equipping it and it would have range 6. But it still shoots with range 3.

Bow range when not equipped (original, look chat window)
UokyknU.jpg


Bow range when equipped and script worked (look chat window):
3MniETx.jpg


The problem is that bow still shoot with range 3 not 6 ...
 
Last edited:
Yes it works !! I changed item.shootRange to "shootrange" and it started to work ! Thank you very much ! I don't have words to describe how grateful I am for your help :)
 
Last edited:
Back
Top