CreatureEvent [TFS 1.1] Ultimate item stat system (elements, skills, exp, loot and more)

Discussion in 'GlobalEvents, Spells & CreatureEvents' started by zbizu, Mar 7, 2015.

  1. bonfim25

    bonfim25 New Member

    Joined:
    Jan 17, 2011
    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    the only thing that changed was the alteration that Sir Islam said to work the action the rest was already working normal. !
     
  2. chrillefock

    chrillefock Member

    Joined:
    Jul 4, 2009
    Messages:
    86
    Likes Received:
    21
    Best Answers:
    0
    Lua Script Error: [CreatureScript Interface]
    data/creaturescripts/scripts/stats.lua:eek:nLogin
    data/creaturescripts/scripts/stats.lua:22: attempt to call global 'stat_onLogin'
    (a nil value)
    stack traceback:
    [C]: in function 'stat_onLogin'
    data/creaturescripts/scripts/stats.lua:22: in function <data/creaturescr
    ipts/scripts/stats.lua:21>

    anyone know what i have done wrong?
     
  3. SlayingWorld

    SlayingWorld Active Member

    Joined:
    Jan 23, 2014
    Messages:
    122
    Likes Received:
    28
    Best Answers:
    0
    I got the same error, running it on the latest TFS 1.2, then everything goes nuts as it fails to load all the rest libs from global
     
  4. SlayingWorld

    SlayingWorld Active Member

    Joined:
    Jan 23, 2014
    Messages:
    122
    Likes Received:
    28
    Best Answers:
    0
    Nvm Fixed it
     
    William Sezo likes this.
  5. William Sezo

    William Sezo Rookie but passionate

    Joined:
    May 6, 2016
    Messages:
    43
    Likes Received:
    5
    Best Answers:
    0
    how did you fix it SlayingWorld?
     
  6. William Sezo

    William Sezo Rookie but passionate

    Joined:
    May 6, 2016
    Messages:
    43
    Likes Received:
    5
    Best Answers:
    0
    Wish I knew, I would love to have this system on my server... can't seem to make it work on TFS 1.2
     
  7. Aeronx

    Aeronx Member

    Joined:
    Dec 17, 2015
    Messages:
    409
    Likes Received:
    22
    Best Answers:
    1
    It works on TFS 1.2 There's many incompatibilities with other systems. Try it on a clean TFS 1.2 server, and then you'll know if its something on your server or just that you missed something :p
     
    William Sezo likes this.
  8. William Sezo

    William Sezo Rookie but passionate

    Joined:
    May 6, 2016
    Messages:
    43
    Likes Received:
    5
    Best Answers:
    0
    Got on top of it yesterday and got it working!
    Don't ask me what I did tho...

    Thanks!
     
  9. William Sezo

    William Sezo Rookie but passionate

    Joined:
    May 6, 2016
    Messages:
    43
    Likes Received:
    5
    Best Answers:
    0
    It works for upgrading with the stones, but the +X items are not dropping from monsters.
    Does anyone know how to fix this?
     
  10. Aeronx

    Aeronx Member

    Joined:
    Dec 17, 2015
    Messages:
    409
    Likes Received:
    22
    Best Answers:
    1
    Actually they drop, but there's a problem with that part,
    That even random crap items like torches or bones get
    Upgraded! I got it working fine on a tfs 1.2, just recheck
    Your steps, and redo them if necessary. It works, not as
    It should, but it works. The fixes needs to be done by yourself
    Or ask someone to do it for you.
     
    William Sezo likes this.
  11. William Sezo

    William Sezo Rookie but passionate

    Joined:
    May 6, 2016
    Messages:
    43
    Likes Received:
    5
    Best Answers:
    0
    Thanks Aeronx, I'll do that.
     
  12. God Mythera

    God Mythera Well-Known Member

    Joined:
    Aug 11, 2012
    Messages:
    1,944
    Likes Received:
    215
    Best Answers:
    0
    Anyone got this working with TFS 1.2?
     
  13. RazorBlade

    RazorBlade Snek

    Joined:
    Nov 7, 2009
    Messages:
    2,012
    Likes Received:
    602
    Best Answers:
    0
    considering the differences in code for 1.1 vs 1.2 are small, I can't imagine why it wouldn't work with 1.2. I don't remember for sure which version I was using when I tried this system but it worked fine. It was probably 1.2.
     
  14. God Mythera

    God Mythera Well-Known Member

    Joined:
    Aug 11, 2012
    Messages:
    1,944
    Likes Received:
    215
    Best Answers:
    0
    I did everything it said and my server wont open, if i was to test it again it would be when i get a dedi host ;d
     
  15. Kemixe

    Kemixe New Member

    Joined:
    Jul 18, 2014
    Messages:
    6
    Likes Received:
    1
    Best Answers:
    0

    When I try to use GEM_BASIC_LEVEL and GEM_ADD_SLOT, it works, but when I try to use the others, this error


    Code (Text):
    1. Lua Script Error: [Action Interface]
    2. data/actions/scripts/slot.lua:onUse
    3. data/lib2/stats.lua:1470: attempt to index a nil value
    4. stack traceback:
    5.         [C]: in function '__index'
    6.         data/lib2/stats.lua:1470: in function 'stat_onUse'
    7.         data/actions/scripts/slot.lua:3: in function <data/actions/scripts/slot.lua:1>
    Code (Text):
    1.     GEM_BASIC_LEVEL = 2280,
    2.     GEM_ADD_SLOT = 2281,
    3.     GEM_RANDOM = 2282,
    4.     GEM_RARE = 2283,
    5.     GEM_EPIC = 2284,
    6.     GEM_LEGENDARY = 2296,
    7.     gems_power = {
    8.         [2297] = {min_wl = 0, max_wl = 4, min_el = 0.3, max_el = 0.6, sl = function() return 2 end}, -- rare
    9.         [2298] = {min_wl = 3, max_wl = 6, min_el = 0.6, max_el = 0.7, sl = function() return 3 end}, -- epic
    10.         [2299] = {min_wl = 5, max_wl = 9, min_el = 0.8, max_el = 1, sl = function() return 4 end}, -- legendary
    11.         [2300] = {min_wl = 0, max_wl = 9, min_el = 0.3, max_el = 1, sl = function() return math.random(2, 4) end} -- random
    Line 1470:
    Code (Text):
    1.                 if item2:generateStats(u, STATS_SYSTEM_CONFIG.gems_power[item.itemid].sl(), math.random(STATS_SYSTEM_CONFIG.gems_power[item.itemid].min_wl, STATS_SYSTEM_CONFIG.gems_power[item.itemid].max_wl), math.floor(STATS_SYSTEM_CONFIG.maxLevel * STATS_SYSTEM_CONFIG.gems_power[item.itemid].min_el), math.ceil(STATS_SYSTEM_CONFIG.maxLevel * STATS_SYSTEM_CONFIG.gems_power[item.itemid].max_el)) then
    2.                     toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN)
    3.                     doRemoveItem(item.uid, 1)
    4.                     player:sendTextMessage(MESSAGE_INFO_DESCR, "Item modification successful.")
    5.                     return true
    6.                 else
    7.                     player:sendTextMessage(MESSAGE_INFO_DESCR, "Erro1.")
    8.                 end
    Actions:
    Code (Text):
    1. function onUse(player, item, fromPosition, itemEx, toPosition)
    2. if not (Item(itemEx.uid) or not Creature(itemEx.uid)) or itemEx.itemid == 2173 then return false end
    3. stat_onUse(player, item, fromPosition, itemEx, toPosition)
    4. return true
    5. end


    Thx!
     
    Last edited: Dec 19, 2016
  16. Kemixe

    Kemixe New Member

    Joined:
    Jul 18, 2014
    Messages:
    6
    Likes Received:
    1
    Best Answers:
    0
    Fixed! Working now.
     
  17. Exos

    Exos New Member

    Joined:
    Dec 20, 2016
    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Does someone know where can I increase the loot chance to test the loot please? Thank you
     
  18. Hokku

    Hokku Member

    Joined:
    Jul 25, 2013
    Messages:
    82
    Likes Received:
    11
    Best Answers:
    0
    i discover a bug related to regeneration, if u desquip and equip a item with regen, it get stacked, providing you a infinite regen, someone know how to fix it?

    related code to regen:

    Code (Text):
    1. function stat_regen(cid, itemid, slot, checkid, sid)
    2.         if not checkid then checkid = 1 end
    3.         if not player_regen[cid] then return true end
    4.         if not player_regen[cid][slot] then return true end
    5.         local player = Player(cid)
    6.         if not player then return true end
    7.         local item = player:getSlotItem(slot)
    8.         if not item then
    9.                 player_regen[cid][slot] = nil
    10.                 return true
    11.         end
    12.         if item:getId() ~= itemid then return true end
    13.      
    14.         local slotc = item:getStatSlotCount()
    15.         if slotc == 0 then
    16.                 player_regen[cid][slot] = nil
    17.                 return true
    18.         end
    19.      
    20.         player_regen[cid][slot] = player_regen[cid][slot] + 1
    21.         if checkid == 60 then
    22.                 local cur_slots = item:getStatSlots()
    23.                 for i = 1, slotc do
    24.                         if cur_slots[i][1] == 'regHP' or cur_slots[i][1] == 'regMP' then
    25.                                 if cur_slots[i][2]:match("%%") then
    26.                                         local a, b = cur_slots[i][2]:match('([+-])(%d+)%%')
    27.                                         if cur_slots[i][1] == 'regHP' then
    28.                                                 player:addHealth(math.ceil(player:getVocation():getHealthGainAmount() * (tonumber(a..b))/150))
    29.                                         end
    30.                                      
    31.                                         if cur_slots[i][1] == 'regMP' then
    32.                                                 player:addMana(math.ceil(player:getVocation():getManaGainAmount() * (tonumber(a..b))/150))
    33.                                         end
    34.                                 else
    35.                                         if cur_slots[i][1] == 'regHP' then
    36.                                                 player:addHealth(tonumber(cur_slots[i][2]))
    37.                                         end
    38.                                      
    39.                                         if cur_slots[i][1] == 'regMP' then
    40.                                                 player:addMana(tonumber(cur_slots[i][2]))
    41.                                         end
    42.                                 end
    43.                         end
    44.                 end
    45.                 checkid = 1
    46.         end
    47.         addEvent(stat_regen, 100, cid, itemid, slot, checkid + 1, sid + 1)
    48.         return true
    49. end
    tried changing:

    Code (Text):
    1.       player_regen[cid][slot] = player_regen[cid][slot] + 1
    to:

    Code (Text):
    1.       player_regen[cid][slot] = player_regen[cid][slot]
    and other things but not working :/
     
  19. xydius

    xydius Just an otland wanderer

    Joined:
    Feb 25, 2016
    Messages:
    43
    Likes Received:
    24
    Best Answers:
    0
    if i understood correctly u want to check the "extra loot" then edit this in the function improveChance()
    Code (Lua):
    1.  
    2.         if math.random(1, 100) <= extraPercent then
    just set "math.random(1,2)" so it goes through then in that same function find
    Code (Lua):
    1.  if math.random(1, 100000) <= (t_s[chosenId].chance + (t_s[chosenId].chance * extraPercent / 100)) * configManager.getNumber(configKeys.RATE_LOOT) then
    and do the same math.random (1,2) lol youll get extra loot every time just remember to put it back like it was, btw it only give one item and is one of the few with the lowest % to drop and its based on the item droprate so if

    item has 1% and extraloot is 28% you only have 1.28% (multiplied by server rate) to get that item xD just play with numbers ;P
     
  20. xydius

    xydius Just an otland wanderer

    Joined:
    Feb 25, 2016
    Messages:
    43
    Likes Received:
    24
    Best Answers:
    0
    Theres another bug when you use a random gem and it gives level but it doesnt give extra def so when you use a basic gem and it fails it gives negative extra def just fix that in generateLooted() function where it says

    Code (Lua):
    1. for o = 1, #upgradable_stats do
    2.                                                 local n_item_stat = upgradable_stats[o][2](it_id)
    3.                                                 if n_item_stat ~= 0 then
    4.                                                         self:setAttribute(upgradable_stats[o][1], getItemAttribute(uid, upgradable_stats[o][1]) + (upgradable_stats[o][3] * it_lvl))
    5.                                                 end
    6.                                         end
    just add this between the local variable and the if statement

    Code (Text):
    1.  
    2. if upgradable_stats[o][1] == ITEM_ATTRIBUTE_EXTRADEFENSE and (isWeapon(uid) or isShield(uid))then
    3.                                                         n_item_stat = 1
    4.                                                 end
    5.  
     

Share This Page

Loading...