Page 1 of 2

Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 7:43 pm
by Fierfek
I have a shield in my map, which I want to be destroyed when a panel is killed. The player's job is to defend the panel, and when it is destroyed, the shield comes down.
I took a look at the mygeeto and hoth scripts, but it was completely gibberish to me.
What is the easiest way to do this?

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 7:45 pm
by Frisbeetarian

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 7:47 pm
by Fierfek
Frisbeetarian wrote:Wooo!! Another one from the FAQ

http://www.gametoast.com/forums/viewtop ... 27&t=12473
I already looked at that. How would I set it up from there - that is still gibberish to me (and I want the AI to do the destroying, not humans).

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 7:53 pm
by Frisbeetarian
I really directed you to excess stuff, I really just wanted to show you the function OnObjectKill() which is described in greater detail in the documentation.
Fierfek wrote:and I want the AI to do the destroying, not humans
No where in that first part is there anything specific to human players (why would you read the points part, you didn't want that?).
Fierfek wrote:it was completely gibberish to me
This is your problem. I'm not sure if you use the mission scripter, but it leaves behind problems like this in its wake. You need to understand the scripts. I can understand if people have a hard time getting through the shell scripts, but individual campaign scripts are different. If it's giving you a hard time, play the mission, pause, look at the script, rinse and repeat.

I can tell that the Mygeeto script is harder though, as it's not as straight forward. Use liberal use of the search function. A programmer's rule of thumb is that variables are look like this thisIsAnExample, and functions look like this ThisIsAnExample.

Code: Select all

OnObjectKillName(ShieldDied, "generator_01");
This is the code that occurs when the first generator is destroyed. You could open ZE to find the name of the first generator and then search for it in the Lua script to find this. What this is saying is to execute the function ShieldDied upon the destruction of the object by the name "generator_01".

Code: Select all

function ShieldDied(actor)
     fullName = GetEntityName(actor);
     numberStr = string.sub(fullName, -2, -1);
     
     shieldName = "force_shield_" .. numberStr;
     genName = "generator_" .. numberStr;
     upAnim = "shield_up_" .. numberStr;
     downAnim = "shield_down_" .. numberStr;
     
     PlayShieldDown(shieldName, genName, upAnim, downAnim);
     
     UnblockPlanningGraphArcs("shield_" .. numberStr);
     DisableBarriers("shield_" .. numberStr);

end
This is the function executed, again found through search. You can ignore all of the extra variables since they are just there in this case so that ShieldDied can be used for more than one thing; you'll just do something once. PlayShieldDown is just another function that goes through the animations and changes a couple objects. If you look in that function, it has KillObject(), which is the function you're going to want to use. The last couple things have to do with planning and barriers, which if you want a polished map, you'll include also.

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 8:01 pm
by Fierfek
So, I would put this in the lua?

Code: Select all

OnObjectKill("shield_panel")
	killobject("rep_shield")

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 8:21 pm
by Frisbeetarian
No. You didn't use the function correctly (something Zerted and I talked to you about with the timers). I gave you a link to an FAQ topic that uses is correctly. Also, killobject() is not a function, KillObject() is.

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 8:29 pm
by Fierfek
So like this?

Code: Select all

OnObjectKill
(function(object, killer) 
if GetEntityName(object) == "shield_panel" then 
KillObject("rep_shield") 
end 
end
)

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 8:39 pm
by Frisbeetarian
Yes. That'll work just how you want it.

If you wanted to be a little more efficient, you could also have done this:

Code: Select all

OnObjectKillName(
   function(object, killer)
         KillObject("rep_shield")
   end,
"shield_panel"
)

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 8:40 pm
by Fierfek
Frisbeetarian wrote:Yes. That'll work just how you want it.
So that part of my lus can look like this?
Hidden/Spoiler:
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"}
cp4 = CommandPost:New{name = "cp4"}


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

SetUberMode(1);

EnableSPHeroRules()

AddAIGoal(ATT, "Defend", 800, "shield_panel")

AddAIGoal(DEF, "Destroy", 900, "shield_panel")

OnObjectKill
(function(object, killer)
if GetEntityName(object) == "shield_panel" then
KillObject("rep_shield")
KillObject("rep_shield2")
KillObject("rep_shield3")
end
end)

KillObject("cp5")
SetReinforcementCount(3, 1000)
SetAIDifficulty(5, -5)
SetUnitCount (3, 0)

CreateTimer("rein_timer")
SetTimerValue("rein_timer", 360)
ShowTimer("rein_timer")
StartTimer("rein_timer")

ShowMessageText("level.RC1.objective1")

OnTimerElapse(
function(timer)
RespawnObject("cp5")
AddReinforcements(ATT, 50)
SetUnitCount (3, 500)
SetUnitCount (2, 20)
DestroyTimer("rein_timer")
end,
"rein_timer"
)

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.
---------------------------------------------------------------------------
Because I get these munge errors:
Hidden/Spoiler:
C:\BF2_ModTools\data_RC1\_BUILD\..\..\ToolsFL\Bin\luac.exe: ..\..\common\scripts\RC1\RC1c_con.lua:50: ambiguous syntax (function call x new statement) near `('
ERROR[scriptmunge scripts\RC1\RC1c_con.lua]:Could not read input file.ERROR[scriptmunge scripts\RC1\RC1c_con.lua]:Could not read input file. [continuing]
2 Errors 0 Warnings

ERROR[levelpack mission\RC1c_con.req]:Expecting bracket, but none was found.
File : munged\pc\rc1c_con.script.req(1)...

ucft <--
ERROR[levelpack mission\RC1c_con.req]:Expecting bracket, but none was found.
File : munged\pc\rc1c_con.script.req(1)...

ucft <--

2 Errors 0 Warnings

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 8:42 pm
by Frisbeetarian
Yes

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 8:43 pm
by Fierfek
Frisbeetarian wrote:Yes
What about the munge errors? My munge output says that there is an error in the lua. Do I just ignore that?

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 8:47 pm
by Frisbeetarian
Hidden/Spoiler:
[quote="Fierfek"]Do I just ignore that?[/quote]No

I thought you were just asking about what we were working on. The munge error refers to part of your Lua script further down that has nothing to do with anything we've talked about in this topic.
EDIT: Woops, you didn't start with the beginning of your script, so when I checked the line number, it didn't match up correctly. I guess that Lua doesn't like it when you put a newline between a function name and it's opening parenthese. Delete the newline and you should be fine.

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 8:52 pm
by Fierfek
Frisbeetarian wrote:
Fierfek wrote:Do I just ignore that?
No

I thought you were just asking about what we were working on. The munge error refers to part of your Lua script further down that has nothing to do with anything we've talked about in this topic.
What part?
Here is my lua:
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

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

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


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"}
cp4 = CommandPost:New{name = "cp4"}


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

SetUberMode(1);

EnableSPHeroRules()

AddAIGoal(ATT, "Defend", 800, "shield_panel")

AddAIGoal(DEF, "Destroy", 900, "shield_panel")

OnObjectKill
(function(object, killer)
if GetEntityName(object) == "shield_panel" then
KillObject("rep_shield")
KillObject("rep_shield2")
KillObject("rep_shield3")
end
end)

KillObject("cp5")
SetReinforcementCount(3, 1000)
SetAIDifficulty(5, -5)
SetUnitCount (3, 0)

CreateTimer("rein_timer")
SetTimerValue("rein_timer", 360)
ShowTimer("rein_timer")
StartTimer("rein_timer")

ShowMessageText("level.RC1.objective1")

OnTimerElapse(
function(timer)
RespawnObject("cp5")
AddReinforcements(ATT, 50)
SetUnitCount (3, 500)
SetUnitCount (2, 20)
DestroyTimer("rein_timer")
end,
"rein_timer"
)

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


SetTeamAggressiveness(ATT, 1)

SetTeamAggressiveness(3, 1)

SetTeamAggressiveness(DEF, 0)

ReadDataFile("ingame.lvl")

ForceHumansOntoTeam1()

SetMaxFlyHeight(30)
SetMaxPlayerFlyHeight (30)

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\\yav.lvl;yav1cw")
ReadDataFile("dc:SIDE\\rep.lvl",
"rep_inf_atin_commando",
"rep_inf_boss_commando",
"rep_inf_scorch_commando",
"rep_inf_sev_commando",
"rep_inf_fixer_commando",
"rep_inf_niner_commando",
"rep_inf_darman_commando",
"rep_inf_ep2_rifleman")
ReadDataFile("SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_droideka",
"cis_hero_darthmaul",
"cis_hover_aat")


ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_laser",
"tur_bldg_tower")

SetupTeams{
rep = {
team = REP,
units = 50,
reinforcements = 150,
soldier = { "rep_inf_atin_commando",1, 2},
assault = { "rep_inf_darman_commando",1, 2},
engineer = { "rep_inf_fixer_commando",1, 2},
sniper = { "rep_inf_sev_commando",1, 2},
officer = {"rep_inf_scorch_commando",1, 2},
special = { "rep_inf_niner_commando",1, 2},

},
cis = {
team = CIS,
units = 400,
reinforcements = 1000,
soldier = { "cis_inf_rifleman",300, 350},
engineer = { "cis_inf_engineer",3, 10},
sniper = { "cis_inf_sniper",2, 10},
special = { "cis_inf_droideka",1, 5},
}
}

SetTeamName (3, "clones")
AddUnitClass (3, "rep_inf_ep2_rifleman", 400,500)
SetUnitCount (3, 500)
AddAIGoal(3, "Deathmatch", 100)
SetTeamAsFriend(ATT,3)
SetTeamAsFriend(3,ATT)
SetTeamAsEnemy(DEF,3)
SetTeamAsEnemy(3,DEF)

SetHeroClass(CIS, "cis_hero_darthmaul")
SetHeroClass(REP, "rep_inf_boss_commando")


-- 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)
local weaponCnt = 1024
SetMemoryPoolSize("Aimer", 75)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 32)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityHover", 32)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
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:RC1\\RC1.lvl", "RC1_conquest")
ReadDataFile("dc:RC1\\RC1.lvl", "RC1_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\\yav.lvl", "yav1")
OpenAudioStream("sound\\yav.lvl", "yav1")
OpenAudioStream("sound\\yav.lvl", "yav1_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_yav_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_yav_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2, "rep_yav_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_yav_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_yav_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2, "cis_yav_amb_end", 2,1)

SetVictoryMusic(REP, "rep_yav_amb_victory")
SetDefeatMusic (REP, "rep_yav_amb_defeat")
SetVictoryMusic(CIS, "cis_yav_amb_victory")
SetDefeatMusic (CIS, "cis_yav_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")


--OpeningSateliteShot
AddCameraShot(0.908386, -0.209095, -0.352873, -0.081226, -45.922508, -19.114113, 77.022636);

AddCameraShot(-0.481173, 0.024248, -0.875181, -0.044103, 14.767292, -30.602322, -144.506851);
AddCameraShot(0.999914, -0.012495, -0.004416, -0.000055, 1.143253, -33.602314, -76.884430);
AddCameraShot(0.839161, 0.012048, -0.543698, 0.007806, 19.152437, -49.802273, 24.337317);
AddCameraShot(0.467324, 0.006709, -0.883972, 0.012691, 11.825212, -49.802273, -7.000720);
AddCameraShot(0.861797, 0.001786, -0.507253, 0.001051, -11.986043, -59.702248, 23.263165);
AddCameraShot(0.628546, -0.042609, -0.774831, -0.052525, 20.429928, -48.302277, 9.771714);
AddCameraShot(0.765213, -0.051873, 0.640215, 0.043400, 57.692474, -48.302277, 16.540724);
AddCameraShot(0.264032, -0.015285, -0.962782, -0.055734, -16.681797, -42.902290, 129.553268);
AddCameraShot(-0.382320, 0.022132, -0.922222, -0.053386, 20.670977, -42.902290, 135.513001);
end

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 8:53 pm
by Frisbeetarian
That's three times I've been editing when you posted. :lol: Read my edit.

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 8:55 pm
by Fierfek
Frisbeetarian wrote:Delete the newline and you should be fine.
What new line?
Can you outline it in red?
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

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

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


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"}
cp4 = CommandPost:New{name = "cp4"}


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

SetUberMode(1);

EnableSPHeroRules()

AddAIGoal(ATT, "Defend", 800, "shield_panel")

AddAIGoal(DEF, "Destroy", 900, "shield_panel")

OnObjectKill
(function(object, killer)
if GetEntityName(object) == "shield_panel" then
KillObject("rep_shield")
KillObject("rep_shield2")
KillObject("rep_shield3")
end
end)

KillObject("cp5")
SetReinforcementCount(3, 1000)
SetAIDifficulty(5, -5)
SetUnitCount (3, 0)

CreateTimer("rein_timer")
SetTimerValue("rein_timer", 360)
ShowTimer("rein_timer")
StartTimer("rein_timer")

ShowMessageText("level.RC1.objective1")

OnTimerElapse(
function(timer)
RespawnObject("cp5")
AddReinforcements(ATT, 50)
SetUnitCount (3, 500)
SetUnitCount (2, 20)
DestroyTimer("rein_timer")
end,
"rein_timer"
)

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


SetTeamAggressiveness(ATT, 1)

SetTeamAggressiveness(3, 1)

SetTeamAggressiveness(DEF, 0)

ReadDataFile("ingame.lvl")

ForceHumansOntoTeam1()

SetMaxFlyHeight(30)
SetMaxPlayerFlyHeight (30)

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\\yav.lvl;yav1cw")
ReadDataFile("dc:SIDE\\rep.lvl",
"rep_inf_atin_commando",
"rep_inf_boss_commando",
"rep_inf_scorch_commando",
"rep_inf_sev_commando",
"rep_inf_fixer_commando",
"rep_inf_niner_commando",
"rep_inf_darman_commando",
"rep_inf_ep2_rifleman")
ReadDataFile("SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_droideka",
"cis_hero_darthmaul",
"cis_hover_aat")


ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_laser",
"tur_bldg_tower")

SetupTeams{
rep = {
team = REP,
units = 50,
reinforcements = 150,
soldier = { "rep_inf_atin_commando",1, 2},
assault = { "rep_inf_darman_commando",1, 2},
engineer = { "rep_inf_fixer_commando",1, 2},
sniper = { "rep_inf_sev_commando",1, 2},
officer = {"rep_inf_scorch_commando",1, 2},
special = { "rep_inf_niner_commando",1, 2},

},
cis = {
team = CIS,
units = 400,
reinforcements = 1000,
soldier = { "cis_inf_rifleman",300, 350},
engineer = { "cis_inf_engineer",3, 10},
sniper = { "cis_inf_sniper",2, 10},
special = { "cis_inf_droideka",1, 5},
}
}

SetTeamName (3, "clones")
AddUnitClass (3, "rep_inf_ep2_rifleman", 400,500)
SetUnitCount (3, 500)
AddAIGoal(3, "Deathmatch", 100)
SetTeamAsFriend(ATT,3)
SetTeamAsFriend(3,ATT)
SetTeamAsEnemy(DEF,3)
SetTeamAsEnemy(3,DEF)

SetHeroClass(CIS, "cis_hero_darthmaul")
SetHeroClass(REP, "rep_inf_boss_commando")


-- 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)
local weaponCnt = 1024
SetMemoryPoolSize("Aimer", 75)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 32)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityHover", 32)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
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:RC1\\RC1.lvl", "RC1_conquest")
ReadDataFile("dc:RC1\\RC1.lvl", "RC1_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\\yav.lvl", "yav1")
OpenAudioStream("sound\\yav.lvl", "yav1")
OpenAudioStream("sound\\yav.lvl", "yav1_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_yav_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_yav_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2, "rep_yav_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_yav_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_yav_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2, "cis_yav_amb_end", 2,1)

SetVictoryMusic(REP, "rep_yav_amb_victory")
SetDefeatMusic (REP, "rep_yav_amb_defeat")
SetVictoryMusic(CIS, "cis_yav_amb_victory")
SetDefeatMusic (CIS, "cis_yav_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")


--OpeningSateliteShot
AddCameraShot(0.908386, -0.209095, -0.352873, -0.081226, -45.922508, -19.114113, 77.022636);

AddCameraShot(-0.481173, 0.024248, -0.875181, -0.044103, 14.767292, -30.602322, -144.506851);
AddCameraShot(0.999914, -0.012495, -0.004416, -0.000055, 1.143253, -33.602314, -76.884430);
AddCameraShot(0.839161, 0.012048, -0.543698, 0.007806, 19.152437, -49.802273, 24.337317);
AddCameraShot(0.467324, 0.006709, -0.883972, 0.012691, 11.825212, -49.802273, -7.000720);
AddCameraShot(0.861797, 0.001786, -0.507253, 0.001051, -11.986043, -59.702248, 23.263165);
AddCameraShot(0.628546, -0.042609, -0.774831, -0.052525, 20.429928, -48.302277, 9.771714);
AddCameraShot(0.765213, -0.051873, 0.640215, 0.043400, 57.692474, -48.302277, 16.540724);
AddCameraShot(0.264032, -0.015285, -0.962782, -0.055734, -16.681797, -42.902290, 129.553268);
AddCameraShot(-0.382320, 0.022132, -0.922222, -0.053386, 20.670977, -42.902290, 135.513001);
end
Sorry, I know this must really tick you off.

EDIT: Never mind, figured it out.
Thanks a ton, Fris!

Re: Destroy Object when A Different Objects is Killed

Posted: Mon Aug 24, 2009 9:37 pm
by Frisbeetarian
Nah, if you learn something, I'm happy. I understand that it's hard to get in the habit of programming. If anything, the terminology can get you. For instance, a newline is the character that is inserted when you press the "Enter" key.

I was just telling you to delete the new line character, or, according to the name, remove the new line.

Code: Select all

OnObjectKill
(function(object, killer) 
Goes to

Code: Select all

OnObjectKill(function(object, killer) 
EDIT: Sigh, and the edit wins again.

Re: Destroy Object when A Different Objects is Killed

Posted: Tue Aug 25, 2009 5:03 pm
by Fierfek
Yeah, thanks.
I really never would have gotten this far without your help. Thanks! :bowdown:


EDIT
Sorry for double post, but I didn't want to make a new topic.

When my object is destroyed, the other objects don't go away.
Here is the script I have for it:
Hidden/Spoiler:
OnObjectKill(function(object, killer)
if GetEntityName(object) == "shield_panel" then
KillObject("rep_shield")
KillObject("rep_shield2")
KillObject("rep_shield3")
KillObject("rep_shield4")
DisableBarriers("shield1")
DisableBarriers("shield2")
DisableBarriers("shield3")
RespawnObject("cp2")
end
end)
What am I doing wrong?

Re: Destroy Object when A Different Objects is Killed

Posted: Tue Aug 25, 2009 5:47 pm
by Frisbeetarian
Are you saying that the shields don't go away?

Re: Destroy Object when A Different Objects is Killed

Posted: Tue Aug 25, 2009 5:49 pm
by Fierfek
Frisbeetarian wrote:Are you saying that the shields don't go away?
Correct.
In ZE, the object is called "shield_panel", and the shields are called "rep_shield", "rep_shield2", etc.
Did a manual clean, and munging now.

Re: Destroy Object when A Different Objects is Killed

Posted: Tue Aug 25, 2009 5:52 pm
by Frisbeetarian
Stick print("some random saying") as the first thing after the then. Clean, remunge, run the map, then post the error log.