bonecrusher16O Lance Corporal
Messages : 35 Registration Date : 2011-07-08
| Subject: [SOLVED]Portals? 3/7/2012, 10:31 pm | |
| Is it possible to make a portal like in the map Space Endor? (you can find that map on filefront) It would be very apperciated if anyone could help. |
|
Lephenix Scout Trooper Sergeant
Messages : 833 Registration Date : 2010-05-05 Age : 29
| Subject: Re: [SOLVED]Portals? 3/7/2012, 11:00 pm | |
| Yes, there are teleporters, it is possible in 2 ways and they both work: 1st way: - Spoiler:
- Kateana wrote:
1: Open ZE, create a region that when entered you will teleport from. For tutorial purposes, I've named it 'TeleportRegion'
2: Create a new path. just place 1 node and name it something that you can remember, For tutorial purposes, I've named it 'TeleportNode'
3: Open your .lua in which you want the teleporter to work.
4: Add this piece of code inside the 'function ScriptPostLoad()' just before 'End'
- Code:
-
OnEnterRegion( function(regIn,character) MoveEntityToNode(character,"TeleportNode") end, "TeleportRegion" ) ActivateRegion("TeleportRegion") 5: Scroll down to the bottom of your Lua, and add this piece of code after the last End 9should be last thing in your script)
- Code:
-
function MoveEntityToNode(entIn,pathIn,nodeIn) if not entIn then print("Warning!: Entity not specified for move") return false elseif not pathIn then print("Warning!: Path not specified for Entity " .. entIn .. " move") return false end
local node if nodeIn then node = nodeIn else node = 0 end
local locDest = GetPathPoint(pathIn,node) local charUnit = GetCharacterUnit(entIn) if charUnit then SetEntityMatrix(charUnit,locDest) return true end return false end 6: Munge and test, If it works, have a cookie! (no chocolate ones)
If your still having trouble, heres my Lua to compare with (its a hunt lua, Only included the areas around the teleport scripts.)
- Code:
-
-- -- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved. --
-- load the gametype script ScriptCB_DoFile("setup_teams") ScriptCB_DoFile("ObjectiveTDM")
function ScriptPostLoad() EnableSPHeroRules() -- This is the actual objective setup hunt = ObjectiveTDM:New{teamATT = 1, teamDEF = 2, multiplayerScoreLimit = 100, pointsPerKillATT = 1, pointsPerKillDEF = 1, textATT = "game.modes.hunt2", textDEF = "game.modes.hunt", multiplayerRules = true, isCelebrityDeathmatch = true} hunt:Start()
AddAIGoal(1, "Deathmatch", 1000) AddAIGoal(2, "Deathmatch", 1000) OnEnterRegion( function(regIn,character) MoveEntityToNode(character,"TeleportNode") end, "TeleportRegion" ) ActivateRegion("TeleportRegion") end
--------------------------------------------------------------------------- -- FUNCTION: ScriptInit -- PURPOSE: This function is only run once -- INPUT: -- OUTPUT: -- NOTES: The name, 'ScriptInit' is a chosen convention, and each -- mission script must contain a version of this function, as -- it is called from C to start the mission. --------------------------------------------------------------------------- function ScriptInit()
ReadDataFile("dc:Load\\common.lvl") ReadDataFile("ingame.lvl") REP = 1 CIS = 2 -- These variables do not change ATT = 1 DEF = 2 SetMaxFlyHeight(30)
...................... ...................... ......................
SetSoundEffect("SpawnDisplayUnitChange", "shell_select_unit") SetSoundEffect("SpawnDisplayUnitAccept", "shell_menu_enter") SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change") SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter") SetSoundEffect("SpawnDisplayBack", "shell_menu_exit")
--OpeningSateliteShot AddCameraShot(0.872887, -0.099144, -0.474692, -0.053916, -69.674454, 40.497543, -49.157150); end
function MoveEntityToNode(entIn,pathIn,nodeIn) if not entIn then print("Warning!: Entity not specified for move") return false elseif not pathIn then print("Warning!: Path not specified for Entity " .. entIn .. " move") return false end
local node if nodeIn then node = nodeIn else node = 0 end
local locDest = GetPathPoint(pathIn,node) local charUnit = GetCharacterUnit(entIn) if charUnit then SetEntityMatrix(charUnit,locDest) return true end return false end
If you want more then 1 teleport, then add more regions and nodes (different names) and add the 1st piece of lua code in under then 2nd one with the new names.
2nd way: - Spoiler:
- [RDH]Zerted wrote:
Important Edit: I will keep updating the code at that link until it's finished. Right now everything seems to be working. Its important to note that a region has to have its type/class properties be the same as its name inorder for it to work with SetupEnterRegionTeleport()
Steps to getting it working (using an example eli map):
1) Copy the code below and paste it in a text file then rename it teleport.lua
2) Put teleport.lua into data_XXX\Common\scripts
3) Add "teleport" to the script section of data_XXX\Common\mission.req
Opened ZeroEdit: 4) Added a region: region0
5) Set the region's Type/Class Properties to region0
6) Save
7)Open data_XXX\Common\scripts\XXX\XXXg_eli.lua and add ScriptCB_DoFile("teleport") as the first line
8) Before function ScriptPostLoad's end add: - Code:
-
--A single teleport local region = GetRegionLocation( "region0" ) local destination = GetPathNodeDestination( "eli_cp4_spawn", 0 ) SetupEnterRegionTeleport( region, destination, 0, 0 ) ActivateRegion( "region0" ) 9) Save 10) Munge Common
11) Load the game
12) Run the map
13) Enter region0 and get teleported to CP4
|
|
bonecrusher16O Lance Corporal
Messages : 35 Registration Date : 2011-07-08
| Subject: Thanks 3/8/2012, 8:31 pm | |
| Thanks! This will be VERY helpful in crossing the large distances my maps tend to have. |
|
Lephenix Scout Trooper Sergeant
Messages : 833 Registration Date : 2010-05-05 Age : 29
| Subject: Re: [SOLVED]Portals? 3/8/2012, 8:39 pm | |
| You are welcome. if you have any problems getting teleporters to work (well, you shouldn't), post them here. |
|
Sponsored content
| Subject: Re: [SOLVED]Portals? | |
| |
|