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

Changing wand/rod range

Fadu

New Member
Joined
Sep 28, 2010
Messages
13
Reaction score
0
Is there a way to change the range using LUA?

What I'm trying do to is, if the player have x storage, his wand have only 1 range.

I've tried using doItemSetAttribute(itemEx.uid, "shootrange", 1) but nothing happens.

tfs 0.3.7
 
Hello.
I think this could help you... maybe you can edit the 'weapons.xml' file and add a weapon, for example:
'server/data/weapons/weapons.xml' and add this line.
<distance id="itemID" event="script" value="magicalWand.lua"/> <!-- Your WAND/ROD -->
and then create inside the folder 'server/data/weapons/scripts/' a file called 'magicalWand.lua' and add this lines:
Code:
function onUseWeapon(cid, var)
    local target = getCreatureTarget(cid)
    if(getPlayerLevel(cid) >= 7 and getPlayerLevel(cid) <= 12)then
        if getPlayerStorageValue(cid, Value) == 1then
            range = 3
        else
            range = 1
        end
        damageType = COMBAT_ICEDAMAGE
        shootType = CONST_ANI_SMALLICE
        damageMin = 9
        damageMax = 18
    elseif(getPlayerLevel(cid) >= 13 and getPlayerLevel(cid) <= 15)then
        if getPlayerStorageValue(cid, Value) == 1then
            range = 3
        else
            range = 1
        end
        damageType = COMBAT_FIREDAMAGE
        shootType = CONST_ANI_FIRE
        damageMin = 19
        damageMax = 48
    elseif(getPlayerLevel(cid) >= 16 and getPlayerLevel(cid) <= 20)then
        if getPlayerStorageValue(cid, Value) == 1then
            range = 3
        else
            range = 1
        end
        damageType = COMBAT_DEATHDAMAGE
        shootType = CONST_ANI_SUDDENDEATH
        damageMin = 99
        damageMax = 138
    end
    if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(target) <= range)then
        doTargetCombatHealth(cid, target, damageType, -damageMin, -damageMax, CONST_ME_NONE)
        doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(target), shootType)
    end
end
I hope it work's for you. see you.

 
Back
Top