• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent "Upgrade weapon by killing monsters!" v2.0

Dont work in new tfs
3:32] [Error - CreatureScript Interface]
[21/12/2009 19:23:32] data/creaturescripts/scripts/monster_weapon_upgrade.lua:eek:nKill
[21/12/2009 19:23:32] Description:
[21/12/2009 19:23:32] ...a/creaturescripts/scripts/monster_weapon_upgrade.lua:37: attempt to call global 'getItemExtraAttack' (a nil value)
[21/12/2009 19:23:32] stack traceback:
[21/12/2009 19:23:32] ...a/creaturescripts/scripts/monster_weapon_upgrade.lua:37: in function <...a/creaturescripts/scripts/monster_weapon_upgrade.lua:18>



You can fix it?


#Shawak
Thanks you,
 
Last edited:
Dont work in new tfs
3:32] [Error - CreatureScript Interface]
[21/12/2009 19:23:32] data/creaturescripts/scripts/monster_weapon_upgrade.lua:eek:nKill
[21/12/2009 19:23:32] Description:
[21/12/2009 19:23:32] ...a/creaturescripts/scripts/monster_weapon_upgrade.lua:37: attempt to call global 'getItemExtraAttack' (a nil value)
[21/12/2009 19:23:32] stack traceback:
[21/12/2009 19:23:32] ...a/creaturescripts/scripts/monster_weapon_upgrade.lua:37: in function <...a/creaturescripts/scripts/monster_weapon_upgrade.lua:18>



You can fix it?
Perhaps I'll upgrade it later ;P.
 
very good script this guy
I loved
but ...
I was thinking ...
would not be better if you been raised for the amount of monsters to kill double with the level?

ex: sword lv 1 needs 100 monsters to kill
sword lv 2 needs 200 monsters to kill
sword lv 3 needs 400 monsters to kill

=)
 
When i tested it, the monster would stand there at zero health.

What could cause this problem? I recieved no error.
 
Code:
  --[[
        ** Monster weapon upgrader by slawkens **
        ** Updated to version 2.1 by Soul4Soul **

        [ignore_monsters]
        - type "yes" and only by the [monsters] the weapon gain kills
        [monsters]
        • {"..","..",".."} - list of monsters where weapon gain kills
        [ingore_weapons]
        - type "yes" and only the [weapons] can be upgraded
        [weapons]
        •       [2395] = {100, 1, 3},
                     |               |    |  |
                     |               |    |  •> extraAttackLimit
                     |               |    •> extraAttackInterval
                     |               •> kills
                     •> id of the weapon
        [default]
        • kills - how much monsters must be killed
        • extraAttack - how much extraAttack points will be added when the weapon levels up
        • extraAttackLimit - you can set limit of extraAttack points added
]]--

local ignore_monsters = "yes"
local monsters = {"Rat","Dragon","Dragon Lord"}

local ingore_weapons = "yes"
local weapons = {
        [2395] = {600, 1, 5},
        [2383] = {500, 1, 4}
} -- weapon end --

local default = {
        500,   -- kills
        1,     -- extraAttack
        5      -- extraAttackLimit
} -- default end --

function onKill(cid, target)
    if(isPlayer(target) == TRUE) then
        return TRUE
    end
        
    if (string.lower(ignore_monsters) == "no" or isInArray(monsters, getCreatureName(target)) == TRUE) and string.lower(ignore_monsters) == "yes" then

        local playerWeapon = getPlayerWeapon(cid, TRUE)
        if(playerWeapon.itemid == 0) then
            return true
        end

        local weapon = weapons[getPlayerWeapon(cid).itemid]
        if string.lower(ingore_weapons) == "yes" then
            weapon = default
        end

        if (string.lower(ingore_weapons) == "no" and (not weapon) == FALSE or string.lower(ingore_weapons) == "yes") then            
            
        local currentExtraAttack = getItemAttribute(playerWeapon.uid, "extraattack")
        if(currentExtraAttack >= weapon[3]) then
            return true
        end

        local add = weapon[2]
        if(currentExtraAttack + add > weapon[3]) then
            add = currentExtraAttack - weapon[3]
        end
                
            if(playerWeapon.actionid ~= 0) then
                if(playerWeapon.actionid >= weapon[1]+9999) then
                    doItemSetAttribute(playerWeapon.uid, "aid", 10000)
                    doItemSetAttribute(playerWeapon.uid, "extraattack", currentExtraAttack + add)
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" ..add.. " attack points and now have total extra damage of +" .. getItemAttribute(playerWeapon.uid, "extraattack") .. " points!")
                    doItemSetAttribute(playerWeapon.uid, "description", "["..(playerWeapon.actionid-9999).."/"..weapon[1].." | ".. getItemAttribute(playerWeapon.uid, "extraattack").."/"..weapon[3].."]")
                else
                    doItemSetAttribute(playerWeapon.uid, "aid", playerWeapon.actionid + 1)
                    doItemSetAttribute(playerWeapon.uid, "description", "["..(playerWeapon.actionid-9999).."/"..weapon[1].." | ".. getItemAttribute(playerWeapon.uid, "extraattack").."/"..weapon[3].."]")
                end
            else
                doItemSetAttribute(playerWeapon.uid, "aid", 10001)
                doItemSetAttribute(playerWeapon.uid, "description", "[1/"..weapon[1].." | ".. getItemAttribute(playerWeapon.uid, "extraattack").."/"..weapon[3].."]")
            end
        end
    end
    return true
end
that was the best i could do to update it but im still getting errors
[Error - CreatureScript Interface]
data/creaturescripts/scripts/weaponadvance.lua:eek:nKill
Description:
data/creaturescripts/scripts/weaponadvance.lua:43: attempt to compare number wit
h nil
stack traceback:
data/creaturescripts/scripts/weaponadvance.lua:43: in function <data/cre
aturescripts/scripts/weaponadvance.lua:33>
 
Last edited:
no it still says its made by you.
+ it doesn't work so it shouldn't matter
+ i did change ur code that's why its only for the updated part

since you came back to this thread do u think you could get it the rest of the way to working?
 
could you give me a hint then? im trying by myself which is more then most people on this forum. I dont know what is wrong anymore. i dont understand why its giving me a nil #. the only thing i can think of is that when there is no current extraattack it returns nil
 
I won't work for free anymore.

What u mean for free?...... and why does it give a nil value.. lol im having that same issue now when i edit the script.. Cauz the normal script doesn't work, no errors, just nothing..... 0.3.7 TFS!!!
 
Last edited:
Back
Top