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

A new form of teleport..

Synergy

New Member
Joined
Nov 24, 2011
Messages
334
Reaction score
0
Hello!



I'm using another ID for teleport, its a big red type of teleport..


My question is, i will use this teleport in every temple to put your new temple position..


How do i make it a teleport, and to give you temple pos?

The id of the NEW teleport is:
 
Movement script

onStepIn
doPlayerSetTown(cid, townid)
doTeleportThing(cid, newpos, <optional> pushmove)
 
Are you going to use this portal for things other than temples?
If so, then you'll have a lot of editing to do.
Else, you could just get the actionID and put them in a table.
 
Are you going to use this portal for things other than temples?
If so, then you'll have a lot of editing to do.
Else, you could just get the actionID and put them in a table.



Only for temples, and ATM i got only 1 temple, its a custom map

So I'll give you the information:


Portal Item ID: 13934
POS of Portal: [x: 987 y: 1010 z: 8]
Where the Portal will take you (Temple pos): [X: 995 | Y: 1010 | Z: 7].


That's all, can you make it? :D
 
Thread unrelated: I hope nobody makes this for you
Thread related: if you plan to continue making such out of your reach arrangements, you should consider either becoming more acknowledged in said fields or hiring/cooperating with somebody who is
 
Thread unrelated: I hope nobody makes this for you
Thread related: if you plan to continue making such out of your reach arrangements, you should consider either becoming more acknowledged in said fields or hiring/cooperating with somebody who is

You mean that I can't ask for help on this forum?
 
of course you can, but a teleporter is a 3 line script, if you can't do it then you shouldnt even be thinking about hosting a server and should start by reading and understanding Lua scripts

- - - Updated - - -

Moved to Requests
 
I was a scripter.. "noobey" on otfans, I had one of the first servers back in 7.1 when I came back (now) I didn't remember ANYTHING so I'm practicing again, in the meantime I'm asking for help which I thought was possible but since some "attention wh*res" had to act all intelligent and show off his "perfect" knowledge of the english language I lost hope for this forum.



PS. movements, etc didn't even exist back in the days so give me time :)
 
LUA:
local Places = {
    [{987, 1010, 8}] = {995, 1010, 7}
}


function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local _Pos = getThingPosition(item.uid)
    for i =1, #Places do
        if Places[i] == {_Pos.x, _Pos.y, _Pos.z} then
            doTeleportThing(cid, Place[i][1])
        end
    end
return true
end

Hit up some tutorials, it will refresh you.
 
LUA:
local Places = {
    [{987, 1010, 8}] = {995, 1010, 7}
}


function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local _Pos = getThingPosition(item.uid)
    for i =1, #Places do
        if Places[i] == {_Pos.x, _Pos.y, _Pos.z} then
            doTeleportThing(cid, Place[i][1])
        end
    end
return true
end

Hit up some tutorials, it will refresh you.


Thank you so much for not being ignorant like some of the people here in OTLand
+ Thanks for the script, it worked
 
also, that script is dynamic, you can reuse it by adding the positions in the table, it works like this.
Code:
[{Position of the Portal}] = {Position of Destination}

Also, the other guy was not being ignorant, you were giving yourself off as a newbie and he retaliated.

Here in OTLand we endorse learning, and teaching to those who really are looking for it and we abhor Spoonfeeding.

I myself was hanging around before giving you the script in order to see where this all leaded to.

So forgive us we gave off as arrogant or ignorant.
 
@Shinmaru
Code:
if Places[i] == {_Pos.x, _Pos.y, _Pos.z} then
This check is kinda weird, you can't compare tables, use something like doComparePositions instead, or do it yourself
Code:
Places[i].x == _Pos.x
etc.
 
@Shinmaru
Code:
if Places[i] == {_Pos.x, _Pos.y, _Pos.z} then
This check is kinda weird, you can't compare tables, use something like doComparePositions instead, or do it yourself
Code:
Places[i].x == _Pos.x
etc.

if what you are saying is true, then how is it that it worked for him?
I don't see how it cannot compare arrays.
 
Lua: demo
Try with all:
Code:
local p = {x = 100, y = 200, z = 7}
local s = {100, 200, 7}

if p == s then print("kef") end
Code:
local p = {x = 100, y = 200, z = 7}
local s = {x = 100, y = 200, z = 7}

if p == s then print("kef") end
Code:
local x = {100,200,300}
if x == {100,200,300} then print("haha") else print("fail") end
And I don't know how it worked for him, he's a dumpster, anything works out for dumpsters.
 
LUA:
local Places = {
    [{987, 1010, 8}] = {995, 1010, 7}
}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local _Pos = {getThingPosition(item.uid).x, getThingPosition(item.uid).y, getThingPosition(item.uid).z}
local fP = {false, false, false}
    for i, k in pairs(Places) do
        for l = 1, 3 do
            if fP[l] == false then
                if i[l] == _Pos[l] then
                    fP[l] = true
                end
            end
        end
        if fP[1] == true and fP[2] == true and fP[3] == true then
            doTeleportThing(cid, k)
        end
    end
return true
end
fixed.
 
Award for the weirdest comparisons in the world

r09Ey.jpg


Instead of checking if it is the same you first insert the result of that into a table, and then check if true == true which is true anyway.
Took me 5 min to understand the loop *brainfuck*
Just do:
if tmpPos.x == places[bla].x and tmpPos.y == place...y and tmpPos.z == place...z then

Btw. does doTeleportThing work with {1, 1, 1}? Doesn't it need {x = 1, y = 1, z= 1}?

- - - Updated - - -

Took the time and rewrote. Would be easier with action ids though.
LUA:
local places = {
	[{x = 987, y = 1010, z = 8}] = {toPos = {x = 995,  y = 1010, z = 7}, townID = 1}
}
 
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	local tmpPos = getThingPos(cid)
	for pos, set in pairs(places) do
		if tmpPos.x == pos.x and tmpPos.y == pos.y and tmpPos.z == pos.z then
			doTeleportThing(cid, set.toPos)
			doPlayerSetTown(cid, set.townID)
			doSendMagicEffect(set.toPos, CONST_ME_MAGIC_BLUE)
			return true
		end
    end
	return true
end
 
I'm just a bit cryptic with my scripts, I'm glad that it brainfucked someone that actually knows about Lua, I can only imagine what a person that does not know would feel like facing my scripts.
 
Back
Top