[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,151
    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,492
    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,151
    Code:
    addEvent(doSendAnimatedText, 1000, pos, ret:upper(), tiers[ret].color)
     
  4. Lifer420

    Lifer420 Well-Known Member

    Joined:
    Jul 27, 2009
    Messages:
    1,492
    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
    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
    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
    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:
    201
    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:
    flecha = getPlayerSlotItem(cid, 9)
       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:
    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,823
    this error im recieving on killing monster
    PHP:

    [Error CreatureScript Interface]
    In a timer event called from:
    buffer:onKill
    Description
    :
    [
    string "loadBuffer"]:53attempt to compare number with nil
    stack traceback
    :
            [
    string "loadBuffer"]:53in function 'createLoot'
            
    [string "loadBuffer"]:225in function <[string "loadBuffer"]:212>
     
  10. God Mythera

    God Mythera Well-Known Member

    Joined:
    Aug 11, 2012
    Messages:
    1,871
    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,871
    can someone make this for creaturescripts? ;>
     
  12. God Mythera

    God Mythera Well-Known Member

    Joined:
    Aug 11, 2012
    Messages:
    1,871
    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,871
    can someone make this for creaturescripts?
     
  14. edwinaaa

    edwinaaa New Member

    Joined:
    Jan 31, 2014
    Messages:
    13
    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
    Thanks for the mod bro.
     
  16. Extrodus

    Extrodus OTList.net Founder

    Joined:
    Dec 22, 2008
    Messages:
    2,176
    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,151
    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:
    55
    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:
        <!-- enchant loot amulet -->
       <movevent type="Equip" itemid="11393" slot="ring" event="function" value="onEquipItem"/>
       <movevent type="DeEquip" itemid="11393" slot="ring" event="function" value="onDeEquipItem"/>
    
    Code:
    local storage = 11393
    
    function onEquip(cid, item, slot)
       if getPlayerStorageValue(cid, storage) < 1 then
            if getPlayerSlotItem(cid, slot).itemid == item.itemid then
              setPlayerStorageValue(cid, storage, 1)
              doPlayerSave(cid)
            end
       end
       return callfunction(cid, item.uid, slot)
    end
    
    function onDeEquip(cid, item, slot)
       if getPlayerStorageValue(cid, storage) > 0 then
          setPlayerStorageValue(cid, storage, -1)
          doPlayerSave(cid)
       end
       return callfunction(cid, item.uid, slot)
    end
    
    Mod changes:
    Code:
    function onKill(cid, target, damage, flags)
        if( (damage == true or bit.band(flags, 1) == 1) and isMonster(target) )then -- 0.3/4
            local v = getMonsterInfo(getCreatureName(target))
            if( v and v.lookCorpse ~= 0 )then
                local s = getCreatureStorage(cid, extra_loot_key)
                if getPlayerStorageValue(cid, 11393) > 0 then
                    rate = rate + (rate/2)
                end
                addEvent(dropLoot, 0, getThingPos(target), v, s == -1 and rate or s, getCreatureMaster(target), cid, target)
            end
        end
        return true
    end
    
    
     
  19. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,151
    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:
    local bonusAmuletId = 11393
    function onKill(cid, target, damage, flags)
        if( (damage == true or bit.band(flags, 1) == 1) and isMonster(target) )then -- 0.3/4
            local v = getMonsterInfo(getCreatureName(target))
            if( v and v.lookCorpse ~= 0 )then
                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]
                local ammy = getPlayerSlotItem(cid, CONST_SLOT_NECKLACE)
                if ammy then
                    if ammy.itemid == bonusAmuletId then
                        rate = rate * 1.5 -- If he's wearing the amulet then give him 50% extra chance
                    end
                end
                addEvent(dropLoot, 0, getThingPos(target), v, s == -1 and rate or s, getCreatureMaster(target), cid, target)
            end
        end
        return true
    end
     
    newby likes this.
  20. newby

    newby Member

    Joined:
    Jun 11, 2016
    Messages:
    55
    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:
    rate = rate * 1.5 -- If he's wearing the amulet then give him 50% extra chance
    
    To
    Code:
    rate = rate * 1000.5 -- If he's wearing the amulet then give him 50% extra chance
    
    Nothing change...
     

Share This Page