• 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 doCreateTeleport + ActionID

Michaeel

New Member
Joined
Mar 6, 2009
Messages
272
Reaction score
1
Hey, I have script which make TP but i need edit this because i need also actionID of teleport:
Code:
local config = {

    teleportId = 1387,

    bosses = { -- Monster Name, Teleport To Position, Teleport Position

        ["Ushuriel"] = { { x=1173, y=1141, z=12 }, { x=1097, y=1214, z=12, stackpos=1 } },

        ["Annihilon"] = { { x=1244, y=1297, z=12 }, { x=1187, y=1198, z=12, stackpos=1 } },

        ["Hellgorak"] = { { x=1064, y=1308, z=13 }, { x=1192, y=1240, z=12, stackpos=1 } },

        ["Madareth"] = { { x=1045, y=1206, z=13 }, { x=1112, y=1240, z=12, stackpos=1 } },

        ["Zugurosh"] = { { x=1128, y=1151, z=12 }, { x=1149, y=1213, z=12, stackpos=1 } },

        ["Latrivan"] = { { x=1154, y=1195, z=13 }, { x=1147, y=1244, z=12, stackpos=1 } }

    }

}



local function removal(position)

    if getThingfromPos(position).itemid == config.teleportId then

        doRemoveItem(getThingfromPos(position).uid)

    end

    return TRUE

end



function onKill(cid, target, lastHit)
if lastHit == true then

    local position = getCreaturePosition(target)

    for name, pos in pairs(config.bosses) do

        if name == getCreatureName(target) then

            teleport = doCreateTeleport(config.teleportId, pos[1], pos[2])

            doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)

            addEvent(removal, config.timeToRemove * 1000, pos[2])
            doSendMagicEffect(pos[2], 10)

        end

    end
end

    return TRUE

I think i have to add action id of teleport after
Code:
Teleport Position
then add something to
Code:
teleport = doCreateTeleport(config.teleportId, pos[1], pos[2])

but how?
 
Code:
local STORAGE_LESS, STORAGE_LESSOREQUAL, STORAGE_EQUAL, STORAGE_NOTEQUAL, STORAGE_GREATEROREQUAL, STORAGE_GREATER = 1, 2, 3, 4, 5, 6

local t = {
	[
		{ -- position of teleporter
			x=920,
			y=1236,
			z=7
		}
	] = {
			15294, -- storage key
			1, -- storage value
			"set" -- action ("set"/"require")
	},

	[
		{ -- position of teleporter
			x=929,
			y=1236,
			z=7
		}
	] = {
			15294, -- storage key
			1, -- storage value
			"require", -- action ("set"/"require")
			STORAGE_EQUAL, -- StorageComparision
			{ x = 914, y = 1236, z = 7 } -- destination
	}
}
function onStepIn(cid, item, pos, fromPosition)
	if item.actionid > 30020 and item.actionid < 30100 then
		local townId = (item.actionid - 30020)
		doPlayerSetTown(cid, townId)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are the newest resident of " .. getTownName(townId) .. ".")
	else
		for _pos, sk in pairs(t) do
			if pos.x == _pos.x and pos.y == _pos.y and pos.z == _pos.z then
				if sk[3] == "set" then
					setPlayerStorageValue(cid, sk[1], sk[2])
				elseif sk[3] == "require" and sk[4] and sk[4] >= 1 and sk[4] <= 6 and type(sk[5]) == "table" then
					local c, k, v = sk[4], getPlayerStorageValue(cid, sk[1]), sk[2]
					doTeleportThing(cid, ((c == 1 and k < v) or (c == 2 and k <= v) or (c == 3 and k == v) or (c == 4 and k ~= v) or (c == 5 and k >= v) or (c == 6 and k > v)) and sk[5] or fromPosition)
				end
				return true
			end
		end
	end
end
now let's hope that I counted the tiles correctly
 
Ok but should I write something here:
tpinq78.png
?

And what have I to in place of "set" and "require"?
 
Back
Top