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

MoveEvent Useful TP script

SpO0KIe

:)
Joined
Feb 28, 2010
Messages
192
Solutions
1
Reaction score
5
Hi guys, I would like to share my second script with you. It's not that hard to make but I like it and using it for my own server. And since I have two temples in one city I found it very usefull.

I have two temples with same TP that leads to the same room, and in the room you have only one TP that says "back to where you came from". If you came from temple 1 you will be teleported back to temple 1 when you enter the "back tp" in the room. But if you came from temple 2 then you will be telported back to temple 2 when you enter the "tp back" in the room.

Im sorry for the bad explaination but I tried :D

Here is the script:

Use this script on the room tp:
Code:
local posOne = {x=[COLOR="sienna"]XXXX[/COLOR], y=[COLOR="sienna"]XXXX[/COLOR], z=[COLOR="sienna"]X[/COLOR]}
local posTwo = {x=[COLOR="darkolivegreen"]XXXX[/COLOR], y=[COLOR="darkolivegreen"]XXXX[/COLOR], z=[COLOR="darkolivegreen"]X[/COLOR]}
function onStepIn(cid, item, position, fromPosition)
        if item.itemid == 1387 and getPlayerStorageValue(60001) == 1 then
            doSendMagicEffect(getCreaturePosition(cid), 2)
            doTeleportThing(cid, posOne)
            doSendMagicEffect(getCreaturePosition(cid), 10)
            setPlayerStorageValue(60001, 0)
        else 
        if    getPlayerStorageValue(60001) == 0 and getPlayerStorageValue(60002) == 1 then
            doSendMagicEffect(getCreaturePosition(cid), 2)
            doTeleportThing(cid, posTwo)
            doSendMagicEffect(getCreaturePosition(cid), 10)
            setPlayerStorageValue(60002, 0)    
        end
        end
    return true
end

this script for temple 1:
Code:
local posOne = {x=[COLOR="sienna"]XXXX[/COLOR], y=[COLOR="sienna"]XXXX[/COLOR], z=[COLOR="sienna"]X[/COLOR]}
function onStepIn(cid, item, position, fromPosition)
		if item.itemid == 1387 then
			doSendMagicEffect(getCreaturePosition(cid), 2)
			doTeleportThing(cid, posOne)
			doSendMagicEffect(getCreaturePosition(cid), 10)
			setPlayerStorageValue(60001, 1)	
	end
	return true
end

and this script for temple 2:
Code:
local posOne = {x=[COLOR="darkolivegreen"]XXXX[/COLOR], y=[COLOR="darkolivegreen"]XXXX[/COLOR], z=[COLOR="darkolivegreen"]X[/COLOR]}
function onStepIn(cid, item, position, fromPosition)
		if item.itemid == 1387 then
			doSendMagicEffect(getCreaturePosition(cid), 2)
			doTeleportThing(cid, posOne)
			doSendMagicEffect(getCreaturePosition(cid), 10)
			setPlayerStorageValue(60002, 1)	
	end
	return true
end

add this to movements.xml
Code:
    <movevent type="StepIn" actionid="9998" event="script" value="[COLOR="royalblue"][B]room[/B][/COLOR].lua"/>
    <movevent type="StepIn" actionid="9999" event="script" value="[B][COLOR="green"]temple2[/COLOR][/B].lua"/>
    <movevent type="StepIn" actionid="10000" event="script" value="[COLOR="red"][B]temple1[/B][/COLOR].lua"/>

Tell me if you like or dislike and why?:p

The script is 100% made by me (SpO0KIe)
And if you don't understand the explaination tell me and I will try to explain better :thumbup:
 
Last edited:
hmm.. maybe i am wrong, but i think this wont function properly:
1 - what if the guy in temple one went in room but didnt went in the tp in room so << global will still be 1>> and if player of temple 2 have made the same thing . So now we will have <<both globales = 1>> so this wont funtion well. Right?

2 - what if that guy didnt step at all on that tile that change storage?
 
hmm.. maybe i am wrong, but i think this wont function properly:
1 - what if the guy in temple one went in room but didnt went in the tp in room so << global will still be 1>> and if player of temple 2 have made the same thing . So now we will have <<both globales = 1>> so this wont funtion well. Right?

2 - what if that guy didnt step at all on that tile that change storage?

I can answer your 2nd question but the 1st one, I seriously dont know exactly how you mean...

Answer to 2nd: Your storage will change when you step into the teleport, it's not a tile you step on.
As you can see I have used:
if item.itemid == 1387
ItemID 1387 is for a teleport. Which means you have to step in to the teleport and not a tile.

Correct me if I missunderstood your question :D
 
okay now for the second one ??

As i said , you made if :
1- player of <<temple 1>>get in room then << global 1 == 1 >> (what if that player didnt enter the tp in the room that reset the globalvalue)

# at the same time #


2- player of << temple 2 >> get in room then << global 2 == 1 >>

Now we have the 2 globals == 1

if getGlobalStorageValue(60001) == 0 and getGlobalStorageValue(60002) == 1 then
so it will not function well. Correct me if i am wrong :p
 
Ohh now I get it.
But on my server there is only one way to exit the "room" and that's by going through the TP that removes your gobalstorage. :D
 
Last edited:
as i said what if that player didnt went out of the room, what if he stayed there during the entrance of the other guy of temple 1, just use simple storage values
 
as i said what if that player didnt went out of the room, what if he stayed there during the entrance of the other guy of temple 1, just use simple storage values

Omg, I just realized that I didn't pay attention, the whole time it was on GlobalStorageValue when it should be PlayerStorageValue. I am sorry, I will change the script :D
 
Still not fixed look at room tp script , you still check for global values .......
 
remove this from teh second if in room tp , and it will be fixed
Code:
 getGlobalStorageValue(60001) == 0
 
Back
Top