• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent [onDeath] Add Item to Monster Corpse for Quest's [Item AID & DESC Included]

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Solutions
2
Reaction score
115
data/creaturescripts/scripts/login.lua
Code:
registerCreatureEvent(cid, "ItemInMonster")

data/creaturescripts/creaturescripts.xml
Code:
<event type="death" name="ItemInMonster" event="script" value="item_in_monster.lua"/>

data/creaturescripts/scripts/item_in_monster.lua
Code:
function onDeath(cid, corpse, deathList)
	local m = {
		["Morgaroth"] = { -- Monster Name
			cfg = {
				{
					id = XXXX, -- Item ID Here
					aid = 1000, -- Item Action ID Here
					desc = "" -- Item Description Here
				}
			}
		}
	}
	local monster = m[(getCreatureName(cid))]
	if(not monster) then
		return true
	end
	for i = 1, #monster.cfg do
		local c = monster.cfg[i]
		item = doAddContainerItem(corpse.uid, c.id, 1)
		doItemSetAttribute(item, "aid", c.aid)
		doItemSetAttribute(item, "description", c.desc)
	end
	return true
end
 
Seems nice but did you test it? 0.3.6 or 0.4?
 
you dont really need this part;
Code:
if(not monster) then
	return true
end
also i guess nahruto told you before?
 
this is really cool, good work as always.. and Xeon can you stop trying to correct everyone? :<
 
this is really cool, good work as always.. and Xeon can you stop trying to correct everyone? :<
actually im not trying to flame or something. but this part is not really important.
quoting Nahruto && JDB:
this part is not really necesary
Lua:
        if (not monster) then
                return true
        end
and already told you is not necesary return anything in added events
@Nahruto,

I will test it without and see if it works just fine. Thanks for that tip.

Edit: It works, thanks again.

Regards,
JDB.
>>729454
>>729454
>>729454
>>729462
>>729462
>>729462
 
it doesn't create a teleport

it adds an item to the slained monster..

read the script before talkin ** ight?
 
why not just edit his loot? and make it drop 100% of the time.. is this script really needed?
 
why not just edit his loot? and make it drop 100% of the time.. is this script really needed?

You can't add action id's in a monster xml file. Read the title.
This could be used for a "quest door" system, the monster drops a key with the door action id, etc...
 
Oh wow, this is cool.. so one question... when I add more monsters to this script is it like this
Code:
["Morgaroth"," Demodras"]
or like this?
Code:
["Morgaroth"],["Demodras"]
or just make a new script every time?
 
Oh wow, this is cool.. so one question... when I add more monsters to this script is it like this
Code:
["Morgaroth"," Demodras"]
or like this?
Code:
["Morgaroth"],["Demodras"]
or just make a new script every time?

Have you got it to work mate? Having trouble here..
 
But you can add in xml in item, actionid and uniqueid :

Code:
<loot>
<item id="2195" chance="9000" actionId="2323"/><!-- boots of haste -->
<item id="2195" chance="9000" uniqueId="2323"/><!-- boots of haste -->
</loot>
 
Back
Top