[Mod] Random Item Stats

Discussion in 'Mods & Lua Functions' started by Cykotitan, Jun 1, 2011.

  1. zbizu

    zbizu ‌‌Luakami

    Joined:
    Nov 22, 2010
    Messages:
    2,438
    Likes Received:
    1,332
    Best Answers:
    0
    The console says why. Post your error, we're scripters, not faires.
    Edit: My bad, xml debugger is shit. Rewrite that mod to creaturescript.
     
  2. heba

    heba Well-Known Member

    Joined:
    Aug 5, 2011
    Messages:
    1,221
    Likes Received:
    163
    Best Answers:
    8
    i fix it but idk its now work fine but don't loot any random items but other loot work fine now
     
  3. 7804364

    7804364 Member

    Joined:
    Mar 6, 2010
    Messages:
    472
    Likes Received:
    10
    Best Answers:
    0
    you wont get help, use 0.3.6 by cykotitan
     
  4. heba

    heba Well-Known Member

    Joined:
    Aug 5, 2011
    Messages:
    1,221
    Likes Received:
    163
    Best Answers:
    8
    i don't have 0.3.6 tfs i have 0.4
     
  5. 7804364

    7804364 Member

    Joined:
    Mar 6, 2010
    Messages:
    472
    Likes Received:
    10
    Best Answers:
    0
    better start using 0.3.6
     
  6. heba

    heba Well-Known Member

    Joined:
    Aug 5, 2011
    Messages:
    1,221
    Likes Received:
    163
    Best Answers:
    8
    noway 0.4 better i will try again to fix this
     
  7. heba

    heba Well-Known Member

    Joined:
    Aug 5, 2011
    Messages:
    1,221
    Likes Received:
    163
    Best Answers:
    8
    now its work no bugs but never loot random items D:"
     
  8. imback1

    imback1 Unknown member

    Joined:
    Jul 11, 2013
    Messages:
    765
    Likes Received:
    42
    Best Answers:
    1
    Hmm I'm using 0.3.6 and i found this error when i tried to kill some monsters
    Code (Text):
    1.  
    2. [25/04/2015 16:15:09] [Error - CreatureScript Interface]
    3. [25/04/2015 16:15:09] In a timer event called from:
    4. [25/04/2015 16:15:09] buffer:onKill
    5. [25/04/2015 16:15:09] Description:
    6. [25/04/2015 16:15:09] [string "loadBuffer"]:53: attempt to compare number with nil
    7. [25/04/2015 16:15:09] stack traceback:
    8. [25/04/2015 16:15:09]     [string "loadBuffer"]:53: in function 'createLoot'
    9. [25/04/2015 16:15:10]     [string "loadBuffer"]:225: in function <[string "loadBuffer"]:212>
     
  9. zbizu

    zbizu ‌‌Luakami

    Joined:
    Nov 22, 2010
    Messages:
    2,438
    Likes Received:
    1,332
    Best Answers:
    0
  10. durassek

    durassek New Member

    Joined:
    Dec 2, 2008
    Messages:
    12
    Likes Received:
    1
    Best Answers:
    0
    id this would be working on tfs 1.1?
     
  11. Lifer420

    Lifer420 Well-Known Member

    Joined:
    Jul 27, 2009
    Messages:
    1,486
    Likes Received:
    185
    Best Answers:
    0
    if( getConfigInfo('monsterLootMessage') ~= 0 )then
    print('[Notice] Set monsterLootMessage = 0 to prevent duplicate loot messages')
    end
    ]]></config>

    ^ is that the end of the first script, then make a 2nd one for the one blow this? or is it all one? Confusing when it's not in lua/a php box

    <event type="kill" name="itemstats" event="script"><![CDATA[
    domodlib('itemstats_conf')
     
  12. Lifer420

    Lifer420 Well-Known Member

    Joined:
    Jul 27, 2009
    Messages:
    1,486
    Likes Received:
    185
    Best Answers:
    0
    @imkingran when I add that to mods, I login to my OT and I test it (with minotaurs atm) but whatever I kill, itll say "Loot of a XX - " then all the items, but there's NOTHING in the body at all.

    Edit : The log itself is a huge ass error lol
     
  13. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,194
    Likes Received:
    358
    Best Answers:
    5
  14. Lifer420

    Lifer420 Well-Known Member

    Joined:
    Jul 27, 2009
    Messages:
    1,486
    Likes Received:
    185
    Best Answers:
    0
  15. Lifer420

    Lifer420 Well-Known Member

    Joined:
    Jul 27, 2009
    Messages:
    1,486
    Likes Received:
    185
    Best Answers:
    0
    @imkingran got this - but monsters drop loot again

    [​IMG]
    That's from killing 1 mino that dropped 18:27 Loot of a minotaur: a bag, a sword, leather legs, a plate shield, a chain armor.

    Edit : I got it working, but it didn't say the "RARE" above the body. I want it to say "RARE" or w/e type it is for 5s, once per second :X
     
    Last edited: Apr 23, 2015
  16. Lifer420

    Lifer420 Well-Known Member

    Joined:
    Jul 27, 2009
    Messages:
    1,486
    Likes Received:
    185
    Best Answers:
    0
    Can anyone help me? The rare/legendary items drop, but it doesn't do any effect. How can I make it say "RARE" with a green sparkle under it once every second, for 5 seconds, above the body that dropped it?
     
  17. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,194
    Likes Received:
    358
    Best Answers:
    5
    Use addEvent() to send delayed messages.

    addEvent(callback, delay, ...)

    Here is a full list of functions you may find helpful: TFS 0.4 Functions
     
  18. Lifer420

    Lifer420 Well-Known Member

    Joined:
    Jul 27, 2009
    Messages:
    1,486
    Likes Received:
    185
    Best Answers:
    0
    I added
    Code (Text):
    1.  
    2.              if( ret )then
    3.                doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
    4.               doSendAnimatedText(pos, ret:upper(), tiers[ret].color)
    5.               addEvent(callback, delay, 1000)
    6.              end
    and I get an error "Callback parameter should be a function"
     
  19. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,194
    Likes Received:
    358
    Best Answers:
    5
    addEvent(callback, delay, parameters)

    "Callback should be a function" - this means exactly that. In your situation what are the functions that you are trying to add a delay on?
    - doSendAnimatedText
    - doSendMagicEffect
    Those functions should replace the word callback.

    Next is delay, you should replace here the time in miliseconds for which you would like to delay the event.
    - 1000
    This number should replace the word delay.

    Last but not least is the parameters. These parameters should match the parameters of the function you are trying to callback. Let's take a look at doSendAnimatedText for example:

    doSendAnimatedText(pos, text, color) -- The words in green are the parameters of the function. These are the values that should be added to the end of the addEvent.

    addEvent(doSendAnimatedText, 1000, pos, text, color)
    addEvent(callback, delay, parameters)
     
  20. Lifer420

    Lifer420 Well-Known Member

    Joined:
    Jul 27, 2009
    Messages:
    1,486
    Likes Received:
    185
    Best Answers:
    0
    Hmm that really helped alot. But can you show me where to put it and all? Just so you know, before I blindly ask questions, im trying to configure it myself personally, but I just can't get it :X

    I was trying " addEvent(doSendAnimatedText, 1000, pos, RARE, color)" and after RARE pops up, 1000MS later a black 0 pops up, or a 9, or something (cant really tell) Here's the script from where it says CONST_ME_MAGIC_GREEN the first time, down to the second time. I guess after this experience, I should prolly learn to script, like, actually script. I've just been editing ones and I learn little things here and there about what makes WHICH thing work. So i'm getting some knowledge, but obviously not enough lmfao

    Code (Text):
    1.  
    2. if( ret )then
    3.            doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
    4.           doSendAnimatedText(pos, ret:upper(), tiers[ret].color)
    5.           addEvent(doSendAnimatedText, 1000, pos, RARE, color)
    6.          end
    7.          doAddContainerItemEx(parent, tmp)
    8.          size = size + 1
    9.        end
    10.      end
    11.    end
    12.    return size > 0
    13. end
    14. local function dropLoot(pos, v, ext, master, cid, target)
    15.    local corpse
    16.    if( not master or master == target )then -- 0.3/4
    17.      corpse = getTileItemById(pos, v.lookCorpse).uid
    18.      if( isContainer(corpse) )then
    19.        for i = 1, getContainerSize(corpse) do
    20.          doRemoveItem(getContainerItem(corpse, 0).uid)
    21.        end
    22.        local size, cap = 0, getContainerCap(corpse)
    23.        for i = 1, #v.loot do
    24.          if( size == cap )then
    25.            break
    26.          end
    27.          local tmp, ret = createLoot(v.loot[i], ext)
    28.          if( tmp )then
    29.            if( isContainer(tmp) )then
    30.              if( createChildLoot(tmp, v.loot[i].child, ext, pos) )then
    31.                doAddContainerItemEx(corpse, tmp)
    32.                size = size + 1
    33.              else
    34.                doRemoveItem(tmp)
    35.              end
    36.            else
    37.              if( ret )then
    38.                doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
    39.               doSendAnimatedText(pos, ret:upper(), tiers[ret].color)
    40.               addEvent(doSendAnimatedText, 1000, pos, RARE, color)
    41.              end
     

Share This Page

Loading...