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

Lua Adding an item with an ActionID in monster loot

<item id="2087" chance="50000" actionId="1337"/><!-- wooden key -->

This will drop a wooden key 50% of the time in the body of the monster with actionId 1337 - allowing the key to be used on a door. If you want unique, simply change actionId to uniqueId.

Hopefully this helps, basic stuff so I shouldn't have to tell you where to put it.
 
<item id="2087" chance="50000" actionId="1337"/><!-- wooden key -->

This will drop a wooden key 50% of the time in the body of the monster with actionId 1337 - allowing the key to be used on a door. If you want unique, simply change actionId to uniqueId.

Hopefully this helps, basic stuff so I shouldn't have to tell you where to put it.

I'm pretty sure you can't add actionid in the xml of a monster? I tried it anyway and the server crashes when the amazon dies..! UniqueID works fine.
 
I've figured it out at last. In case anyone is interested:

create a creature script called item.lua

Lua:
function onDeath(cid, corpse, deathList)
local item = doCreateItemEx(2376)
doItemSetAttribute(item, 'aid', 666)
doAddContainerItemEx(corpse.uid, item)
return true
end

in creaturescripts.xml

XML:
<event type="death" name="item" event="script" value="item.lua"/>

in the monsters xml

XML:
<script>
<event name="item"/>
</script>

Drops a sword with the action id 666.
Solved!
 
Now that I test this on 0.3.6 it doesn't work.. so now I'm in the same boat as you. Anyone got any ideas?
 
Something strange happens. When a player moves the item from the monster to backpack the action id disappears, any clue what's happening?
Did you tested it with the sword or with a stackable item, because with stackable items the added attributes disappear when you move it.
It should work fine with non stackable items.
 
Did you tested it with the sword or with a stackable item, because with stackable items the added attributes disappear when you move it.
It should work fine with non stackable items.

Aha! I tested it with a stackable item. Good thinking! Never would have figured that out :D
 
I've figured it out at last. In case anyone is interested:

create a creature script called item.lua

Lua:
function onDeath(cid, corpse, deathList)
local item = doCreateItemEx(2376)
doItemSetAttribute(item, 'aid', 666)
doAddContainerItemEx(corpse.uid, item)
return true
end

in creaturescripts.xml

XML:
<event type="death" name="item" event="script" value="item.lua"/>

in the monsters xml

XML:
<script>
<event name="item"/>
</script>

Drops a sword with the action id 666.
Solved!
helped me too much but i wants to add chance to drop this key :D and i need to add something to remove this key when i use it once
thx again
 
Back
Top