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

Yalahar mechanism actions

Goo Goo

Member
Joined
Apr 20, 2010
Messages
42
Reaction score
10
I made this last night, its my first big script. Hope someone finds it useful
Its for all the mechanisms in yalahar u just need to change the coords for ur map
Also u may need to check your Unique ids so not to repeat them.

Tested on:
NaxedOT 4.5 which from my doc/functions file is tfs 0.3.5

in data/actions/scripts/mechanism1.lua

Code:
function onUse(cid, item, frompos, item2, topos)
aceso = getPlayerAccess(cid)
msg = "You used the mechanism"
msgN = "sorry not possible"
posplayer = getPlayerPosition(cid)
mech1 = {x=2708, y=1015, z=7}  ----change these to your map coords
mech2 = {x=2701, y=1015, z=7}
mech3 = {x=2657, y=1098, z=5}
mech4 = {x=2662, y=1098, z=5}
mech5 = {x=2672, y=1059, z=5}
mech6 = {x=2672, y=1062, z=5}
mech7 = {x=2704, y=1039, z=5}
mech8 = {x=2704, y=1043, z=5}
mech9 = {x=2802, y=1100, z=5}
mech10 = {x=2797, y=1100, z=5}
mech11 = {x=2785, y=1149, z=5}
mech12 = {x=2782, y=1146, z=5}
mech13 = {x=2761, y=1167, z=5}
mech14 = {x=2761, y=1164, z=5}   ----change these to your map coords


	--Mechanism 1
	if item.uid == 7001 then

	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech1)
	doSendMagicEffect(mech1,10)
		
	elseif item.uid == 7002 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech2)
	doSendMagicEffect(mech2,10)
		
	elseif item.uid == 7003 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech3)
	doSendMagicEffect(mech3,10)
	
	elseif item.uid == 7004 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech4)
	doSendMagicEffect(mech4,10)
	
	elseif item.uid == 7005 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech5)
	doSendMagicEffect(mech5,10)
	
	elseif item.uid == 7006 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech6)
	doSendMagicEffect(mech6,10)
	
	elseif item.uid == 7007 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech7)
	doSendMagicEffect(mech7,10)
	
	elseif item.uid == 7008 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech8)
	doSendMagicEffect(mech8,10)
	
	elseif item.uid == 7009 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech9)
	doSendMagicEffect(mech9,10)
	
	elseif item.uid == 7010 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech10)
	doSendMagicEffect(mech10,10)
	
	elseif item.uid == 7011 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech11)
	doSendMagicEffect(mech11,10)
	
	elseif item.uid == 7012 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech12)
	doSendMagicEffect(mech12,10)
	
	elseif item.uid == 7013 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech13)
	doSendMagicEffect(mech13,10)
	
	elseif item.uid == 7014 then
	doPlayerSendTextMessage(cid, 22, msg)
	getThingfromPos(posplayer)
	doSendMagicEffect(posplayer,2)
	doTeleportThing(cid,mech14)
	doSendMagicEffect(mech14,10)
	
	else 
	doPlayerSendTextMessage(cid, 22, msgN)
	end
	return 1
	end

data/actions/actions.xml

Code:
<action uniqueid="7001-7014" script="mechanism1.lua"/>

Hope you enjoy.
 
have an error in last part

else
doPlayerSendTextMessage(cid, 22, msgN)
end
return 1
end

But nice script
;)
 
Lua:
local t = {
	[7001] = {x=2708, y=1015, z=7},
	[7002] = {x=2701, y=1015, z=7},
	[7003] = {x=2657, y=1098, z=5},
	[7004] = {x=2662, y=1098, z=5},
	[7005] = {x=2672, y=1059, z=5},
	[7006] = {x=2672, y=1062, z=5},
	[7007] = {x=2704, y=1039, z=5},
	[7008] = {x=2704, y=1043, z=5},
	[7009] = {x=2802, y=1100, z=5},
	[7010] = {x=2797, y=1100, z=5},
	[7011] = {x=2785, y=1149, z=5},
	[7012] = {x=2782, y=1146, z=5},
	[7013] = {x=2761, y=1167, z=5},
	[7014] = {x=2761, y=1164, z=5}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v = t[item.uid]
	if v then
		local tmp = getThingPos(cid)
		doTeleportThing(cid, v)
		doSendMagicEffect(tmp, CONST_ME_TELEPORT)
		doSendMagicEffect(v, CONST_ME_TELEPORT)
		return true
	end
end
 
Back
Top