• 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 Error while adding special description(creaturescript)

Tech_Rob

New Member
Joined
Oct 10, 2007
Messages
100
Reaction score
1
I am trying to get a key to drop from a monster. I can't seem to get a key to be looted out of the corpse, but I was given a script that will place the key directly to the killer. This is the script I am using, but it does give an error when I try to add a special description to it.

Code:
local key = XXXX

function onKill(cid, target, lastHit)
	if isMonster(target) then
		doItemSetAttribute(doPlayerAddItem(cid, key, 1), "aid", 1200)
		  doSetItemSpecialDescription(key, 'This key once belonged to the gatekeeper.')
	end
	return true
end

This will keep the monster alive, and constantly give the key over and over again. Until it crashes the server. Without the set special desc, it will work fine. Any possibility someone can assist with getting a working script to loot a key out of the dead corpse with a special desc?
 
Code:
local key = XXXX

function onKill(cid, target, lastHit)
	if isMonster(target) then
		local v = doPlayerAddItem(cid, key, 1)
		doItemSetAttribute(v, "aid", 1200)
		doItemSetAttribute(v, "description", "This key once belonged to the gatekeeper.")
	end
	return true
end
 
How would I then put this script into adding the key to a corpse rather then adding to the killers bp? I have tried with onDeath function, but it gives error unknown corpse.
 
Code:
local key = XXXX

function onDeath(cid, corpse, deathList)
	if isMonster(cid) then
		local v = doAddContainerItem(corpse, key, 1)
		doItemSetAttribute(v, "aid", 1200)
		doItemSetAttribute(v, "description", "This key once belonged to the gatekeeper.")
	end
	return true
end
 
Just gave that script a shot, and returned this error.


[08/03/2010 19:14:51] [Error - CreatureScript Interface]
[08/03/2010 19:14:51] data/creaturescripts/scripts/scroll.lua:eek:nDeath
[08/03/2010 19:14:51] Description:
[08/03/2010 19:14:51] (luaDoAddContainerItem) Container not found

[08/03/2010 19:14:51] [Error - CreatureScript Interface]
[08/03/2010 19:14:51] data/creaturescripts/scripts/scroll.lua:eek:nDeath
[08/03/2010 19:14:51] Description:
[08/03/2010 19:14:51] (luaDoItemSetAttribute) Item not found

[08/03/2010 19:14:51] [Error - CreatureScript Interface]
[08/03/2010 19:14:51] data/creaturescripts/scripts/scroll.lua:eek:nDeath
[08/03/2010 19:14:51] Description:
[08/03/2010 19:14:51] (luaDoItemSetAttribute) Item not found

This is right along the same issues I have had before. Not finding a container or "corpse"
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
	<monster name="Barbarian Headsplitter" nameDescription="a barbarian headsplitter" race="blood" experience="85" speed="270" manacost="450">
	<health now="100" max="100"/>
	<look type="253" head="115" body="105" legs="119" feet="132" corpse="6080"/>

Yes
 
Noticed another issue found with the script onKill given. This script seems to activate on every monster killed. If I kill a rabbit, then the key is given to the player. Even though the event is not in the rabbits xml file.

Also, still no luck with a working script to add the item to a corpse.
 
Anyone able to solve the adding key to body in creaturescript yet? I still have had no luck, and running out of ideas. Please post if its possible. Thanks.
 
Back
Top