• 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 Script not working

arturhaddad

Member
Joined
Aug 14, 2010
Messages
217
Reaction score
8
I'm trying to do Blue Legs quest

In this quest, you kill "Koshei the Deathless" and uses an amulet on his body so he won't reborn, but I'm having trouble making him reborn

I've made this script:

koshei_the_deathless.lua
Lua:
function onDeath(cid, corpse, killer)

if getCreatureName(cid) == 'Koshei The Deathless' then
doCreatureSay(cid,"Quickly, use koshei's amulet on his body before he reborns!",TALKTYPE_ORANGE_1)
addEvent(summonKoshei, (1000*5))
end

function summonKoshei()
	if getPlayerStorageValue(cid, 20560) > 1 then
	doSummonCreature("Koshei The Deathless", {x=33271, y=32408, z=12})
	doSummonCreature("Bonebeast", {x=33272, y=32408, z=12})
	return TRUE
end
end
end

It should summon koshei again if storage is > 1, 'cause when u use the amulet on him it should set storage to 1...

But it isn't working

login.lua

Lua:
registerCreatureEvent(cid, "koshei")

creaturescripts.xml

Lua:
<event type="death" name="koshei" script="koshei_the_deathless.lua"/>

No errors on console but nothing happens, I've tried to debug the script and when I kill koshei with bugged script it reports on console, what I mean is that the script is running when I kill the monster, 'cause if it didn't, it would give no errors

Thanks!
 
Tried this as well, didn't work

Lua:
function onDeath(cid, corpse, killer)
 local message = "Quickly, use koshei's amulet on his body before he reborns!"
 local creaturename = getCreatureName(cid)
 
 if creaturename == 'Koshei the Deathless' then
doCreatureSay(cid, message, TALKTYPE_ORANGE_1)
addEvent(summon, (1000*time_to_pass))
end

function summon()
doSummonCreature("Koshei The Deathless", {x=33271, y=32411, z=12})
end
end
 
Thats odd, it isn't working, nothing happens when I kill him...

What's wrong? :s

-- edit --

working now, made some little changes and it end up working, probably my fault kk

thanks a lot CYK!!!!
 
Last edited:
well, debug the parameters and execution already

remember that this should be registered in login.lua, as it has to be executed for the player not monster
 
Cyk, one more thing..

To make monster don't reborn after using amulet, I've tried this:

Lua:
function check(p)
	local corpse = getTileItemById(p, 8271).uid
	if corpse ~= 0 then
	 if getPlayerStorageValue(cid, 36205) == -1 then
		doRemoveItem(corpse)
		doCreateMonster('Koshei the Deathless', p)
		doSendMagicEffect(p, CONST_ME_TELEPORT)
		end
	end
end
 
function onKill(cid, target, lastHit)
	if lastHit and isMonster(target) and getCreatureName(target):lower() == 'koshei the deathless' then
	doCreatureSay(cid, "Quickly! Use koshei's amulet on his body so he won't reborn!", TALKTYPE_ORANGE_1)
		addEvent(check, 10000, getThingPos(target))
	end
	return true
end

Creature not found on console, is it checking the player?
 
Nooo, when you use the amulet it's supposed to transform his corpse to another ID. That way it prevents respawning.
8269 = corpse ID after you use the amulet on it
8271 = normal corpse ID (for Koshei the Deathless.xml)
8272 = moveable corpse ID that it gets if you don't use an amulet on it
So yeah, add something like this in your Koshei's ancient amulet script:
Lua:
doTransformItem(itemEx.uid, 8269)
doDecayItem(itemEx.uid)
 
Back
Top