• 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!

[Mod] Random Item Stats

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:
if( ret )then
           doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
          doSendAnimatedText(pos, ret:upper(), tiers[ret].color)
          addEvent(doSendAnimatedText, 1000, pos, RARE, color)
         end
         doAddContainerItemEx(parent, tmp)
         size = size + 1
       end
     end
   end
   return size > 0
end
local function dropLoot(pos, v, ext, master, cid, target)
   local corpse
   if( not master or master == target )then -- 0.3/4
     corpse = getTileItemById(pos, v.lookCorpse).uid
     if( isContainer(corpse) )then
       for i = 1, getContainerSize(corpse) do
         doRemoveItem(getContainerItem(corpse, 0).uid)
       end
       local size, cap = 0, getContainerCap(corpse)
       for i = 1, #v.loot do
         if( size == cap )then
           break
         end
         local tmp, ret = createLoot(v.loot[i], ext)
         if( tmp )then
           if( isContainer(tmp) )then
             if( createChildLoot(tmp, v.loot[i].child, ext, pos) )then
               doAddContainerItemEx(corpse, tmp)
               size = size + 1
             else
               doRemoveItem(tmp)
             end
           else
             if( ret )then
               doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
              doSendAnimatedText(pos, ret:upper(), tiers[ret].color)
              addEvent(doSendAnimatedText, 1000, pos, RARE, color)
             end

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)
 
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)

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?
 
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?

Code:
addEvent(doSendAnimatedText, 1000, pos, ret:upper(), tiers[ret].color)
 
Code:
addEvent(doSendAnimatedText, 1000, pos, ret:upper(), tiers[ret].color)

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
 
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
 
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>
 
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!
 
this error im recieving on killing monster
PHP:
[Error - CreatureScript Interface]
In a timer event called from:
buffer:onKill
Description:
[string "loadBuffer"]:53: attempt to compare number with nil
stack traceback:
        [string "loadBuffer"]:53: in function 'createLoot'
        [string "loadBuffer"]:225: in function <[string "loadBuffer"]:212>
 
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%?
 
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%?

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.
 
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.

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
 
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

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
 
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

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...
 
Back
Top