Page 1 of 1

How do I make a CP disapear?

Posted: Sat Aug 14, 2010 9:03 pm
by linksith
Hi, I'm not sure if this is possible but I would like to know. Say I have a space cruiser that I would like to have destroyed, and if all cruisers are destroyed the game will end. The only problem I can think of is having the cp's "disapear". Thanks for any help.

Re: How do I make a CP disapear?

Posted: Sun Aug 15, 2010 9:59 am
by fiddler_on_the_roof

Code: Select all

KillObject("cp1")
that will remove a cp (change cp1 to whatever yours is called). you just have to add a part about that happening after the ship is destroyed

Re: How do I make a CP disapear?

Posted: Sun Aug 15, 2010 5:37 pm
by linksith
Seeing the fact that I'm technically a beginner still, where does this code go?

Re: How do I make a CP disapear?

Posted: Sun Aug 15, 2010 6:01 pm
by Deviss
linksith wrote:Seeing the fact that I'm technically a beginner still, where does this code go?
here an example :D
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveTDM")

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

---------------------------------------------------------------------------
-- 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()
UnblockPlanningGraphArcs("Connection74")
DisableBarriers("1")

SetProperty("CP1", "Team", 1)
SetProperty("CP2", "Team", 0)
SetProperty("CP3", "Team", 0)
SetProperty("CP4", "Team", 0)
SetProperty("CP5", "Team", 2)
SetProperty("CP6", "Team", 0)
SetProperty("CP1", "CaptureRegion", "null")
SetProperty("CP2", "CaptureRegion", "null")
SetProperty("CP3", "CaptureRegion", "null")
SetProperty("CP4", "CaptureRegion", "null")
SetProperty("CP5", "CaptureRegion", "null")
SetProperty("CP6", "CaptureRegion", "null")
SetProperty("CP1", "HUDIndexDisplay", "")
SetProperty("CP2", "HUDIndexDisplay", "")
SetProperty("CP3", "HUDIndexDisplay", "")
SetProperty("CP4", "HUDIndexDisplay", "")
SetProperty("CP5", "HUDIndexDisplay", "")
SetProperty("CP6", "HUDIndexDisplay", "")

KillObject("CP2")
KillObject("CP3")
KillObject("CP4")
KillObject("CP6")

hunt = ObjectiveTDM:New{teamATT = 1, teamDEF = 2, pointsPerKillATT = 1, pointsPerKillDEF = 3, textATT = "game.modes.hunt", textDEF = "game.modes.hunt2", multiplayerRules = true}

hunt.OnStart = function(self)
AddAIGoal(ATT, "Deathmatch", 1000)
AddAIGoal(DEF, "Deathmatch", 1000)
end


hunt:Start()

PlayAnimRise()
DisableBarriers("BALCONEY")
DisableBarriers("bALCONEY2")
DisableBarriers("hallway_f")
DisableBarriers("hackdoor")
DisableBarriers("outside")

onfirstspawn = OnCharacterSpawn(
function(character)
if IsCharacterHuman(character) then
SetProperty(GetCharacterUnit(character), "AddHealth", 50)
end
end)


OnObjectRespawnName(PlayAnimRise, "DingDong");
OnObjectKillName(PlayAnimDrop, "DingDong");
EnableSPHeroRules()

end
--START BRIDGEWORK!

-- OPEN
function PlayAnimDrop()
PauseAnimation("lava_bridge_raise");
RewindAnimation("lava_bridge_drop");
PlayAnimation("lava_bridge_drop");

-- prevent the AI from running across it
BlockPlanningGraphArcs("Connection82");
BlockPlanningGraphArcs("Connection83");
EnableBarriers("Bridge");

end
-- CLOSE
function PlayAnimRise()
PauseAnimation("lava_bridge_drop");
RewindAnimation("lava_bridge_raise");
PlayAnimation("lava_bridge_raise");


-- allow the AI to run across it
UnblockPlanningGraphArcs("Connection82");
UnblockPlanningGraphArcs("Connection83");
DisableBarriers("Bridge");


end

function ScriptInit()
-- Designers, these two lines *MUST* be first!
SetPS2ModelMemory(3600000)

SetUberMode(1);
ReadDataFile("ingame.lvl")

SetTeamAggressiveness(REP, 0.95)
SetTeamAggressiveness(CIS, 0.95)
AISnipeSuitabilityDist(30)

SetMemoryPoolSize ("Combo",1000) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",1000) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",1000) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",1000) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",1000) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",6000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",1000) -- should be ~1x #combo
SetMemoryPoolSize ("ClothData",400)
SetMemoryPoolSize ("EntityCloth",400)
SetMemoryPoolSize ("Music", 200)

ReadDataFile("sound\\mus.lvl;mus1cw")
ReadDataFile("dc:sound\\ABC.lvl;ABCcw")
ReadDataFile("dc:sound\\mry.lvl;mrycw")
ReadDataFile("SIDE\\rep.lvl",
"rep_hero_anakin")

ReadDataFile("dc:SIDE\\Republic.lvl",
"Republic_1",
"Republic_2",
"Republic_3",
"Republic_4",
"Republic_5",
"Republic_6",
"Republic_7",
"Republic_8",
"Republic_9")

ReadDataFile("dc:SIDE\\65th.lvl",
"rep_65th_clon1",
"rep_65th_clon2",
"rep_65th_clon3",
"rep_65th_clon4",
"rep_65th_clon5",
"rep_65th_clon6",
"rep_65th_clon7",
"rep_65th_clon8",
"rep_65th_clon9")

ReadDataFile("dc:SIDE\\fed.lvl",
"cis_droid1",
"cis_droid2",
"cis_droid3",
"cis_droid4",
"cis_droid5",
"cis_droid6",
"cis_droid7",
"cis_droid8",
"cis_droid9")

ReadDataFile("dc:SIDE\\Neimoidian.lvl",
"cis_inf_Neimoidian1",
"cis_inf_Neimoidian2",
"cis_inf_Neimoidian3",
"cis_inf_Neimoidian4",
"cis_inf_Neimoidian5")

ReadDataFile("dc:SIDE\\CadBane.lvl",
"cis_hero_CadBane")

SetupTeams{
rep = {
team = REP,
units = 40,
reinforcements = -1,
soldier = { "rep_65th_clon1",18, 20},
pilot = { "rep_65th_clon2",3,4},
assault = { "rep_65th_clon3",3,4},
sniper = { "rep_65th_clon4",3,4},
marine = { "rep_65th_clon5",3,4},
engineer = { "rep_65th_clon6",3,4},
officer = { "rep_65th_clon7",3,4},
special = { "rep_65th_clon8",3,4},
commander = { "rep_65th_clon9",1,2},
},

cis = {
team = CIS,
units = 25,
reinforcements = -1,
soldier = { "cis_inf_Neimoidian1",10, 20},
pilot = { "cis_inf_Neimoidian2",3,4},
assault = { "cis_inf_Neimoidian3",3,4},
sniper = { "cis_inf_Neimoidian4",3,4},
marine = { "cis_inf_Neimoidian5",1,1},
}
}

SetTeamName(2, "Neimoidians")

SetHeroClass(REP, "rep_hero_anakin")
SetHeroClass(CIS, "cis_hero_CadBane")

-- Level Stats
ClearWalkers()
AddWalkerType(0, 9)
local weaponCnt = 1220
SetMemoryPoolSize("Aimer", 1024)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityHover", 9)
SetMemoryPoolSize("EntityFlyer", 9)
SetMemoryPoolSize("EntitySoundStream", 50)
SetMemoryPoolSize("EntitySoundStatic", 300)
SetMemoryPoolSize("FLEffectObject::Read", 500)
SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 1000)
SetMemoryPoolSize("CommandWalker", 9)
SetMemoryPoolSize("MountedTurret", 100)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("RedShadingState", 1024)
SetMemoryPoolSize("SoldierAnimation", 1024)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("mus\\mus1.lvl", "MUS1_CONQUEST")
SetDenseEnvironment("false")
SetMaxFlyHeight(90)
SetMaxPlayerFlyHeight(90)

-- Sound Stats

voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "all_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", "all_unit_vo_quick", voiceQuick)

OpenAudioStream("sound\\global.lvl", "cw_music")
OpenAudioStream("dc:sound\\ABC.lvl", "ABC_stream")
OpenAudioStream("sound\\mus.lvl", "mus1")
OpenAudioStream("sound\\mus.lvl", "mus1")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
-- OpenAudioStream("sound\\mus.lvl", "mus1_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)

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

SetOutOfBoundsVoiceOver(1, "Repleaving")
SetOutOfBoundsVoiceOver(2, "Cisleaving")

SetAmbientMusic(REP, 1.0, "rep_mus_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_mus_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2,"rep_mus_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_mus_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_mus_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2,"cis_mus_amb_end", 2,1)

SetVictoryMusic(REP, "rep_mus_amb_victory")
SetDefeatMusic (REP, "rep_mus_amb_defeat")
SetVictoryMusic(CIS, "cis_mus_amb_victory")
SetDefeatMusic (CIS, "cis_mus_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")

AddCameraShot(0.446393, -0.064402, -0.883371, -0.127445, -93.406929, 72.953865, -35.479401);

AddCameraShot(-0.297655, 0.057972, -0.935337, -0.182169, -2.384067, 71.165306, 18.453350);

AddCameraShot(0.972488, -0.098362, 0.210097, 0.021250, -42.577881, 69.453072, 4.454691);

AddCameraShot(0.951592, -0.190766, -0.236300, -0.047371, -44.607018, 77.906273, 113.228661);

AddCameraShot(0.841151, -0.105984, 0.526154, 0.066295, 109.567764, 77.906273, 7.873035);

AddCameraShot(0.818472, -0.025863, 0.573678, 0.018127, 125.781593, 61.423031, 9.809184);

AddCameraShot(-0.104764, 0.000163, -0.994496, -0.001550, -13.319855, 70.673264, 63.436607);

AddCameraShot(0.971739, 0.102058, 0.211692, -0.022233, -5.680069, 68.543945, 57.904160);

AddCameraShot(0.178437, 0.004624, -0.983610, 0.025488, -66.947433, 68.543945, 6.745875);

AddCameraShot(-0.400665, 0.076364, -0896894, -0.170941, 96.201210, 79.913033, -58.604382)
end