• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Talkaction that teleports you to where you want :) My first script

Hatsune Miku

Intermediate OT User
Joined
Jan 22, 2009
Messages
370
Reaction score
139
Credits to Bogart for helping me with some errors and teaching me how to fix them :)

So this script basicly teleports you to (1000x 1000y and 7z) from (1002x 1000y 7z) you can change thoose to whatever you want :p

If you want you can change it to anything else :p
If you want you can use this script in a quest :p Make a wall people can't pass and a little square, when people stand on it they have to say your "secret" code(talkaction) to get over to the other side :p

If you want people to say "!omgnoobwall" to get teleported to other side you can do that too :p

The Lua file :p
Lua:
local pos = {x = 1002, y = 1000, z = 7}
local temple = {x = 1000, y = 1000, z = 7}
local k = getCreaturePosition(cid)
function onSay(cid, words, param)
	if (k.x == pos.x) and (k.y == pos.y) and (k.z == pos.z) then
		doTeleportThing(cid, temple)
		doPlayerSendTextMessage(cid, 21, "You have been teleported to the temple!")
		doSendMagicEffect(getPlayerPosition(cid), 31)
	end
return true
end

In talkactions.xml
XML:
<talkaction words="!omgnoobwall" event="script" value="x.lua"/>

Hope this helps someone :p Its my first script after all so no noob comments please :p

If you get any bugs please write here and I will try to fix it if I can altho I don't think you will get any :p
I am using TFS 0.3.6 distro, no bugs for me :p works fine :p
This is the distro I am using http://otland.net/f18/8-60-forgotten-server-0-3-6-crying-damson-v8-147913/

EDIT: Also if you got any suggestions for something a noob in lua can make please post :p I want to learn this as quick as possible so any suggestions is welcome :D
 
Last edited:
Lua:
if (k.x == pos.x) and (k.y == pos.y) and (k.z == pos.z) then

You can simply set that:
Lua:
if (k == pos) then
 
Oh lol thanks :D *goes to complain to Bogart :D*

- - - Updated - - -

updated first post :D
 
Good Job Bro, might be helpful.here is a advice
1-when using sendMagicEffect don't use 31 use CONST_ME_MAGIC there is much of them. they can be found in lib-constant​
2-try to make a table not only 1 place :p
thats what i can say
 
Well thanks alot :p but if I make a table it won't be exactly that place :D Maybe it will teleport me to the second or even third one. while in a quest I just wanted to get over the wall :p If you understand what I mean :p

Thanks about the sendmagiceffect :p I was lazy and just did it that way :p Might change the way I do stuff later :p
 
does this rly works? it usually returns false because stack positions don't match
Lua:
local k = getCreaturePosition(cid)
	if (k == pos) then
it'd be wiser to use:
Lua:
if doComparePositions(pos, getCreaturePosition(cid)) then
 
script worked fine until i changed it to what erexo posted.. and idk it should probably work then also :p thats what makes sense :p well I will update my first post again.. but then again... I haven't tested it after I edited :p if it happens to not work I will just turn it back to the one I made :p Cause I know that one works without any errors :p shortening a short script doesnt really matter for me :p
 
Comparing table does not work like this.
You can only check whether 2 tables are identical (the same reference):

Lua:
local x = {x = 1, y = 2, z = 3}
return x == x -- should return true

Lua:
return {x = 1, y = 2, z = 3} == {x = 1, y = 2, z = 3} -- should return false
 
The value of k is unused, you might aswell delete this line
Code:
local k = getCreaturePosition(cid)
 
The value of k is unused, you might aswell delete this line
Code:
local k = getCreaturePosition(cid)

Uhm its used :p look closer :D and if not.. just read the previous comments from others :p they are commenting on how to "improve" the script exactly at that part :p

Comparing table does not work like this.
You can only check whether 2 tables are identical (the same reference):

Lua:
local x = {x = 1, y = 2, z = 3}
return x == x -- should return true

Lua:
return {x = 1, y = 2, z = 3} == {x = 1, y = 2, z = 3} -- should return false

Lol I changed it to the way I made the script :p you guys just made it more complicated to understand :D 3 guys telling me 3 different things :D lol xD

Mine works so I don't care about how it looks :p
 
Lol well now that you changed it back it is, but before it wasnt being used
 
Back
Top