On destroy, capture

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

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

On destroy, capture

Post by Lorul1 »

I'm was looking back at this and I wanted to make an on destroy capture (change command post 8 from team 2 to team 1) script. But theres one big obstical in my way ... my only LUA experience other than mod tools is roblox :runaway: . So how would a script like this be done. Thanks in advance.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: On destroy, capture

Post by AQT »

Second tutorial: Instead of triggering an animation, you want to trigger a SetProperty. First tutorial: Use SetProperty to change the team number of command post 8 from 2 to 1.
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: On destroy, capture

Post by Lorul1 »

okay this is my lua after function ScriptPostLoad()

animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "myg1_bldg_energy_collector_core" then
Setproperty("CP5", "Team", 1)
end
end
)

just trying to make cp5 team 1's after the myg1_bldg_energy_collector_core is destroyed
i know its wrong but can someone please correct it (AQT sorry i couldent under stand the post)
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: On destroy, capture

Post by AQT »

It is only wrong if "myg1_bldg_energy_collector_core" and "CP5" aren't the correct names of the objects you want to reference. Have you tested the code out to see if it works or not?
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: On destroy, capture

Post by Lorul1 »

I tested it and it dosent work. I knew my script wouldn't work in the first place because I used the on destroy, animate script and just changed some things. those other post that you linked me to dident help. I just need a on destroy change cp5 to team 1 script that I can put in my Lua, or an on destroy capture script someone els has in there Lua that works so for my perfect map to be complete 8)
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: On destroy, capture

Post by AQT »

Um, what? :? You used a "On destroy, stuff you choose to happen happens" script. Period. That's what it is. The "specialized" scripts you are looking for don't exist. It should work if you referenced the ZE object names correctly. This also means the names are case sensitive. And what do you mean the other post I linked you to didn't help? You used the information contained in it, although not correctly I just noticed. It should be SetProperty, not Setproperty.
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: On destroy, capture

Post by Lorul1 »

I tested my scrip above and but changed my old Setproperty to SetProperty with a capital P put my script in my lua after conquest:Start , and when I destroy the energy collector cp5 won't become team 1's command post . can some put my script above into there Lua and try to get it to work then repost the revised script here
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: On destroy, capture

Post by AQT »

Please post your entire lua file, as well as screenshots of "CP5" and "myg1_bldg_energy_collector_core" in ZE, both highlighted, of course.
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: On destroy, capture

Post by Lorul1 »

ok i had to use my ipod to take the screenshots i know there's a way to take screenshots with zero edit but its okay

My lua (DONT STEAL my lua or ill hire cad bane on you :P ) (no im serious dont steal my lua)
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

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

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

animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "myg1_bldg_energy_collector_core" then
SetProperty("cp5","Team",1)
end
end
)

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

animateobja = 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

SetTeamAggressiveness(CIS, 0.4)
SetTeamAggressiveness(REP, 1.0)

SetMemoryPoolSize ("Combo",64) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",256) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",256) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",256) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",150) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",4086) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",64) -- should be ~1x #combo
SetMemoryPoolSize("Music", 40)

ReadDataFile("sound\\geo.lvl;geo1cw")
ReadDataFile("SIDE\\rep.lvl",
--"rep_bldg_forwardcenter",
"rep_fly_assault_dome",
"rep_fly_jedifighter",
--"rep_fly_gunship",
"rep_fly_vwing",
"rep_fly_arc170fighter_sc",
"rep_fly_anakinstarfighter_sc",
"rep_fly_gunship_dome",
"rep_fly_jedifighter_dome",
"rep_fly_gunship_sc",
"rep_inf_ep2_rifleman",
"rep_inf_ep2_rocketeer",
"rep_hover_fightertank",
"rep_hover_barcspeeder",
"rep_walk_atte",
"rep_walk_oneman_atst")

ReadDataFile("SIDE\\cis.lvl",
"cis_fly_droidfighter_dome",
--"cis_fly_geofighter",
"cis_fly_droidgunship",
"cis_fly_greviousfighter",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_sniper",
"cis_tread_hailfire",
"cis_tread_snailtank",
"cis_hover_stap",
"cis_hover_aat",
"cis_walk_spider")
ReadDataFile("dc:SIDE\\rep.lvl",
"rep_fly_gunship",
"rep_inf_ep3_marine",
"rep_inf_ep2_engineer",
"rep_inf_ep2_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep2_jettrooper")
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_marine",
"cis_inf_officer",
"cis_inf_engineer",
"cis_fly_droidfighter_sc",
"cis_fly_tridroidfighter")
ReadDataFile("dc:SIDE\\vehicles.lvl",
"rep_fly_jedifighter")
ReadDataFile("SIDE\\geo.lvl",
"gen_inf_geonosian")
ReadDataFile("dc:SIDE\\all.lvl",
"all_inf_wookiee")
ReadDataFile("dc:SIDE\\jed.lvl",
"jed_master_01",
"jed_knight_03",
"jed_master_02")
ReadDataFile("dc:SIDE\\imp.lvl",
"imp_hero_darthvader")

ReadDataFile("dc:SIDE\\tur.lvl",
"tur_bldg_beam",
"tur_bldg_geoturret",
"rep_bldg_moncal_roundturret")

-- Level Stats

ClearWalkers()
SetMemoryPoolSize("EntityWalker", 8)
AddWalkerType(0, 3) -- 8 droidekas (special case: 0 leg pairs)
AddWalkerType(3, 3) -- 2 spider walkers with 2 leg pairs each
AddWalkerType(6, 0) -- 2 attes with 3 leg pairs each
local weaponcnt = 240
SetMemoryPoolSize("Aimer", 170)
SetMemoryPoolSize("AmmoCounter", weaponcnt)
SetMemoryPoolSize("BaseHint", 100)
SetMemoryPoolSize("CommandWalker", 4)
SetMemoryPoolSize("EnergyBar", weaponcnt)
SetMemoryPoolSize("EntityCloth", 32)
SetMemoryPoolSize("EntityFlyer", 35)
SetMemoryPoolSize("EntityHover", 30)
SetMemoryPoolSize("EntityLight", 2000)
SetMemoryPoolSize("EntitySoundStream", 10)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 20)
SetMemoryPoolSize("Navigator", 50)
SetMemoryPoolSize("Obstacle", 750)
SetMemoryPoolSize("PathFollower", 120)
SetMemoryPoolSize("PathNode", 200)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 50)
SetMemoryPoolSize("UnitController", 50)
SetMemoryPoolSize("SoldierAnimation", 1880)
SetMemoryPoolSize("Weapon", weaponcnt)

SetSpawnDelay(10.0, 0.25)

SetupTeams{

rep = {
team = REP,
units = 500,
reinforcements = 4000,
soldier = { "rep_inf_ep2_rifleman",198, 200},
assault = { "rep_inf_ep2_rocketeer",47, 50},
engineer = { "rep_inf_ep2_engineer",47, 50},
sniper = { "rep_inf_ep2_sniper",47, 50},
officer = {"rep_inf_ep3_officer",47, 50},
special = { "rep_inf_ep2_jettrooper",47, 50},

},
cis = {
team = CIS,
units = 500,
reinforcements = 4000,
soldier = { "cis_inf_marine",174, 180},
assault = { "cis_inf_rocketeer",37, 40},
engineer = { "cis_inf_engineer",37, 40},
sniper = { "cis_inf_sniper",37, 40},
officer = {"cis_inf_officer",37, 40},
special = { "geo_inf_geonosian",37, 40},
}
}

AddUnitClass(REP,"all_inf_wookiee",47, 50)
AddUnitClass(REP,"jed_knight_03",8, 8)
AddUnitClass(REP,"jed_master_01",4, 5)
AddUnitClass(CIS,"cis_inf_rifleman",37, 40)
AddUnitClass(CIS,"jed_master_02",7, 8)
AddUnitClass(CIS,"imp_hero_darthvader",4, 5)
AddUnitClass(REP,"rep_inf_ep3_marine",0, 0)

-- 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
http://www.mediafire.com/download/8dxzix9acuwzz6i/gametoast.rar

my here are my pictures both cp5 and the energy core are in conquest and when i destroy the core cp5 dosent become team ones command post.

were did i go wrong
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: On destroy, capture

Post by lucasfart »

A tip with the pictures. You could always use the print screen button to take a snapshot then copy and paste it somewhere. Its a LOT clearer to read. And when you've got the pics, save them somewhere like imageshack.us so that you don't have to create an extra download for people...

Also, have you tried referring to "cp5" with lowercase? That's the way they seem to be referred to at the top of the lua....

And a quick question - does the lua require the NAME of the object, or the LABEL? Because you haven't got a label for the myg1 prop...
Last edited by lucasfart on Thu Aug 22, 2013 9:50 pm, edited 1 time in total.
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: On destroy, capture

Post by Lorul1 »

Yes I have but is the script correct?
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: On destroy, capture

Post by AQT »

animateobja is a variable. It cannot be equal to three different things at the same time, which is what you currently have it set up as. That's why your new code is being ignored.
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: On destroy, capture

Post by Lorul1 »

Well is there a variable or some thing that can equal 3 things or is there a way how to make my script equal 2 things and work? A better question would be how do i set up what i want . Sorry I don't know too much about Lu's
Last edited by Lorul1 on Thu Aug 22, 2013 10:03 pm, edited 1 time in total.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: On destroy, capture

Post by AQT »

I see... A variable can be anything as long as it starts with a letter. So use a unique variable for each of the functions...
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: On destroy, capture

Post by Lorul1 »

Umm okay so if it starts with a number My lua will work? Man I'm 14 I don't know one bit of Lua all I know is hello world. I don't know what variabul is I don't know what a function is. All I know is that it I don't have this working my map can't be complet. Okay will I have to make a new scrip or is there one out there that I can copy and just change. Or can I change my own to work.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: On destroy, capture

Post by AQT »

No, you can't use a number because it is not a letter. You don't have to know Lua programming to know what a variable is. The concept of a variable is taught in basic Algebra, which most people take in middle school. Here, just use this:
Hidden/Spoiler:
[code]Moe = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "myg1_bldg_energy_collector_core" then
SetProperty("cp5","Team",1)
end
end
)

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

Curly = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "spa_prop_engine_tank" then
PlayAnimation("sm3")
end
end
)[/code]
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: On destroy, capture

Post by Lorul1 »

So if I put the the first one that says moe in my lua my plan (when energy collector is destroys cp5 becomes team 1s ) WILL work (btw I knew what a variable was only I thought it meant something els in lua :D )
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: On destroy, capture

Post by AQT »

Yes, basically. The other two (Larry and Curly) will also work on their own too, unlike before when they were all named animateobja (only Curly was working, then, since the other two got ignored for sharing the same variable name).
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: On destroy, capture

Post by Lorul1 »

Thanks so much aqt . I will try to get this to work tomorrow . I can add a [Solved] to my once I've confirmed what you said worked :D

Edit: Okay I guess I asked for the wrong type of script. See when I made this post this is what i was thinking in basic terms: if got this script to work in my map, when I destroy the energy collector, cp5 will become team 1s command post . since cp5 is the last command post and team one has took all the command post the "victory" countdown will start and team one will win. But that was not the case simpily because the victory countdown will not start when I use the "Moe" (SetProperty) script AQT gave me. The MOE script worked but it dident do what I thought it would ultimately do wich was give victory to team one. With much apology I now ask is there any way how I can tweek the "Moe" script to give team 1 ( wich would be the republic) victory I was thinking something like drop the droids reinforcement count to zero. Now once again I don't know Lua so someone would have to show me how that's done . So you could explain to me if how to convert the moe (SetProperty) script into a when energy collector is destroyed give team 1 (republic) victory script. it dosent matter what form of script you use as long as it works

Edit: I just noticed that I double posted.I won't do it again :faint:
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: On destroy, capture

Post by lucasfart »

I think this is the line you want:

Code: Select all

MissionVictory(DEF)
Just change DEF to whatever your team number is (or use Def/Att). Hopefully that works. :)

I'd really encourage you to do a bit of a search before posting questions like this as there's a pretty good chance you'll find the answer. For example THIS topic has everything you need for victory in it. :)
Post Reply