[Mod] Random Item Stats

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

  1. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,199
    Likes Received:
    365
    Best Answers:
    6
    These words pos, text, color are empty values. These are just letting you know what parameters the function doSendAnimatedText uses.

    The
    position where you would like to send the words should replace the word pos.
    The
    text that you would like to send should replace the word text.
    The
    color that you would like to send should replace the word color.

    addEvent(doSendAnimatedText, 1000, {x=1000,y=1000,z=7}, "TxtTxt", 180)


    The answer to your problem is right infront of you. Just take a look at what the previous function uses as parameters:
    doSendAnimatedText(pos, ret:upper(), tiers[ret].color)
     
  2. Lifer420

    Lifer420 Well-Known Member

    Joined:
    Jul 27, 2009
    Messages:
    1,485
    Likes Received:
    188
    Best Answers:
    0
    Yeah that's why it was confusing me, because I didnt know what that meant "ret:upper() tiers" and all that so it threw me off because it's referring to a spot in the code already. I tried searching, as I said, but couldn't figure it out. The position I need to be where the creature died, so I also leave that at "pos, ret:upper()," I assume?
     
  3. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,199
    Likes Received:
    365
    Best Answers:
    6
    Code (Text):
    1. addEvent(doSendAnimatedText, 1000, pos, ret:upper(), tiers[ret].color)
     
  4. Lifer420

    Lifer420 Well-Known Member

    Joined:
    Jul 27, 2009
    Messages:
    1,485
    Likes Received:
    188
    Best Answers:
    0
    I just tried this exact thing, ill try it again and see if it works. Maybe it;'s where im putting it, though? I'm putting it directly under the "pos:upper ret[color]" thing, and directly ABOVE the
    "end"

    Edit : It worked, it repeated it once. Im going to mess around with it to see if I can get it to do it more than once. thanks so much for your help though bud, you really did help a lot <3
     
    imkingran likes this.
  5. Drahnus Soules

    Drahnus Soules New Member

    Joined:
    May 31, 2015
    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    I keep getting a error.
    Loading items.xml...(error - ScriptManager::loadFromX,ml_ Cannot load mod items.xml
    Line 1, Info: Start tag expected, '<' not found
     
  6. Drahnus Soules

    Drahnus Soules New Member

    Joined:
    May 31, 2015
    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    I am using 3884 tfs , can someone help me to get it to work please?
     
  7. nozyy1234

    nozyy1234 New Member

    Joined:
    Aug 7, 2015
    Messages:
    3
    Likes Received:
    1
    Best Answers:
    0
    a ny idea whats wrong here ?

    [07/08/2015 15:20:08] [Error - CreatureScript Interface]
    [07/08/2015 15:20:08] In a timer event called from:
    [07/08/2015 15:20:08] buffer:eek:nKill
    [07/08/2015 15:20:08] Description:
    [07/08/2015 15:20:08] [string "loadBuffer"]:53: attempt to compare number with nil
    [07/08/2015 15:20:08] stack traceback:
    [07/08/2015 15:20:08] [string "loadBuffer"]:53: in function 'createLoot'
    [07/08/2015 15:20:08] [string "loadBuffer"]:225: in function <[string "loadBuffer"]:212>
     
  8. chiitus

    chiitus Member

    Joined:
    Jun 1, 2009
    Messages:
    202
    Likes Received:
    10
    Best Answers:
    0
    I'm using this script, but from other site (it's the same script), but this one don't have bug.
    http://pasted.co/ac23f6da
    Obs: Otland characters limit.

    Who have the double_loot_ring from Cyko and want to use both, just:
    In Random item stats mod:
    Code (Text):
    1. flecha = getPlayerSlotItem(cid, 9)
    2.    if( (damage == true or bit.band(flags, 1) == 1) and isMonster(target) and not (flecha.itemid == 8266) )then -- 0.3/4
    And in loot_ring mod:
    Code (Text):
    1. if (lastHit and isMonster(target)) and (flecha.itemid == 8266) then
    Don't forget to change 8266 to your loot ring id (if you have the script).
    Thanks!
     
  9. Lbtg

    Lbtg Well-Known Member

    Joined:
    Nov 22, 2008
    Messages:
    1,830
    Likes Received:
    38
    Best Answers:
    0
    this error im recieving on killing monster
    PHP:
    1.  
    2.  
    3. [Error - CreatureScript Interface]
    4. In a timer event called from:
    5. buffer:onKill
    6. Description:
    7. [string "loadBuffer"]:53: attempt to compare number with nil
    8. stack traceback:
    9.         [string "loadBuffer"]:53: in function 'createLoot'
    10.         [string "loadBuffer"]:225: in function <[string "loadBuffer"]:212>
    11.  
     
  10. God Mythera

    God Mythera Well-Known Member

    Joined:
    Aug 11, 2012
    Messages:
    1,943
    Likes Received:
    215
    Best Answers:
    0
    any way to make creature script? i cant use mods ; S
     
  11. God Mythera

    God Mythera Well-Known Member

    Joined:
    Aug 11, 2012
    Messages:
    1,943
    Likes Received:
    215
    Best Answers:
    0
    can someone make this for creaturescripts? ;>
     
  12. God Mythera

    God Mythera Well-Known Member

    Joined:
    Aug 11, 2012
    Messages:
    1,943
    Likes Received:
    215
    Best Answers:
    0
    can someone make this for creaturescripts? my exe cant use mods.
     
  13. God Mythera

    God Mythera Well-Known Member

    Joined:
    Aug 11, 2012
    Messages:
    1,943
    Likes Received:
    215
    Best Answers:
    0
    can someone make this for creaturescripts?
     
  14. edwinaaa

    edwinaaa New Member

    Joined:
    Jan 31, 2014
    Messages:
    13
    Likes Received:
    1
    Best Answers:
    0
    hello a question have the script for otx versions 10.20 to 10.36 ?
     
    Piotrek1447 likes this.
  15. jmarkos

    jmarkos Member

    Joined:
    Dec 11, 2008
    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Thanks for the mod bro.
     
  16. Extrodus

    Extrodus OTList.net Founder

    Joined:
    Dec 22, 2008
    Messages:
    2,222
    Likes Received:
    274
    Best Answers:
    1
    Havent gotten around to testing yet, but just wanted to ask - we have a storage for extraloot = 123.

    If I set a player to doPlayerSetStorage(cid, 123, 50) would that increase his find chance by 50%?
     
  17. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,199
    Likes Received:
    365
    Best Answers:
    6
    rate = getConfigInfo('rateLoot')
    local s = getCreatureStorage(cid, extra_loot_key)
    addEvent(dropLoot, 0, getThingPos(target), v, s == -1 and rate or s, getCreatureMaster(target), cid, target)


    It looks like it will just use the extra_loot_key value in place of the normal loot rate if the players storage value is not equal to -1.
    So you could make it higher or lower than the normal loot rate if you so choose.
     
    newby and Extrodus like this.
  18. newby

    newby Member

    Joined:
    Jun 11, 2016
    Messages:
    66
    Likes Received:
    13
    Best Answers:
    0
    So if i want create a amulet donate
    And this amulet add give +50% chance to drop a item with stats

    Thats the way? \/

    Movements changes:
    Code (Text):
    1.  
    2.     <!-- enchant loot amulet -->
    3.    <movevent type="Equip" itemid="11393" slot="ring" event="function" value="onEquipItem"/>
    4.    <movevent type="DeEquip" itemid="11393" slot="ring" event="function" value="onDeEquipItem"/>
    5.  
    Code (Text):
    1.  
    2. local storage = 11393
    3.  
    4. function onEquip(cid, item, slot)
    5.    if getPlayerStorageValue(cid, storage) < 1 then
    6.         if getPlayerSlotItem(cid, slot).itemid == item.itemid then
    7.           setPlayerStorageValue(cid, storage, 1)
    8.           doPlayerSave(cid)
    9.         end
    10.    end
    11.    return callfunction(cid, item.uid, slot)
    12. end
    13.  
    14. function onDeEquip(cid, item, slot)
    15.    if getPlayerStorageValue(cid, storage) > 0 then
    16.       setPlayerStorageValue(cid, storage, -1)
    17.       doPlayerSave(cid)
    18.    end
    19.    return callfunction(cid, item.uid, slot)
    20. end
    21.  
    Mod changes:
    Code (Text):
    1.  
    2. function onKill(cid, target, damage, flags)
    3.     if( (damage == true or bit.band(flags, 1) == 1) and isMonster(target) )then -- 0.3/4
    4.         local v = getMonsterInfo(getCreatureName(target))
    5.         if( v and v.lookCorpse ~= 0 )then
    6.             local s = getCreatureStorage(cid, extra_loot_key)
    7.             if getPlayerStorageValue(cid, 11393) > 0 then
    8.                 rate = rate + (rate/2)
    9.             end
    10.             addEvent(dropLoot, 0, getThingPos(target), v, s == -1 and rate or s, getCreatureMaster(target), cid, target)
    11.         end
    12.     end
    13.     return true
    14. end
    15.  
    16.  
     
  19. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,199
    Likes Received:
    365
    Best Answers:
    6
    I guess you could do that. But why not just check to see if the player is wearing the amulet on the kill? Or are you using that storage in other scripts to achieve the same purpose?

    If it's not the latter then try this (non-tested/might not be proper syntax for 0.4)
    Code (Text):
    1. local bonusAmuletId = 11393
    2. function onKill(cid, target, damage, flags)
    3.     if( (damage == true or bit.band(flags, 1) == 1) and isMonster(target) )then -- 0.3/4
    4.         local v = getMonsterInfo(getCreatureName(target))
    5.         if( v and v.lookCorpse ~= 0 )then
    6.             local s = getCreatureStorage(cid, extra_loot_key) -- This will be (-1) since you're not using it so the addEvent will return 'rare' and not 's' [s == -1 and rate or s]
    7.             local ammy = getPlayerSlotItem(cid, CONST_SLOT_NECKLACE)
    8.             if ammy then
    9.                 if ammy.itemid == bonusAmuletId then
    10.                     rate = rate * 1.5 -- If he's wearing the amulet then give him 50% extra chance
    11.                 end
    12.             end
    13.             addEvent(dropLoot, 0, getThingPos(target), v, s == -1 and rate or s, getCreatureMaster(target), cid, target)
    14.         end
    15.     end
    16.     return true
    17. end
     
    newby likes this.
  20. newby

    newby Member

    Joined:
    Jun 11, 2016
    Messages:
    66
    Likes Received:
    13
    Best Answers:
    0
    Thank you
    No, i just didnt know it was possible to do there, i made that looking others scripts...
    But it you send, not work, even i changing
    Code (Text):
    1.  
    2. rate = rate * 1.5 -- If he's wearing the amulet then give him 50% extra chance
    3.  
    To
    Code (Text):
    1.  
    2. rate = rate * 1000.5 -- If he's wearing the amulet then give him 50% extra chance
    3.  
    Nothing change...
     

Share This Page

Loading...