OnFinishCapture help

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
User avatar
Lorul1
Rebel Colonel
Rebel Colonel
Posts: 562
Joined: Wed Apr 24, 2013 10:34 pm
Projects :: Assault on Theed
Games I'm Playing :: Battlegrounds
xbox live or psn: No gamertag set
Location: Your House

OnFinishCapture help

Post by Lorul1 »

I'm trying to make something that i can put in my lua so that when cp4 is captured by team 1 it animates an animation called "animation1". I know its wrong so can some one please correct it.

takeanimate = OnFinishCapture(
function(post, holding)
if GetCommandPostTeam(cp4) == "team1" then
PlayAnimation("animation1")
end
end
)

Also another thing i have many regions that i want to start out un-activated then when i destroy something i want those region to be active. what changes to the script above do i need to make to do that.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: OnFinishCapture help

Post by Marth8880 »

How do you know it's wrong? What happens in-game?
User avatar
Lorul1
Rebel Colonel
Rebel Colonel
Posts: 562
Joined: Wed Apr 24, 2013 10:34 pm
Projects :: Assault on Theed
Games I'm Playing :: Battlegrounds
xbox live or psn: No gamertag set
Location: Your House

Re: OnFinishCapture help

Post by Lorul1 »

oh (quick response) i haven't tested it yet. dose it look good to you. dose it work in your game.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: OnFinishCapture help

Post by Marth8880 »

You should change "team1" to ATT, 1, or whichever team is set to team 1 (CIS, REP, ALL, or IMP); make sure to not have quotes.
User avatar
Lorul1
Rebel Colonel
Rebel Colonel
Posts: 562
Joined: Wed Apr 24, 2013 10:34 pm
Projects :: Assault on Theed
Games I'm Playing :: Battlegrounds
xbox live or psn: No gamertag set
Location: Your House

Re: OnFinishCapture help

Post by Lorul1 »

so like this?

takeanimate = OnFinishCapture(
function(post, holding)
if GetCommandPostTeam(thecommandpostiwant) == ATT,1 then
PlayAnimation("whateveranimationgroup")
end
end
)

i don't really understand what the line function(post, holding) is meant to do
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: OnFinishCapture help

Post by Marth8880 »

Nope. I said ATT, 1, OR the team ID (REP, CIS, ALL, or IMP).
User avatar
Lorul1
Rebel Colonel
Rebel Colonel
Posts: 562
Joined: Wed Apr 24, 2013 10:34 pm
Projects :: Assault on Theed
Games I'm Playing :: Battlegrounds
xbox live or psn: No gamertag set
Location: Your House

Re: OnFinishCapture help

Post by Lorul1 »

okay this is exactly what i have and its not working

takeanimate = OnFinishCapture(
function(cp3, holding)
if GetCommandPostTeam(cp3) == REP then
PlayAnimation("dropship")
end
end
)

maybe it has something to do with the line: function(cp3, holding)
can you please correct this script above and post it on your next response
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: OnFinishCapture help

Post by Marth8880 »

Why did you change "post" to "cp3"? Change that part back to function(post, holding).
User avatar
Lorul1
Rebel Colonel
Rebel Colonel
Posts: 562
Joined: Wed Apr 24, 2013 10:34 pm
Projects :: Assault on Theed
Games I'm Playing :: Battlegrounds
xbox live or psn: No gamertag set
Location: Your House

Re: OnFinishCapture help

Post by Lorul1 »

it still dosent work
okay here's my lua
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ambush")

---------------------------------------------------------------------------
-- 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 ScriptPostLoad()
AddAIGoal(3, "Deathmatch", 100)
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp5 = CommandPost:New{name = "cp5"}
cp6 = CommandPost:New{name = "cp6"}
cp7 = CommandPost:New{name = "cp7"}
cp8 = CommandPost:New{name = "cp8"}
cp9 = CommandPost:New{name = "cp9"}
cp10 = CommandPost:New{name = "cp10"}
cp11 = CommandPost:New{name = "cp11"}

--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, text = "level.geo1.objectives.conquest", 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:AddCommandPost(cp5)
conquest:AddCommandPost(cp6)
conquest:AddCommandPost(cp7)
conquest:AddCommandPost(cp8)
conquest:AddCommandPost(cp9)
conquest:AddCommandPost(cp10)
conquest:AddCommandPost(cp11)

conquest:Start()

DeactivateRegion("Regirum")

Mom = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "myg1_bldg_energy_collector_core" then
PlayAnimation("final")
end
end
)

Mus = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "myg1_bldg_energy_collector_core" then
ActivateRegion("Regirum")
end
end
)

Dad = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "myg1_bldg_energy_collector_core" then
Activateregion("final")
end
end
)

Bob = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "cis_fedcruiser_commandroom_SG_blender" then
PlayAnimation("sm2")
end
end
)

animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "spa_prop_console" then
PlayAnimation("sm1")
end
end
)

Wala = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "kas2_prop_door_mech" then
PlayAnimation("battletop")
end
end
)

Retest = OnObjectKill(
function(myg1_bldg_energy_collector_core, character)
if GetEntityName(myg1_bldg_energy_collector_core) == "myg1_bldg_energy_collector_core" then
AddRegion("Regirum")
end
end
)

takeanimate = OnFinishCapture(
function(post, holding)
if GetCommandPostTeam(cp3) == "REP" then
PlayAnimation("Abc")
end
end
)

Joe = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "spa_prop_engine_tank" then
PlayAnimation("sm3")
end
end
)

SetUberMode(1);

AddDeathRegion("deathregion")
AddDeathRegion("deathregion2")
AddDeathRegion("deathregion3")
AddDeathRegion("deathregion4")
AddDeathRegion("deathregion5")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"TeleportNode3")
end,
"TeleportRegion2"
)
ActivateRegion("TeleportRegion2")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"TeleportNode5")
end,
"TeleportRegion5"
)
ActivateRegion("TeleportRegion5")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"TeleportNode6")
end,
"TeleportRegion6"
)
ActivateRegion("TeleportRegion6")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"TeleportNode10")
end,
"TeleportRegion10"
)
ActivateRegion("TeleportRegion10")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"TeleportNode9")
end,
"TeleportRegion9"
)
ActivateRegion("TeleportRegion9")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"TeleportNode8")
end,
"TeleportRegion8"
)
ActivateRegion("TeleportRegion8")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"TeleportNode")
end,
"TeleportRegion"
)
ActivateRegion("TeleportRegion")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"TeleportNode2")
end,
"TeleportRegion3"
)
ActivateRegion("TeleportRegion3")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"TeleportNode7")
end,
"TeleportRegion7"
)
ActivateRegion("TeleportRegion7")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"TeleportNode4")
end,
"TeleportRegion4"
)
ActivateRegion("TeleportRegion4")

end
function ScriptInit()
StealArtistHeap(800*1024)
-- Designers, these two lines *MUST* be first.
SetPS2ModelMemory(3500000)
ReadDataFile("ingame.lvl")

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



-- Level Stats



SetTeamAsFriend(ATM, CIS)
SetTeamAsFriend(CIS, ATM)
SetTeamAsEnemy(ATM, REP)
SetTeamAsEnemy(REP, ATM)
SetTeamName(ATM, CIS)
ClearAIGoals(ATM)
AddAIGoal(ATM, "Deathmatch", 100)


-- Attacker Stats

--teamATT = ConquestTeam:New{team = ATT}
--teamATT:AddBleedThreshold(21, 0.75)
--teamATT:AddBleedThreshold(11, 2.25)
--teamATT:AddBleedThreshold(1, 3.0)
--teamATT:Init()
SetTeamAsEnemy(ATT,3)
SetTeamAsEnemy(3,ATT)

-- Defender Stats

--teamDEF = ConquestTeam:New{team = DEF}
--teamDEF:AddBleedThreshold(21, 0.75)
--teamDEF:AddBleedThreshold(11, 2.25)
--teamDEF:AddBleedThreshold(1, 3.0)
--teamDEF:Init()
SetTeamAsFriend(DEF,3)

-- Local Stats
SetTeamName(3, "locals")
SetUnitCount(3, 7)
AddUnitClass(3, "geo_inf_geonosian", 7)
SetTeamAsFriend(3, DEF)
--SetTeamName(4, "locals")
--AddUnitClass(4, "rep_inf_jedimale",1)
--AddUnitClass(4, "rep_inf_jedimaleb",1)
--AddUnitClass(4, "rep_inf_jedimaley",1)
--SetUnitCount(4, 3)
--SetTeamAsFriend(4, ATT)

ReadDataFile("dc:GZB\\geo1.lvl", "geo1_conquest")

SetDenseEnvironment("false")
SetMinFlyHeight(-65)
SetMaxFlyHeight(500)
SetMaxPlayerFlyHeight(500)



-- Birdies
--SetNumBirdTypes(1)
--SetBirdType(0.0,10.0,"dragon")
--SetBirdFlockMinHeight(90.0)

-- Sound

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\\geo.lvl", "geo1cw")
OpenAudioStream("sound\\geo.lvl", "geo1cw")

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)

SetLowReinforcementsVoiceOver(REP, REP, "rep_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(REP, CIS, "rep_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(CIS, CIS, "cis_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(CIS, REP, "cis_off_victory_im", .1, 1)

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

SetAmbientMusic(REP, 1.0, "rep_GEO_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_GEO_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2, "rep_GEO_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_GEO_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_GEO_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2, "cis_GEO_amb_end", 2,1)

SetVictoryMusic(REP, "rep_geo_amb_victory")
SetDefeatMusic (REP, "rep_geo_amb_defeat")
SetVictoryMusic(CIS, "cis_geo_amb_victory")
SetDefeatMusic (CIS, "cis_geo_amb_defeat")

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
--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")


--ActivateBonus(CIS, "SNEAK_ATTACK")
--ActivateBonus(REP, "SNEAK_ATTACK")

SetAttackingTeam(ATT)

--Opening Satalite Shot
--Geo
--Mountain
AddCameraShot(0.996091, 0.085528, -0.022005, 0.001889, -6.942698, -59.197201, 26.136919)
--Wrecked Ship
AddCameraShot(0.906778, 0.081875, -0.411906, 0.037192, 26.373968, -59.937874, 122.553581)
--War Room
--AddCameraShot(0.994219, 0.074374, 0.077228, -0.005777, 90.939568, -49.293945, -69.571136)
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

this is what I want
when the republic takes cp3 an animation called "Abc" plays.
what did I do wrong.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: OnFinishCapture help

Post by Marth8880 »

What does your debug log say? Also, you'll probably have to give these objects specific names in Zero Editor instead of just referencing their ODF names.
User avatar
Lorul1
Rebel Colonel
Rebel Colonel
Posts: 562
Joined: Wed Apr 24, 2013 10:34 pm
Projects :: Assault on Theed
Games I'm Playing :: Battlegrounds
xbox live or psn: No gamertag set
Location: Your House

Re: OnFinishCapture help

Post by Lorul1 »

My debug log doesn't say ANYTHING about my Lua ( I can post it tomorrow)
And what items are you taking about cp3?

And also I DON'T Know how to code in Lua as well as most people here at gametoast.
I just need an on capture, animate script so my map can be complete and the the script I made above doesn't work :(

Any ideas or fixes you can make to the lua
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: OnFinishCapture help

Post by Marth8880 »

Lorul1 wrote:And what items are you taking about cp3?
Huh?
User avatar
Lorul1
Rebel Colonel
Rebel Colonel
Posts: 562
Joined: Wed Apr 24, 2013 10:34 pm
Projects :: Assault on Theed
Games I'm Playing :: Battlegrounds
xbox live or psn: No gamertag set
Location: Your House

Re: OnFinishCapture help

Post by Lorul1 »

Marth8880 wrote:you'll probably have to give these objects specific names in Zero Editor instead of just referencing their ODF names.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: OnFinishCapture help

Post by Marth8880 »

Any objects you reference in your LUA must have a specific name given in Zero Editor.
User avatar
Lorul1
Rebel Colonel
Rebel Colonel
Posts: 562
Joined: Wed Apr 24, 2013 10:34 pm
Projects :: Assault on Theed
Games I'm Playing :: Battlegrounds
xbox live or psn: No gamertag set
Location: Your House

Re: OnFinishCapture help

Post by Lorul1 »

Well the only object that I'm representing in my lua to get an on capture, animate script is cp3 (wich is named cp3). I'm guessing you have a lot of experience programming you can eject my lua code that dosent work into your Lua and Change it to work ... if you want to. that's the only troubleshooter I can think of.


EDIT: I fixed the problem :thumbs: it was something with the Luna and quotations I will try to add "solved" to this topic as well as post the correct Lua for anyone who will need it in the future on Friday. thanks for your help ^_^
Post Reply