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

Request cutom teleporter help

Frillinde

Founder: Another Realm
Joined
Jan 16, 2012
Messages
148
Reaction score
3
Location
his computer
Im looking for help with this teleporter.

Player puts item X on location X , then stands at location W and pulls lever,item disappears and player(location W only) is KILLED(yup, guy who pulls lever dies).
All people in room Y are teleported to room Z and get sent a message "A sacrifice has been made."
Thanks for any help with this.
:)
 
166agwl.png


LUA:
local from, to = {x = 854, y = 962, z = 6}, {x = 860, y = 968, z = 6} -- ROOM POSITIONS (top left corner / bottom right corner)
local newPosition = {x = 865, y = 964, z = 6} -- WHERE PLAYERS ARE TAKEN

local itemPlace = {x = 868, y = 964, z = 6, stackpos = 255} -- WHERE THE ITEM GOES
local itemId = 2646 -- THE ITEM ID NUMBER

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1945) then
		local id = getTileItemById(itemPlace, itemId)
		if((id.type > 0) or (id.uid > 0)) then
			doRemoveItem(id.uid, 1)
		else
			return doPlayerSendCancel(cid, "Sorry, not possible.")
		end
		
		doCreatureAddHealth(cid, - getCreatureHealth(cid))
		for _, pid in ipairs(getPlayersOnline()) do
			if(isInRange(getThingPos(pid), from, to)) then
				doSendMagicEffect(getThingPos(pid), CONST_ME_POFF)
				doTeleportThing(pid, newPosition, false)
				doSendMagicEffect(getThingPos(pid), CONST_ME_ENERGYAREA)
				doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "A sacrifice has been made!")
			end
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
If you would like to see it operational, contact me privately. I can demonstrate how it works on my test server.
 
Last edited:
Nice....
only 2 changes if I may.....;p
player should be level 100+ for sacrifice, level 99 or below would not teleport anyone but would still kill the player and send message "The sacrifice was not enough."
players should spawn in a random area when teleported

Im trying to learn the code,I guess if getcharacterlevel < 100 then do send message....not enough would go after the damge dealt portion?I know its not written right but is that basically whatwould change for char level?
So then would adding to,from positions at the destination part allow a random location?

Thanks for helping....
:)

+rep
 
LUA:
local from, to = {x = 854, y = 962, z = 6}, {x = 860, y = 968, z = 6} -- ROOM POSITIONS (top left corner / bottom right corner)
local newPosition = {x = 865, y = 964, z = 6} -- WHERE PLAYERS ARE TAKEN
 
local itemPlace = {x = 868, y = 964, z = 6, stackpos = 255} -- WHERE THE ITEM GOES
local itemId = 2160 -- THE ITEM ID NUMBER
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1945) then
		local id = getTileItemById(itemPlace, itemId)
		if((id.type > 0) or (id.uid > 0)) then
			doRemoveItem(id.uid, 1)
			doSendMagicEffect(itemPlace, CONST_ME_POFF)
		else
			return doCreatureSay(cid, "An item is required to sacrifice yourself!", TALKTYPE_MONSTER), doSendMagicEffect(itemPlace, CONST_ME_POFF)
		end
 
		doCreatureAddHealth(cid, - getCreatureHealth(cid))
		for _, pid in ipairs(getPlayersOnline()) do
			if(isInRange(getThingPos(pid), from, to)) then
				if(getPlayerLevel(cid) < 100) then
					doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "A sacrifice has been made, but it was not enough!")
				else
					doSendMagicEffect(getThingPos(pid), CONST_ME_POFF)
					doTeleportThing(pid, newPosition, false)
					doSendMagicEffect(getThingPos(pid), CONST_ME_ENERGYAREA)
					doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "A sacrifice has been made!")
				end
			end
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Last edited:
Back
Top