Elevator problem [Solved]
Posted: Mon Jan 28, 2008 4:35 pm
by Eagle Eye
Ok i added a elevator to my space map (and all regions in ZE)
This is the ***c_Diet Dr. Pepper.lua file with the elevator script:
Now if i spawn as Republic and goes to the elevator he doesn't want go up.
If i spawn as CIS and goes to the elevator a text says: [NULL] everytime i enter a region
Need some help plz
EDIT: i checked my regions again and everything looks fine so i think its the script..
EDIT2: Oh, found it! forgot to add the animations
but still the [NULL] is strange
Found the [NULL] problem to, just deleted all ShowMessageText lines.
So nvm at all, you may lock this thread
This is the ***c_Diet Dr. Pepper.lua file with the elevator script:
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPAX - Clone Wars Template Assault File
--
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("BONc_cmn")
---- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;
myGameMode = "BON_CW-Assault"
function myScriptInit()
SetMemoryPoolSize("CommandFlyer", 2)
end
function ScriptPostLoad()
--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "nab-cp1"}
cp2 = CommandPost:New{name = "nab-cp2"}
cp3 = CommandPost:New{name = "tfa-cp1"}
cp4 = CommandPost:New{name = "tfa-cp2"}
--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF,
textATT = "game.modes.con",
textDEF = "game.modes.con2",
multiplayerRules = true}
--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:Start()
-------------------------------
---More Complicated Elevator---
-------------------------------
--elv1_r1 (r1):used to determine when the player is standing on the elevator so it can move up.
--elv1_r2 (r2):used to determine when the player is standing on the elevator so it can move down.
--elv1_r3 (r3):used to determine when the player is about to go on the elevator to go up. Calls the elevator if it is not at the bottom near the player.
--elv1_r4 (r4):used to determine when the player is about to go on the elevator to go down. Calls the elevator if it is not at the top near the player.
--elv1_r5 (r5):used to determine when the elevator reaches the bottom with a player riding it.
--elv1_r5_b (r5_b):used to determine if the player fell off the elevator when riding it to the top.
--elv1_r6 (r6):used to determine when the elevator reaches the top with a player riding it.
--elv1_r6_b (r6_b):used to determine if the player fell off the elevator when riding it to the bottom.
--activate/deactive regions used/unsued.
--1 for activate, anything else for deactivate.
regions = function( a, b, c, d, e, f )
if a == 1 then
ActivateRegion("elv1_r1")
else
DeactivateRegion("elv1_r1")
end
if b == 1 then
ActivateRegion("elv1_r2")
else
DeactivateRegion("elv1_r2")
end
if c == 1 then
ActivateRegion("elv1_r3")
else
DeactivateRegion("elv1_r3")
end
if d == 1 then
ActivateRegion("elv1_r4")
else
DeactivateRegion("elv1_r4")
end
if e == 1 then
ActivateRegion("elv1_r5")
ActivateRegion("elv1_r5_b")
else
DeactivateRegion("elv1_r5")
DeactivateRegion("elv1_r5_b")
end
if f == 1 then
ActivateRegion("elv1_r6")
ActivateRegion("elv1_r6_b")
else
DeactivateRegion("elv1_r6")
DeactivateRegion("elv1_r6_b")
end
end
--activate elevator waiting areas
regions( 0, 0, 1, 1, 0, 0 )
--1 for elevator moving down, 2 for elevator moving up
location = 1
R1 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
--activate/deactive regions used/unsued.
regions( 0, 0, 0, 0, 0, 1 )
--if elevator is moving down or at the bottom.
if location == 1 then
--make the elevator object isn't in use by another animation.
PauseAnimation("elevator1_down")
--move the elevator up, making sure it starts from the bottom.
RewindAnimation("elevator1_up")
PlayAnimation("elevator1_UP")
ShowMessageText( "message.elevator.up", DEF )
--elevator now moving up, so set location to 2
location = 2
end
end
end,
"elv1_r1"
)
--the rest of the added code is almost the same, just with different regions being activated/deactivated. I will not comment it.
R2 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 0, 0, 0, 0, 1, 0 )
if location == 2 then
PauseAnimation("elevator1_up")
RewindAnimation("elevator1_down")
PlayAnimation("elevator1_down")
ShowMessageText( "message.elevator.down", DEF )
location = 1
end
end
end,
"elv1_r2"
)
R3 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 1, 0, 0, 0, 0, 0 )
ShowMessageText( "message.elevator.calling", DEF )
if location == 2 then
PauseAnimation("elevator1_up")
RewindAnimation("elevator1_down")
PlayAnimation("elevator1_down")
ShowMessageText( "message.elevator.down", DEF )
location = 1
end
end
end,
"elv1_r3"
)
R4 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 0, 1, 0, 0, 0, 0 )
ShowMessageText( "message.elevator.calling", DEF )
if location == 1 then
PauseAnimation("elevator1_down")
RewindAnimation("elevator1_up")
PlayAnimation("elevator1_UP")
ShowMessageText( "message.elevator.up", DEF )
location = 2
end
end
end,
"elv1_r4"
)
R5 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 0, 0, 1, 1, 0, 0 )
ShowMessageText( "message.elevator.getoff", DEF )
end
end,
"elv1_r5"
)
R5b = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 0, 0, 1, 1, 0, 0 )
ShowMessageText( "message.elevator.getoff", DEF )
end
end,
"elv1_r5_b"
)
R6 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 0, 0, 1, 1, 0, 0 )
ShowMessageText( "message.elevator.getoff", DEF )
end
end,
"elv1_r6"
)
R6b = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 0, 0, 1, 1, 0, 0 )
ShowMessageText( "message.elevator.getoff", DEF )
end
end,
"elv1_r6_b"
)
end
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPAX - Clone Wars Template Assault File
--
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("BONc_cmn")
---- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;
myGameMode = "BON_CW-Assault"
function myScriptInit()
SetMemoryPoolSize("CommandFlyer", 2)
end
function ScriptPostLoad()
--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "nab-cp1"}
cp2 = CommandPost:New{name = "nab-cp2"}
cp3 = CommandPost:New{name = "tfa-cp1"}
cp4 = CommandPost:New{name = "tfa-cp2"}
--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF,
textATT = "game.modes.con",
textDEF = "game.modes.con2",
multiplayerRules = true}
--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:Start()
-------------------------------
---More Complicated Elevator---
-------------------------------
--elv1_r1 (r1):used to determine when the player is standing on the elevator so it can move up.
--elv1_r2 (r2):used to determine when the player is standing on the elevator so it can move down.
--elv1_r3 (r3):used to determine when the player is about to go on the elevator to go up. Calls the elevator if it is not at the bottom near the player.
--elv1_r4 (r4):used to determine when the player is about to go on the elevator to go down. Calls the elevator if it is not at the top near the player.
--elv1_r5 (r5):used to determine when the elevator reaches the bottom with a player riding it.
--elv1_r5_b (r5_b):used to determine if the player fell off the elevator when riding it to the top.
--elv1_r6 (r6):used to determine when the elevator reaches the top with a player riding it.
--elv1_r6_b (r6_b):used to determine if the player fell off the elevator when riding it to the bottom.
--activate/deactive regions used/unsued.
--1 for activate, anything else for deactivate.
regions = function( a, b, c, d, e, f )
if a == 1 then
ActivateRegion("elv1_r1")
else
DeactivateRegion("elv1_r1")
end
if b == 1 then
ActivateRegion("elv1_r2")
else
DeactivateRegion("elv1_r2")
end
if c == 1 then
ActivateRegion("elv1_r3")
else
DeactivateRegion("elv1_r3")
end
if d == 1 then
ActivateRegion("elv1_r4")
else
DeactivateRegion("elv1_r4")
end
if e == 1 then
ActivateRegion("elv1_r5")
ActivateRegion("elv1_r5_b")
else
DeactivateRegion("elv1_r5")
DeactivateRegion("elv1_r5_b")
end
if f == 1 then
ActivateRegion("elv1_r6")
ActivateRegion("elv1_r6_b")
else
DeactivateRegion("elv1_r6")
DeactivateRegion("elv1_r6_b")
end
end
--activate elevator waiting areas
regions( 0, 0, 1, 1, 0, 0 )
--1 for elevator moving down, 2 for elevator moving up
location = 1
R1 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
--activate/deactive regions used/unsued.
regions( 0, 0, 0, 0, 0, 1 )
--if elevator is moving down or at the bottom.
if location == 1 then
--make the elevator object isn't in use by another animation.
PauseAnimation("elevator1_down")
--move the elevator up, making sure it starts from the bottom.
RewindAnimation("elevator1_up")
PlayAnimation("elevator1_UP")
ShowMessageText( "message.elevator.up", DEF )
--elevator now moving up, so set location to 2
location = 2
end
end
end,
"elv1_r1"
)
--the rest of the added code is almost the same, just with different regions being activated/deactivated. I will not comment it.
R2 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 0, 0, 0, 0, 1, 0 )
if location == 2 then
PauseAnimation("elevator1_up")
RewindAnimation("elevator1_down")
PlayAnimation("elevator1_down")
ShowMessageText( "message.elevator.down", DEF )
location = 1
end
end
end,
"elv1_r2"
)
R3 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 1, 0, 0, 0, 0, 0 )
ShowMessageText( "message.elevator.calling", DEF )
if location == 2 then
PauseAnimation("elevator1_up")
RewindAnimation("elevator1_down")
PlayAnimation("elevator1_down")
ShowMessageText( "message.elevator.down", DEF )
location = 1
end
end
end,
"elv1_r3"
)
R4 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 0, 1, 0, 0, 0, 0 )
ShowMessageText( "message.elevator.calling", DEF )
if location == 1 then
PauseAnimation("elevator1_down")
RewindAnimation("elevator1_up")
PlayAnimation("elevator1_UP")
ShowMessageText( "message.elevator.up", DEF )
location = 2
end
end
end,
"elv1_r4"
)
R5 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 0, 0, 1, 1, 0, 0 )
ShowMessageText( "message.elevator.getoff", DEF )
end
end,
"elv1_r5"
)
R5b = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 0, 0, 1, 1, 0, 0 )
ShowMessageText( "message.elevator.getoff", DEF )
end
end,
"elv1_r5_b"
)
R6 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 0, 0, 1, 1, 0, 0 )
ShowMessageText( "message.elevator.getoff", DEF )
end
end,
"elv1_r6"
)
R6b = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
regions( 0, 0, 1, 1, 0, 0 )
ShowMessageText( "message.elevator.getoff", DEF )
end
end,
"elv1_r6_b"
)
end
If i spawn as CIS and goes to the elevator a text says: [NULL] everytime i enter a region
Need some help plz
EDIT: i checked my regions again and everything looks fine so i think its the script..
EDIT2: Oh, found it! forgot to add the animations
Found the [NULL] problem to, just deleted all ShowMessageText lines.
So nvm at all, you may lock this thread