I actual did.
Script is commented.
--script by smallg Modified by Myke Price
-- range to be able to use teleporter
local use_range = 120
--key to use teleporter
local input_key = "e"
--entity number of real pad used to port to
--put name of this entity inside the 'ifused' field of teleporter
local port_pad = 2
--delay until port
--rx = 1 is 1 second / rx = 10 is 10 seconds / etc
local rx = 3
--number of destinations
--*you must set names and target entity numbers for these in the init(e) part*
local max_dest = 3
----
local dest_number = {}
local levelname = {}
local state = {}
local pressed = 0
local delay = 0
local x = 50
local y = 10
local dest = 1
local rx_init = rx
function teleport_other_maps_init(e)
--input entity number of area's here
--***not really needed
dest_number[1] = 4
dest_number[2] = 5
dest_number[3] = 6
--dest_number[4] = 16
--dest_number[5] = 17
--dest_number[6] = 18
--dest_number[7] = 19
--dest_number[8] = 21
--dest_number[9] = 22
--name area's here ** Enter the name of you jump to levels
levelname[1] = "telleval1"
levelname[2] = "tellevel2"
levelname[3] = "tellevel3"
--destination[4] = "level4"
--destination[5] = "level5"
--destination[6] = "level6"
--destination[7] = "level7"
--destination[8] = "level8"
--destination[9] = "level9"
state[e] = "init"
end --init
function teleport_other_maps_main(e)
if state[e] == "init" then
if GetPlayerDistance(e) <= use_range then
PromptLocal(e,"Press " .. input_key .. " to power on teleporter")
if g_InKey == input_key and pressed == 0 then
state[e] = "select dest"
pressed = 1
rx = rx_init
FreezePlayer()
CollisionOff(port_pad)
SetPosition(port_pad,g_PlayerPosX,g_PlayerPosY,g_PlayerPosZ)
y = 10
end
end
elseif state[e] == "select dest" then
for a = 1, max_dest do
--if you have bigger destination names then make the panel here bigger
--format = Panel(x1,y1,x2,y2)
Panel(35,y-5,65,y+4.5)
TextCenterOnXColor(x,y,3,a .. " = " .. levelname[a],205,5,205)
y = y + 10
if g_Scancode == a+1 and pressed == 0 then
pressed = 1
dest = a
delay = GetTimer(e)
PromptDuration("Porting in " .. rx .. " : Destination = " .. levelname[dest],1000)
state[e] = "porting"
LoopSound(e,0)
end
end
y= 10
elseif state[e] == "porting" then
if rx > -1 then
if GetTimer(e) > delay then
PromptDuration("Porting in " .. rx .. " : Destination = " .. levelname[dest],1000)
delay = GetTimer(e) + 1000
rx = rx - 1
end
else
StopSound(e,0)
CollisionOff(dest_number[dest])
-- Remmed out by Myke
--SetPosition(port_pad,g_Entity[dest_number[dest]]['x'],g_Entity[dest_number[dest]]['y'],g_Entity[dest_number[dest]]['z'])
UnFreezePlayer()
--Remmed out by Myke to use different command.
--TransportToIfUsed(e)
JumpToLevel(levelname[dest])
--Not really needed as the screen fades to black.
--PromptDuration("You have reached " .. levelname[dest],2000)
state[e] = "init"
-- ** thinking about destroying the script hear, but then it become linear. Not optimal.
end
end --state
--reset input
if pressed == 1 and g_InKey == "" then
pressed = 0
end
end --main
function teleport_other_maps_exit(e)
end --exit
Set up maps as normal. Use an object for the winzone. Works on range as the winzone trigger.
Assign this script to those intended objects.
Now since level do not get written unless you use a winzone. I have a workaround for this for when you build the standalone.
In each map you want to use for this. Make an area that the player can not get to and set the winzones for each level you want to have a choice to go to.
This will write all the rest of the info and data when you save your standalone from then starting level.
THIS IS A MUST OR ALL THE LEVELS WILL NOT BE SAVED TO STANDALONE.
Make and save all your maps.
Open the starting level last and run a test game. This is important.
Exit test game and save the map.
Build your standalone now from this level.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit