Problem with my timer..

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
MasterSkywalker
Major
Major
Posts: 501
Joined: Mon Apr 17, 2006 1:44 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Problem with my timer..

Post by MasterSkywalker »

I wanted to program a timer for the Mygeeto map for the MovieMod. So I've copied over the one that was used on the Hoth campaign map too my map. The timer is on my screen, but the value is set to 21:00 and doesn't decrease :S This is my lua:
--
-- Copyright (c) 2006 Pandemic Studios, LLC. This is a MovieMod lua. EYES ONLY!
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("Ambush")
ScriptCB_PlayInGameMovie("ingame.mvs", "mygmon01")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;

---------------------------------------------------------------------------
-- 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()

function ScriptPostLoad()


--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}



--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:Start()

EnableSPHeroRules()

end

-- Timer to Beat --
timeoutTimer = CreateTimer("timeout")
SetTimerValue(timeoutTimer, 1260)
ShowTimer(timeoutTimer)

OnTimerElapse(
function(timer)
MissionVictory(DEF)
MissionVictory(ATT)
ScriptCB_SndPlaySound("HOT_obj_07")
ShowTimer(nil)
DestroyTimer(timer)
end,
timeoutTimer
)

AddDeathRegion("teleregion1")
AddDeathRegion("Region0")
OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"cisdie")
end,
"teleregion1"
)
ActivateRegion("teleregion1")

ReadDataFile("ingame.lvl")


SetMaxFlyHeight(800)
SetMaxPlayerFlyHeight (800)
SetMissionEndMovie("ingame.mvs", "mygmon02")

SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",50) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",650) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",550) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",6000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",100) -- should be ~1x #combo

ReadDataFile("sound\\myg.lvl;myg1cw")
ReadDataFile("dc:sound\\MB1.lvl;MB1cw")
ReadDataFile("dc:SIDE\\rep.lvl",
"rep_inf_ep3_rifleman",
"rep_inf_ep3_rocketeer",
"rep_inf_ep3_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep3_pilot",
"rep_inf_ep3_jettrooper",
"rep_walk_atxt",
"rep_inf_ep3_engineer",
"rep_hero_kiyadimundi",
"rep_fly_arc170fighter_sc",
"rep_fly_gunship",
"rep_hover_barcspeeder",
"imp_walk_atst")
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_droideka",
"cis_hero_grievous",
"cis_inf_magna_guard",
"cis_fly_droidfighter_sc",
"cis_hover_aat")


ReadDataFile("dc:SIDE\\tur.lvl",
"tur_bldg_laser",
"tur_weap_built_gunturret")

SetupTeams{
rep = {
team = REP,
units = 100,
reinforcements = 800,
soldier = { "rep_inf_ep3_rifleman",9, 25},
assault = { "rep_inf_ep3_rocketeer",1, 4},
engineer = { "rep_inf_ep3_engineer",1, 4},
sniper = { "rep_inf_ep3_sniper",1, 4},
officer = { "rep_inf_ep3_jettrooper",1, 4},
special = { "rep_hero_kiyadimundi",1, 1},

},
cis = {
team = CIS,
units = 120,
reinforcements = 850,
soldier = { "cis_inf_rifleman",9, 25},
assault = { "cis_inf_rocketeer",1, 4},
engineer = { "cis_inf_engineer",1, 4},
sniper = { "cis_inf_sniper",1, 4},
officer = { "cis_inf_officer",1, 4},
special = { "cis_inf_droideka",1, 4},
}
}

SetTeamName (3, "jawas")
AddUnitClass (3, "rep_inf_ep3_pilot", 9,25)
SetUnitCount (9, 25)
AddAIGoal(3, "Deathmatch", 100)

SetTeamAsFriend(ATT,3)
SetTeamAsFriend(3,ATT)
SetTeamAsEnemy(DEF,3)
SetTeamAsEnemy(3,DEF)


SetHeroClass(CIS, "cis_inf_magna_guard")
SetHeroClass(REP, "rep_inf_ep3_officer")


-- Level Stats
-- ClearWalkers()
AddWalkerType(0, 4) -- special -> droidekas
AddWalkerType(1, 0) -- 1x2 (1 pair of legs)
AddWalkerType(2, 0) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 0) -- 3x2 (3 pairs of legs)
AddWalkerType(1, 3) -- ATSTs

local weaponCnt = 1024
SetMemoryPoolSize("Aimer", 75)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 320)
SetMemoryPoolSize("EntityFlyer", 320)
SetMemoryPoolSize("EntityHover", 320)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntitySoundStream", 40)
SetMemoryPoolSize("EntitySoundStatic", 320)
SetMemoryPoolSize("MountedTurret", 320)
SetMemoryPoolSize("Navigator", 1280)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 128)
SetMemoryPoolSize("UnitController", 128)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
--ReadDataFile("dc:MB1\\MB1.lvl", "MB1_conquest")
ReadDataFile("dc:MB1\\MB1.lvl", "MB1_conquest")
SetDenseEnvironment("false")




-- Sound

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")

voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_quick", voiceQuick)

OpenAudioStream("sound\\global.lvl", "cw_music")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\myg.lvl", "myg1")
OpenAudioStream("sound\\myg.lvl", "myg1")
OpenAudioStream("sound\\myg.lvl", "myg1_emt")

SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)

SetOutOfBoundsVoiceOver(2, "cisleaving")
SetOutOfBoundsVoiceOver(1, "repleaving")

SetAmbientMusic(REP, 1.0, "rep_myg_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_myg_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2, "rep_myg_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_myg_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_myg_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2, "cis_yav_amb_end", 2,1)

SetVictoryMusic(REP, "rep_myg_amb_victory")
SetDefeatMusic (REP, "rep_myg_amb_defeat")
SetVictoryMusic(CIS, "cis_myg_amb_victory")
SetDefeatMusic (CIS, "cis_myg_amb_defeat")

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
--SetSoundEffect("BirdScatter", "birdsFlySeq1")
--SetSoundEffect("WeaponUnableSelect", "com_weap_inf_weaponchange_null")
--SetSoundEffect("WeaponModeUnableSelect", "com_weap_inf_modechange_null")
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")


--Camera Shizzle--

-- Collector Shot
AddCameraShot(0.008315, 0.000001, -0.999965, 0.000074, -64.894348, 5.541570, 201.711090);
AddCameraShot(0.633584, -0.048454, -0.769907, -0.058879, -171.257629, 7.728924, 28.249359);
AddCameraShot(-0.001735, -0.000089, -0.998692, 0.051092, -146.093109, 4.418306, -167.739212);
AddCameraShot(0.984182, -0.048488, 0.170190, 0.008385, 1.725611, 8.877428, 88.413887);
AddCameraShot(0.141407, -0.012274, -0.986168, -0.085598, -77.743042, 8.067328, 42.336128);
AddCameraShot(0.797017, 0.029661, 0.602810, -0.022434, -45.726467, 7.754435, -47.544712);
AddCameraShot(0.998764, 0.044818, -0.021459, 0.000963, -71.276566, 4.417432, 221.054550);
end
Soul
DarkHelmet

Post by DarkHelmet »

You forgot to start the timer. It doesn't start automatically.
StartTimer(timeoutTimer)
timers can also start by other events.
Qdin
Old School Staff
Posts: 2059
Joined: Wed Feb 23, 2005 9:54 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by Qdin »

I hope you don't mind that i made the LUA part small in text? :P It's gettign frustrated if you have to scroll down so much, and you know how lazy we are, so the smaller text is also more userfriendly to read :P
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by Ace_Azzameen_5 »

Here is a sample of a working timer:

Code: Select all

CreateTimer("ven1hyper")
	SetTimerValue("ven1hyper",17)
	ShowTimer("ven1hyper")
	StartTimer("ven1hyper")

	OnTimerElapse(
	function(post)
	RespawnObject("rep-cp1")
	end,
	"ven1hyper"
	)
MasterSkywalker
Major
Major
Posts: 501
Joined: Mon Apr 17, 2006 1:44 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by MasterSkywalker »

DarkHelmet wrote:You forgot to start the timer. It doesn't start automatically.
StartTimer(timeoutTimer)
timers can also start by other events.
Lol thx dude, that worked. Can't believe I'm that stupid to forget that :P

Soul
Post Reply