• 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!

kill monster and teleport

chiro

New Member
Joined
Dec 3, 2010
Messages
13
Reaction score
0
Hello guys i need help with a kill monster and when a player kill the monster the player is teleport to final room of the quest.

Please guys i need this.

i give to you rep+ if workin :)
 
Optimized and more clean:

Lua:
local x = {
	monster	= { -- Monster Name,	Teleport To Position
		["Monstername"] = {tp={x=1214,	y=1233,	z=11}}
	}
}
 
function onKill(cid, target, lastHit)
	local tar = x.monster[getCreatureName(target)]
	if(not isPlayer(target)) and isPlayer(cid) and tar and not(getCreatureMaster(target)) then
		doTeleportThing(cid, tar.tp)
		doSendMagicEffect(tar.tp, CONST_ME_TELEPORT)		
	end
	return true
end
data/creaturescripts/scripts/login.lua
Lua:
registerCreatureEvent(cid, "myevent")

creaturescripts.xml
Lua:
<event type="kill" name="myevent" event="script" value="myfile.lua" />

Should work:)

If not, please reply.
 
Last edited:
Hey man i test the script and dont work, i kill mi monster and dont go to the position indicated :c


PD: sorry for my inglish
 
Last edited:
careful with getCreatureMaster, it returns nil only in 0.4
Lua:
local t = {
	-- Monster Name,	Teleport To Position
	["Monstername"] = {x=1214, y=1233, z=11}
}

function onKill(cid, target, lastHit)
	if isMonster(target) and getCreatureMaster(target) == target then
		local k = t[getCreatureName(target)]
		if k then
			doTeleportThing(cid, k)
			doSendMagicEffect(k, CONST_ME_TELEPORT)		
		end
	end
	return true
end
 
Last edited:
thanks man but i am first in this and i put hand in the script and i make the script only xD look
local config = {
monster = { -- Monster Name, Teleport Position
["Cult Assassin"] = {pos={ x=1400, y=1200, z=7, 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.pos)
doSendMagicEffect(t.pos, CONST_ME_TELEPORT)
end
return TRUE
end
and this now when i kill monster i teletransportate xD hehe :3
 
Back
Top