• 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] Temple to Temple Script

Northnorial

Member
Joined
May 30, 2009
Messages
742
Reaction score
5
Location
Germany
Hey! :)

I'm looking for a script(talkaction) that will teleport you from one temple to another temple and back, so there can be multiple temples.
If you're in temple Nr. 1 you can teleport to temple Nr. 2 and 3, just if you're in a temple.

something like:
!t 1 -- temple of town with id 1
!t 2 -- temple of town with id 2
!t 3 -- temple of town with id 3
 
This is a very simple example script. very easy to understand as well..
Change those stuffs that's colored red.


Talkactions/talkactions.xml
Code:
<talkaction words="!town [COLOR="Red"]CITY[/COLOR]" script="town [COLOR="Red"]CITY[/COLOR].lua"/>

Talkactions/scripts/town CITY.lua
Code:
function onSay(cid, words, param)
Temple = {x=[COLOR="Red"]000[/COLOR], y=[COLOR="Red"]000[/COLOR], z=[COLOR="Red"]7[/COLOR]}
TPLEVEL = [COLOR="Red"]1[/COLOR]
if getPlayerLevel(cid) >= TPLEVEL then
		doPlayerSendTextMessage(cid,22,"You have been teleported to [COLOR="Red"]CITY[/COLOR]")
		doTeleportThing(cid,Temple)
		doSendMagicEffect(newpos,12)
		return 1
	end
end

Don't forgett to rep me! if you like the answer I gave you..
 
Last edited by a moderator:
Code:
function onSay(cid, words, param, channel)
	return doTeleportThing(cid, getTownTemplePosition(param)) and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have been teleported.")
end
 
ServerDirectory/mods/TempleTP.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="TempleTP" version="1.0" author="Slaktaren" contact="my ass" enabled="yes">
	
	local temples = {
			[1] = { posx = [COLOR="Red"]XXX[/COLOR], posy = [COLOR="Red"]YYY[/COLOR], posz = [COLOR="Red"]ZZZ[/COLOR] },
			[2] = { posx = [COLOR="Red"]XXX[/COLOR], posy = [COLOR="Red"]YYY[/COLOR], posz = [COLOR="Red"]ZZZ[/COLOR] },
			[3] = { posx = [COLOR="Red"]XXX[/COLOR], posy = [COLOR="Red"]YYY[/COLOR], posz = [COLOR="Red"]ZZZ[/COLOR] },
			[4] = { posx = [COLOR="Red"]XXX[/COLOR], posy = [COLOR="Red"]YYY[/COLOR], posz = [COLOR="Red"]ZZZ[/COLOR] },
			[5] = { posx = [COLOR="Red"]XXX[/COLOR], posy = [COLOR="Red"]YYY[/COLOR], posz = [COLOR="Red"]ZZZ[/COLOR] },
			}
	<talkaction name="Temple" words="!temple" event="script"><![CDATA[
		
		if getTilePzInfo(getPlayerPosition(cid)) then
			doTeleportThing(cid, math.random(1, #temples)
		else
			doPlayerSendCancel(cid, "You must be in a protection zone in order to teleport to other temples.")
		end
	return TRUE
	]]></talkaction>
</mod>
I couldn't figure out how to first teleport you to temple 1 and if you're in temple 1, teleport you to temple 2 and so on.. So I made it random.
You can't use it outside protection zone

I'm not sure it will work.. Someone might need to fix it :)
 
Last edited:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="TempleTP" enabled="yes">
	<config name="cfg"><![CDATA[
		validTowns = {1, 2, 3, 4, 5}
	]]></config>
	<talkaction words="!t" event="buffer"><![CDATA[
		domodlib('cfg')
		local param = tonumber(param)
		if getTileInfo(getThingPos(cid)).protection and param and isInArray(validTowns, param) then
			doTeleportThing(cid, getTownTemplePosition(param))
			doSendMagicEffect(getTownTemplePosition(param), CONST_ME_TELEPORT)
		end
		return true
	]]></talkaction>
</mod>
 
Ohhhhhh! I did read it totally wrong xD, thought he meant like "if you're in temple 1 - tp to temple 2, if you're in temple 2 - tp to temple 3 and so on

@Cyko
Would my work?
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="TempleTP" version="1.0" author="Slaktaren" contact="my ass" enabled="yes">
	
	local temples = {
			[1] = { posx = XXX, posy = YYY, posz = ZZZ }, -- temple1 position
			[2] = { posx = XXX, posy = YYY, posz = ZZZ }, -- temple2 position
			[3] = { posx = XXX, posy = YYY, posz = ZZZ }, -- temple3 position 
			[4] = { posx = XXX, posy = YYY, posz = ZZZ }, -- temple4 position
			[5] = { posx = XXX, posy = YYY, posz = ZZZ }, -- temple5 position
					}
	<talkaction name="Temple" words="!temple" event="script"><![CDATA[
		
		if getTilePzInfo(getPlayerPosition(cid)) then
			doTeleportThing(cid, math.random(1, #temples)
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
		else
			doPlayerSendCancel(cid, "You must be in a protection zone in order to teleport to other temples.")
		end
	return TRUE
	]]></talkaction>
</mod>
 
Yea if anything just use /town and add a pz check so players cant use it unless they are in pz (that might be easier but just a suggestion xD)
 
Back
Top