• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua function onKill or onDeath (idk!) [rep++]

picachu

Member
Joined
Dec 2, 2007
Messages
970
Reaction score
11
hi guys
i'm wondering if someone can do this script:

when I kill Koshei The Deathless, i need the player gets teleported to:
coords x, y, z...

I have one script here, but it teleport the dead corpse of monster, instead of the player
look my script:

Code:
local t = {
	teleportTo = {x=33264,y=32446,z=12},
	monsterName = 'koshei the deathless'
}
function onKill(cid, target, flags)
	if getCreatureName(target):lower() == t.monsterName:lower() then
		doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
		doTeleportThing(cid, t.teleportTo)
		doSendMagicEffect(t.teleportTo, CONST_ME_TELEPORT)
	end
	return true
end


How to fix it?
thx
rep++
 
Not tested, but try this

LUA:
local config = {
monster = { -- Monster Name,  Teleport Position
    ["Koshei the Deathless"] = {pos={ x=1954, y=1585, z=5, stackpos=2 }},
}

function onKill(cid, target, lastHit)
	if(config.monster[getCreatureName(target)]) then
		local t = config.monster[getCreatureName(target)]
		local position = t.pos
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
				doTeleportThing(cid, t.teleportTo)
					doSendMagicEffect(t.teleportTo, CONST_ME_TELEPORT)
		end
	return TRUE
end
 
Back
Top