• 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 Lol, another LUA poop

Evan

A splendid one to behold
Senator
Premium User
Joined
May 6, 2009
Messages
7,019
Solutions
1
Reaction score
1,029
Location
United States
I may be the noobiest of them all in LUA, but here's another one.

Lua:
function onKill(cid, target, lastHit)
monsterPos = getCreaturePosition(target)
newMonsterPos = {x= 828, y= 1024, z= 7}
wall_pos = {x= 828, y= 1024, z= 7, stackpos= 1}  
wall = getThingfromPos(wall_pos)  

        if isPlayer(cid) and (getCreatureName(target):lower() == "rat") and wall.itemid == 8291 then
        doSendAnimatedText(monsterPos, "KILL!", TEXTCOLOR_ORANGE)
	  	doDecayItem(wall)
		doSummonCreature("Rat", newMonsterPos)
        end
    return TRUE
end

When you kill the rat, it is supposed to decay/remove the object on the ground (wall).

Everything else works, it summons the rat, it says "KILL!", but it just doesn't remove that freakin' little object!

[12:35:11.411] [Error - CreatureScript Interface]
[12:35:11.412] data/creaturescripts/scripts/demonoak.lua:eek:nKill
[12:35:11.414] Description:
[12:35:11.415] (luaDoDecayItem) Item not found
 
1 = top ground item

did you "reloaded" it correctly? you told your "reload" was not working...

try to remove/transform the item instead of decaying...
 
Okay, I don't know if it actually mattered, but the object is not an item.
It's an unmovable, blockable object. 8291 = demon oak face.

I restarted the server.
 
Lua:
function onKill(cid, target)
	if getCreatureName(target):lower() == "Rat" then
		local wall = getTileItemById({x = 100, y = 100, z = 7}, 8291)
		if wall.uid > 0 then
			doRemoveItem(wall.uid)
			doSendAnimatedText(getCreaturePosition(target), "KILL!", TEXTCOLOR_ORANGE)
			doCreateMonster("Rat", {x = 100, y = 100, z = 7})
		end
	end
	
	return true
end

Try this if "text" doesn't work.

Lua:
doCreatureSay(target, "KILL!", TALKTYPE_MONSTER)
 
Last edited:
Back
Top