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

Action City gates [for ex. yalahar]

PhoOwned

^_^
Joined
Nov 11, 2010
Messages
375
Reaction score
66
You can add 1 or more switches to add/remove gates. Switches must have ActionID (map editor) same as actionid in actions.xml and UniqueID (map editor) like in script config (for ex. 11536).
Parameter fromPos must have z and stackpos (for most of gate items it's 1) parameters.

Script teleports players that are already in gate to position/line [if you define only x or y] from config.

89144299.jpg

You can configure more gates in one script. Just copy line with config and change UniqueID (ex. 11536).
Lua:
local gates = {}
gates[11536] = {fromPos = {x=631,y=667,z=5,stackpos=1}, toPos = {x=634,y=668,z=5}, tp_x = nil, tp_y = 669, itemid = 9485}

function onUse(cid, item)
	local gate = gates[item.uid]
	if(gate) then
		local gateTileItem = getThingFromPos(gate.fromPos).itemid
		if(gateTileItem == gate.itemid) then
			for x = gate.fromPos.x, gate.toPos.x do
				for y = gate.fromPos.y, gate.toPos.y do
					local gateItemUID = getTileItemById({x=x,y=y,z=gate.fromPos.z}, gate.itemid).uid
					if(gateItemUID > 0) then
						doRemoveItem(gateItemUID)
					end
				end
			end
		else
			for x = gate.fromPos.x, gate.toPos.x do
				for y = gate.fromPos.y, gate.toPos.y do
					local gateCreature = getTopCreature({x=x,y=y,z=gate.fromPos.z}).uid
					if(gateCreature > 0) then
						local creaturePos = getThingPosition(gateCreature)
						if(gate.tp_x) then
							creaturePos.x = gate.tp_x
						end
						if(gate.tp_y) then
							creaturePos.y = gate.tp_y
						end
						doTeleportThing(gateCreature, {x=creaturePos.x, y=creaturePos.y, z=creaturePos.z}, true)
					end
					doTileAddItemEx({x=x,y=y,z=gate.fromPos.z}, doCreateItemEx(gate.itemid))
				end
			end
		end
	end
	return true
end
 
Back
Top