Elevator System
This is an elevator system developed by Colex, there in the versions of OTServ when he was 7x.
I decided to take the script and give it a reorganized and upgrade to 8.2+
I have not tested the script that I'm no server here at the moment, but who want to test there and post the result here is the will.
This script is divided into 2 parts so come.
First part:
Goto in folder data/actions/scripts and create a file called elevatorSystem.lua
Paste the code below into it and save.
PHP:
--[[
Script by: Colex
Part: 1/2
Script Name: Elevator System
Modified by: Tryller/Shynzo
]]--
local STORAGE = 5080
local MSGTYPE = MESSAGE_INFO_DESCR -- It's green text
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (getPlayerStorageValue(cid, STORAGE) == -1) then
doPlayerSendTextMessage(cid, MSGTYPE, "1st floor".)
setPlayerStorageValue(cid, STORAGE,1)
elseif (getPlayerStorageValue(cid, STORAGE) == 1) then
doPlayerSendTextMessage(cid, MSGTYPE, "2nd floor".)
setPlayerStorageValue(cid, STORAGE,2)
elseif (getPlayerStorageValue(cid, STORAGE) == 2) then
doPlayerSendTextMessage(cid, MSGTYPE, "3rd floor".)
setPlayerStorageValue(cid, STORAGE,-1)
end
return 1
end
Second part:
Goto folder data/actions/scripts and create a new file called elevatorSystem2.lua
Paste the code below into it and save.
PHP:
--[[
Script by: Colex
Part: 2/2
Script Name: Elevator System
Modified by: Tryller/Shynzo
]]--
local STORAGE = 5080
function onUse(cid, item, fromPosition, itemEx, toPosition)
local floor1 = {x=512, y=509, z=7}
local floor2 = {x=512, y=509, z=6}
local floor3 = {x=512, y=509, z=5}
local player1pos = getPlayerPosition(cid)
local player1 = getThingfromPos(player1pos)
if player1.itemid == cid and (getPlayerStorageValue(cid, STORAGE) == 1) then
doTeleportThing(player1.uid,floor1)
doSendMagicEffect(fromPosition, CONST_ME_POFF)
elseif player1.itemid == cid and (getPlayerStorageValue(cid, STORAGE) == 2) then
doTeleportThing(player1.uid,floor2)
doSendMagicEffect(fromPosition, CONST_ME_POFF)
elseif player1.itemid == cid and (getPlayerStorageValue(cid, STORAGE) == -1) then
doTeleportThing(player1.uid,floor3)
doSendMagicEffect(fromPosition, CONST_ME_POFF)
end
return 1
end
Now go data/actions/actions.xml and add this tags:
To TFS 0.3
PHP:
<!-- Elevator System by Colex, Modified by Tryller/Shynzo -->
<action uniqueid="1945" event="script" value="others/elevatorSystem2.lua"/>
<action uniqueid="1946" event="script" value="others/elevatorSystem2.lua"/>
<action uniqueid="1947" event="script" value="others/elevatorSystem2.lua"/>
<action uniqueid="1948" event="script" value="others/elevatorSystem.lua"/>
<action uniqueid="1949" event="script" value="others/elevatorSystem.lua"/>
<action uniqueid="1950" event="script" value="others/elevatorSystem.lua"/>
To TFS 0.2
PHP:
<!-- Elevator System by Colex, Modified by Tryller/Shynzo -->
<action uniqueid="1945" script="elevatorSystem2.lua" />
<action uniqueid="1946" script="elevatorSystem2.lua" />
<action uniqueid="1947" script="elevatorSystem2.lua" />
<action uniqueid="1948" script="elevatorSystem.lua" />
<action uniqueid="1949" script="elevatorSystem.lua" />
<action uniqueid="1950" script="elevator.Systemlua" />
explaining
1945 | 1946 | 1947 - these are the uniqueids of "panels" that are used to choose the floor where it goes (must have one on each floor)
1948 | 1949 | 1950 - these are the unique id of "levers" (may be another item) that you use after you choose the floor panel, (you will choose to walk on the panel)
Look the ScreenSoot SS to better understand
red square - this here is the "panel" that will be used to choose the floor (you can use another item)
blue square - this lever is where you use the following to choose the floor in the "panel" (You can also use another item)
Crédits:
Colex
Tryller/Shynzo
like the script? I helped you? give me reputation