• 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] Feet colour tp.

brendan2

Sensation black
Joined
Feb 19, 2009
Messages
507
Reaction score
1
Ok so Im trying to figure out if this is possible and if someone can make me a script that does this.
Im very bad at scriptin but maby i can give you idea on what i mean


Use lever and
If feet = red Tp created x,y,z
If feet = blue red tp go's away and blue tp created x,yz
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	bluePosition = {x = xxx, y = yyy, z = z}
	redPosition = {x = xxx, y = yyy, z = z}

	if getCreatureOutfit(cid).lookFeet == BLUE then
		t = bluePosition
	elseif getCreatureOutfit(cid).lookFeet == RED then
		t = redPosition
	end
	
	doTeleportThing(cid, t)
	return 1
end

Change BLUE and RED for their respective values.
 
Thats close but i dont want to be tped i want to create a tp to the location you are at.

Like pull switch if red create portal xwz and portal makes you go to xyz
and if blue pulls it red portal go's away and blue portal is created.

Hope u understand what i mean
 
Ok Heres basicly what i want. Adding this

PHP:
        if getCreatureOutfit(cid).lookFeet == 3 then
                t = bluePosition
        elseif getCreatureOutfit(cid).lookFeet == 95 then
                t = redPosition


To this


PHP:
local config =
{
    newPos = {x=100, y=100, z=7}, -- New player position
    teleportPos = {x=100, y=100, z=7}, -- Teleport position
    LeverPos = {x=100, y=100, z=7}, -- Lever position
    timeToRemove = 10 -- Seconds
}
function onUse(cid, item, fromPos, item2, toPos)
local teleport = getTileItemById(config.teleportPos, 1387)
local playerPos = getCreaturePosition(cid)
    if item.itemid == 1945 then
        doCreateTeleport(1387, config.newPos, config.teleportPos)
        doSendMagicEffect(config.teleportPos, CONST_ME_TELEPORT)
        doSendMagicEffect(playerPos, CONST_ME_GIFT_WRAPS)
        doCreatureSay(cid, "The teleport has been created!", TALKTYPE_ORANGE_1)
        addEvent(doRemoveTeleport, config.timeToRemove * 1000)
    elseif item.itemid == 1946 then
        doPlayerSendCancel(cid, "The teleport has already been created.")
    return TRUE
    end
end

function doRemoveTeleport()
local teleport = getTileItemById(config.teleportPos, 1387)
local Lever = getTileItemById(config.LeverPos, 1946)
    if teleport.uid > 0 then
        doRemoveItem(teleport.uid)
        doSendMagicEffect(config.teleportPos, CONST_ME_POFF)
        doTransformItem(Lever.uid, 1945)
    end
end

So basicly Feet= red create teleport at x location and if you go into it, it teleports you to x location
 
I'm sorry. I did not read your post correctly. Here you go;

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	bluePortalPosition = {x = xxx, y = yyy, z = z}-- Where blue tp will appear
	redPortalPosition = {x = xxx, y = yyy, z = z} -- Where red tp will appear
	blueDestination = {x = xxx, y = yyy, z = z} -- Where blue tp will tp
	redDestination = {x = xxx, y = yyy, z = z} -- Where red tp will tp

	if getCreatureOutfit(cid).lookFeet == BLUE then
		t = bluePortalPosition
		s = redPortalPosition
		r = redDestination
	elseif getCreatureOutfit(cid).lookFeet == RED then
		t = redPortalPosition
		s = bluePortalPosition
		r = redDestination
	end
	
	if getThingFromPos(s).itemid == 1387 then
		doRemoveItem(getThingFromPos(s))
	end

	doCreateTeleport(1387, r, t)
	return 1
end
 
The script both red and blue feet can have tp. I want just 1 feet colour.
Like red pulls lever blue pull lever theres 2 tps now. i want 1 to go away depending on what colour feet pulled it so red pulls blue go's away.
 
Try this, i don't have tested
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local pos = 
{
	[3] = {tpPos = {x = 100, y = 100, z = 7}, toPos = {x = 100, y = 100, z = 7}},
	[95] = {tpPos = {x = 100, y = 100, z = 7}, toPos = {x = 100, y = 100, z = 7}}
}

	if(pos[getCreatureOutfit(cid).feet]) then
		local t = pos[getCreatureOutfit(cid).feet]
		doCreateTeleport(1387, t.tpPos, t.toPos)
	end
	return true
end
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	bluePortalPosition = {x = xxx, y = yyy, z = z, stackpos = 1}-- Where blue tp will appear
	redPortalPosition = {x = xxx, y = yyy, z = z, stackpos = 1} -- Where red tp will appear
	blueDestination = {x = xxx, y = yyy, z = z} -- Where blue tp will tp
	redDestination = {x = xxx, y = yyy, z = z} -- Where red tp will tp

	if getCreatureOutfit(cid).lookFeet == BLUE then
		t = bluePortalPosition
		s = redPortalPosition
		r = redDestination
	elseif getCreatureOutfit(cid).lookFeet == RED then
		t = redPortalPosition
		s = bluePortalPosition
		r = redDestination
	end

	for i=1,252 do
	s.stackpos = i
		if getThingFromPos(s).itemid == 1387 then
			doRemoveItem(getThingFromPos(s))
		end
	end

	doCreateTeleport(1387, r, t)
	return 1
end

Uhm, from what I understand, this is what it'll do:
If you've got red feet, it'll make a portal on redPortalPosition, which leads to redPortalDestination, and then it'll remove the portal on bluePortalPosition, right?
 
My version
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local data =
{
	redTeleportPosition = {x = 100, y = 100, z = 100},
	redTeleportToPosition = {x = 100, y = 100, z = 100},
	blueTeleportPosition = {x = 100, y = 100, z = 100},
	blueTeleportToPosition = {x = 100, y = 100, z = 100}
}

local blue, red = 95, 3
local pos = {nil, nil}

	if(getCreatureOutfit(cid).feet == blue) then
		for i = 1, 252 do
			data.redTeleportPosition.stackpos = i
			if(getTileThingByPos(data.redTeleportPosition).itemid == 1387) then
				doRemoveItem(getTileThingByPos(data.redTeleportPosition).uid)
				doSendMagicEffect(data.redTeleportPosition, CONST_ME_POFF)
			end
		end
		pos[1] = data.blueTeleportPosition
		pos[2] = data.blueTeleportToPosition
	elseif(getCreatureOutfit(cid).feet == red) then
		for i = 1, 252 do
			data.blueTeleportPosition.stackpos = i
			if(getTileThingByPos(data.blueTeleportPosition).itemid == 1387) then
				doRemoveItem(getTileThingByPos(data.blueTeleportPosition).uid)
				doSendMagicEffect(data.blueTeleportPosition, CONST_ME_POFF)
			end
		end
		pos[1] = data.redTeleportPosition
		pos[2] = data.redteleportToPosition
	end
	if(not doCreateTeleport(1387, pos[1], pos[2])) then
		local t = nil
		if(pos[1] ~= nil or pos[2] ~= nil) then
			t = "[Warning]>> Teleport can't be created in (x : " .. pos[1].x .. ", y : " .. pos[1].y .. ", z = " .. pos[1].z .. "), destination (x : " .. pos[2].x .. ", y : " .. pos[2].y .. ", z : " .. pos[2].z .. ")!"
		else
			t = "[Warning]>> Teleport can't be created, first position or second position is a nil value."
		end
		print(t)
	end
	return true
end
 
Santy it errors
[20/12/2009 21:55:06] [Error - Action Interface]
[20/12/2009 21:55:06] data/actions/scripts/cityswitch.lua:onUse
[20/12/2009 21:55:06] Description:
[20/12/2009 21:55:06] (luaDoRemoveItem) Item not found

Its pretty simple of what im trying to say.
person1 uses switch portal over to 1.
person2 uses switch oh no person1 portal dissapears and person2 portal is created
 
Oops. My bad.

LUA:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
        bluePortalPosition = {x = xxx, y = yyy, z = z, stackpos = 1}-- Where blue tp will appear
        redPortalPosition = {x = xxx, y = yyy, z = z, stackpos = 1} -- Where red tp will appear
        blueDestination = {x = xxx, y = yyy, z = z} -- Where blue tp will tp
        redDestination = {x = xxx, y = yyy, z = z} -- Where red tp will tp

        if getCreatureOutfit(cid).lookFeet == BLUE then
                t = bluePortalPosition
                s = redPortalPosition
                r = redDestination
        elseif getCreatureOutfit(cid).lookFeet == RED then
                t = redPortalPosition
                s = bluePortalPosition
                r = redDestination
        end

        for i=1,252 do
        s.stackpos = i
                if getThingFromPos(s).itemid == 1387 then
                        doRemoveItem(getThingFromPos(s).uid)
                end
        end

        doCreateTeleport(1387, r, t)
        return 1
end

That should work
 
Can u make this for 4 feet colors
like red blue green black?
Cause i have 4 feet color class's
also someone can pull switch and have like 100 portals on blue and if red pulls blue still has but now only has 99
and both have portals
 
Last edited:
Oops. ;3

Would you want the last portal to be remoed, or that you can't pull it again if there is already one on your spot?
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	colours = {3, 10, 98, 114} -- Edit~

	destinations = {
		[colours[1]] = {x = 1020, y = 1035, z = 7, stackpos = 1},
		[colours[2]] = {x = 1021, y = 1035, z = 7, stackpos = 1},
		[colours[3]] = {x = 1019, y = 1035, z = 7, stackpos = 1},
		[colours[4]] = {x = 1022, y = 1035, z = 7, stackpos = 1}
	}
	
	positions = {
		[colours[1]] = {x = 1020, y = 1036, z = 7},
		[colours[2]] = {x = 1021, y = 1036, z = 7},
		[colours[3]] = {x = 1019, y = 1036, z = 7},
		[colours[4]] = {x = 1022, y = 1036, z = 7}
	}
	
	zc = 0
	
	for b=1, #colours do
		if getCreatureOutfit(cid).lookFeet == colours[b] then
			zc = 1
			t = destinations[colours[b]]
			r = positions[colours[b]]
		end
	end

	if zc == 1 then
		
		for i=1,252 do
		superpos = r
		superpos.stackpos = i
			if getThingFromPos(superpos).itemid == 1387 then
				doPlayerSendCancel(cid, "Your race has already created a portal.")
			end
		end
		
		for i=1,252 do
			for c, a in pairs(positions) do
				sas = a
				sas.stackpos = i
				if getThingFromPos(sas).itemid == 1387 then
					doRemoveItem(getThingFromPos(sas).uid)
				end
			end
		end

		doCreateTeleport(1387, t, r)
	end
	return 1
end

Just specify the colors at the top. Don't change ANYTHING el-- oh, and the positions and destinations. Don't change anything other than that.
 
Back
Top