• 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

The console says why. Post your error, we're scripters, not faires.
Edit: My bad, xml debugger is shit. Rewrite that mod to creaturescript.
 
i fix it but idk its now work fine but don't loot any random items but other loot work fine now
 
this script don't work for tfs 0.4 dev when kill monster no loot and when change monsterlootmsg to 0 no loot and no msg and when kill monster all script appear in consol :S anyone know why ?
you wont get help, use 0.3.6 by cykotitan
 
now its work no bugs but never loot random items D:"
 
Hmm I'm using 0.3.6 and i found this error when i tried to kill some monsters
Code:
[25/04/2015 16:15:09] [Error - CreatureScript Interface]
[25/04/2015 16:15:09] In a timer event called from:
[25/04/2015 16:15:09] buffer:onKill
[25/04/2015 16:15:09] Description:
[25/04/2015 16:15:09] [string "loadBuffer"]:53: attempt to compare number with nil
[25/04/2015 16:15:09] stack traceback:
[25/04/2015 16:15:09]     [string "loadBuffer"]:53: in function 'createLoot'
[25/04/2015 16:15:10]     [string "loadBuffer"]:225: in function <[string "loadBuffer"]:212>
 
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')
 
@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
 
@imkingran got this - but monsters drop loot again

j76fso.png

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

Use addEvent() to send delayed messages.

addEvent(callback, delay, ...)

Here is a full list of functions you may find helpful: TFS 0.4 Functions
 
Use addEvent() to send delayed messages.

addEvent(callback, delay, ...)

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

I added
Code:
             if( ret )then
               doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
              doSendAnimatedText(pos, ret:upper(), tiers[ret].color)
              addEvent(callback, delay, 1000)
             end
and I get an error "Callback parameter should be a function"
 
I added
Code:
             if( ret )then
               doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
              doSendAnimatedText(pos, ret:upper(), tiers[ret].color)
              addEvent(callback, delay, 1000)
             end
and I get an error "Callback parameter should be a function"

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

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