Page 1 of 1

Destructable force field issue

Posted: Sun May 01, 2011 3:45 am
by Marth8880
In my map, I'm trying to make it so a shield barrier disappears when I destroy a small generator. I'm using the small generator and collector shield from Mygeeto's campaign.

I sort of followed what was said in the second post of the second page of this thread but the shield disappears only when I destroy it manually instead of when I destroy its generator. Before this, however, I tried using the LinkedDestroyables function, but that did not work.

The shield's name is "Shield-command" in ZE and the generator's name is "PowerCell1".

PI2g_con.lua
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("LinkedDestroyables")
ScriptCB_DoFile("LinkedTurrets")

-- Empire Attacking (attacker is always #1)
local ALL = 1
local IMP = 2
-- These variables do not change
local ATT = 1
local DEF = 2

function ScriptPostLoad()

SetupDestroyables()
SetupTurrets()


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

OnObjectKill(function(object, killer)
if GetEntityName(object) == "PowerCell1" then
KillObject("Shield-command")
end
end

)

OnObjectRepair(function(object, repairer)
if GetEntityName(object) == "PowerCell1" then
RespawnObject("Shield-command")
end
end

)

end

function SetupDestroyables()
--IMP destroyables
turretLinkageIMP = LinkedDestroyables:New{ objectSets = {{"HiPwrTurret1", "HiPwrTurret2", "HothTurret1", "HothTurret2"}}, {"TurretMainframe1"}}
turretLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-command", "Shield-Room"}}, {"PowerCell1"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Power"}}, {"ShieldGen1"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Control"}}, {"ShieldTerminal2"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Mainframe"}}, {"Shields-Auxiliary"}}

end

function SetupTurrets()
--IMP turrets
turretLinkageIMP = LinkedTurrets:New{ team = IMP, mainframe = "TurretMainframe1",
turrets = {"HiPwrTurret1", "HiPwrTurret2", "HothTurret1", "HothTurret2"} }

turretLinkageIMP:Init()
function turretLinkageIMP:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.down", IMP)

BroadcastVoiceOver( "IOSMP_obj_21", IMP )
BroadcastVoiceOver( "AOSMP_obj_20", ALL )

end
function turretLinkageIMP:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.up", IMP)

BroadcastVoiceOver( "IOSMP_obj_23", IMP )
BroadcastVoiceOver( "AOSMP_obj_22", ALL )
end
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()

ReadDataFile("ingame.lvl")



SetMaxFlyHeight(40)
SetMaxPlayerFlyHeight(40)


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\\hot.lvl;hot1gcw")
ReadDataFile("SIDE\\all.lvl",
"all_inf_rifleman_snow",
"all_inf_rocketeer_snow",
"all_inf_sniper_snow",
"all_inf_engineer_snow",
"all_inf_officer_snow",
"all_inf_wookiee_snow",
"all_hero_chewbacca",
"imp_hover_speederbike",
"all_walk_tauntaun")

ReadDataFile("SIDE\\imp.lvl",
"imp_inf_rifleman_snow",
"imp_inf_rocketeer_snow",
"imp_inf_engineer_snow",
"imp_inf_sniper_snow",
"imp_inf_officer",
"imp_inf_dark_trooper",
"imp_hero_darthvader",
"imp_hover_speederbike",
"imp_walk_atst_snow")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_hipwrturret",
"tur_bldg_laser",
"tur_bldg_chaingun_roof",
"tur_bldg_hoth_lasermortar")

SetupTeams{
all = {
team = ALL,
units = 20,
reinforcements = 150,
soldier = { "all_inf_rifleman_snow",9, 25},
assault = { "all_inf_rocketeer_snow",1,4},
engineer = { "all_inf_engineer_snow",1,4},
sniper = { "all_inf_sniper_snow",1,4},
officer = { "all_inf_officer_snow",1,4},
special = { "all_inf_wookiee_snow",1,4},

},
imp = {
team = IMP,
units = 20,
reinforcements = 150,
soldier = { "imp_inf_rifleman_snow",9, 25},
assault = { "imp_inf_rocketeer_snow",1,4},
engineer = { "imp_inf_engineer_snow",1,4},
sniper = { "imp_inf_sniper_snow",1,4},
officer = { "imp_inf_officer",1,4},
special = { "imp_inf_dark_trooper",1,4},
},
}

SetHeroClass(ALL, "all_hero_chewbacca")
SetHeroClass(IMP, "imp_hero_darthvader")

-- Level Stats
ClearWalkers()
AddWalkerType(0, 0) -- special -> droidekas
AddWalkerType(1, 8) -- 4 atsts and tauntauns with 1 leg pair each
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("EntityRemoteTerminal", 24)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoldierAnimation", 304)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 128)
SetMemoryPoolSize("UnitController", 128)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("dc:PI2\\PI2.lvl", "PI2_conquest")
SetDenseEnvironment("false")


-- Sound Stats

voiceSlow = OpenAudioStream("sound\\global.lvl", "all_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "des_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "all_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_quick", voiceQuick)

OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\hot.lvl", "hot1gcw")
OpenAudioStream("sound\\hot.lvl", "hot1gcw")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(2, "Allleaving")
SetOutOfBoundsVoiceOver(1, "Impleaving")

SetAmbientMusic(ALL, 1.0, "all_hot_amb_start", 0,1)
SetAmbientMusic(ALL, 0.8, "all_hot_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.2, "all_hot_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_hot_amb_start", 0,1)
SetAmbientMusic(IMP, 0.8, "imp_hot_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.2, "imp_hot_amb_end", 2,1)

SetVictoryMusic(ALL, "all_hot_amb_victory")
SetDefeatMusic (ALL, "all_hot_amb_defeat")
SetVictoryMusic(IMP, "imp_hot_amb_victory")
SetDefeatMusic (IMP, "imp_hot_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")

-- Camera Stats
--Tat2 Mos Eisley
AddCameraShot(0.931925, -0.108715, 0.343641, 0.040088, -5.782282, 13.685349, 221.953949);
AddCameraShot(0.358358, -0.010894, -0.933090, -0.028365, -44.763466, 2.160791, 153.530457);
AddCameraShot(0.755659, -0.094642, 0.643067, 0.080541, 162.549301, 19.342003, 249.039520);
AddCameraShot(0.558064, -0.040028, -0.826708, -0.059298, -197.403259, 8.593826, 157.532486);
AddCameraShot(0.995680, -0.092814, 0.002568, 0.000239, -51.045925, 19.905941, 308.196655);
end
[/code][/size]
myg1_prop_energy_collector_shield.odf
Hidden/Spoiler:
[code][GameObjectClass]

ClassLabel = "destructablebuilding"
GeometryName = "myg1_prop_energy_collector_shield.msh"


[Properties]

GeometryName = "myg1_prop_energy_collector_shield"

//DestroyedGeometryName = "myg1_prop_energy_collector_shield"
ExplosionName = "com_inf_rechargedroid_exp"
MaxHealth = "4000"

BuildingSound = "force_field_lp"


FoleyFXGroup = "metal_foley"
[/code][/size]

Re: Destructable force field issue

Posted: Sun May 01, 2011 4:35 am
by AQT
I would use the function featured here.

First, remove the MaxHealth and ExplosionName parameter lines from the force shield's ODF; you won't be needing them. Second, in the function at the link above, replace objectBnameinZeroEditor with the name of your shield generator. And last, replace the PlayAnimation function with KillObject(""), where the name of your force shield goes in between the quotation marks.

Re: Destructable force field issue

Posted: Sun May 01, 2011 10:41 pm
by Marth8880
AQT wrote:I would use the function featured here.

First, remove the MaxHealth and ExplosionName parameter lines from the force shield's ODF; you won't be needing them. Second, in the function at the link above, replace objectBnameinZeroEditor with the name of your shield generator. And last, replace the PlayAnimation function with KillObject(""), where the name of your force shield goes in between the quotation marks.
Didn't work; here's my LUA:

PI2g_con.lua
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("LinkedDestroyables")
ScriptCB_DoFile("LinkedTurrets")

-- Empire Attacking (attacker is always #1)
local ALL = 1
local IMP = 2
-- These variables do not change
local ATT = 1
local DEF = 2

function ScriptPostLoad()

SetupDestroyables()
SetupTurrets()


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


animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "PowerCell1" then
KillObject("Shield-command")
end
end

)

end



function SetupDestroyables()
--IMP destroyables
turretLinkageIMP = LinkedDestroyables:New{ objectSets = {{"HiPwrTurret1", "HiPwrTurret2", "HothTurret1", "HothTurret2"}}, {"TurretMainframe1"}}
turretLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-command", "Shield-Room"}}, {"PowerCell1"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Power"}}, {"ShieldGen1"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Control"}}, {"ShieldTerminal2"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Mainframe"}}, {"Shields-Auxiliary"}}

end

function SetupTurrets()
--IMP turrets
turretLinkageIMP = LinkedTurrets:New{ team = IMP, mainframe = "TurretMainframe1",
turrets = {"HiPwrTurret1", "HiPwrTurret2", "HothTurret1", "HothTurret2"} }

turretLinkageIMP:Init()
function turretLinkageIMP:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.down", IMP)

BroadcastVoiceOver( "IOSMP_obj_21", IMP )
BroadcastVoiceOver( "AOSMP_obj_20", ALL )

end
function turretLinkageIMP:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.up", IMP)

BroadcastVoiceOver( "IOSMP_obj_23", IMP )
BroadcastVoiceOver( "AOSMP_obj_22", ALL )
end
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()

ReadDataFile("ingame.lvl")



SetMaxFlyHeight(40)
SetMaxPlayerFlyHeight(40)


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\\hot.lvl;hot1gcw")
ReadDataFile("SIDE\\all.lvl",
"all_inf_rifleman_snow",
"all_inf_rocketeer_snow",
"all_inf_sniper_snow",
"all_inf_engineer_snow",
"all_inf_officer_snow",
"all_inf_wookiee_snow",
"all_hero_chewbacca",
"imp_hover_speederbike",
"all_walk_tauntaun")

ReadDataFile("SIDE\\imp.lvl",
"imp_inf_rifleman_snow",
"imp_inf_rocketeer_snow",
"imp_inf_engineer_snow",
"imp_inf_sniper_snow",
"imp_inf_officer",
"imp_inf_dark_trooper",
"imp_hero_darthvader",
"imp_hover_speederbike",
"imp_walk_atst_snow")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_hipwrturret",
"tur_bldg_laser",
"tur_bldg_chaingun_roof",
"tur_bldg_hoth_lasermortar")

SetupTeams{
all = {
team = ALL,
units = 20,
reinforcements = 150,
soldier = { "all_inf_rifleman_snow",9, 25},
assault = { "all_inf_rocketeer_snow",1,4},
engineer = { "all_inf_engineer_snow",1,4},
sniper = { "all_inf_sniper_snow",1,4},
officer = { "all_inf_officer_snow",1,4},
special = { "all_inf_wookiee_snow",1,4},

},
imp = {
team = IMP,
units = 20,
reinforcements = 150,
soldier = { "imp_inf_rifleman_snow",9, 25},
assault = { "imp_inf_rocketeer_snow",1,4},
engineer = { "imp_inf_engineer_snow",1,4},
sniper = { "imp_inf_sniper_snow",1,4},
officer = { "imp_inf_officer",1,4},
special = { "imp_inf_dark_trooper",1,4},
},
}

SetHeroClass(ALL, "all_hero_chewbacca")
SetHeroClass(IMP, "imp_hero_darthvader")

-- Level Stats
ClearWalkers()
AddWalkerType(0, 0) -- special -> droidekas
AddWalkerType(1, 8) -- 4 atsts and tauntauns with 1 leg pair each
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("EntityRemoteTerminal", 24)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoldierAnimation", 304)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 128)
SetMemoryPoolSize("UnitController", 128)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("dc:PI2\\PI2.lvl", "PI2_conquest")
SetDenseEnvironment("false")


-- Sound Stats

voiceSlow = OpenAudioStream("sound\\global.lvl", "all_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "des_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "all_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_quick", voiceQuick)

OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\hot.lvl", "hot1gcw")
OpenAudioStream("sound\\hot.lvl", "hot1gcw")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(2, "Allleaving")
SetOutOfBoundsVoiceOver(1, "Impleaving")

SetAmbientMusic(ALL, 1.0, "all_hot_amb_start", 0,1)
SetAmbientMusic(ALL, 0.8, "all_hot_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.2, "all_hot_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_hot_amb_start", 0,1)
SetAmbientMusic(IMP, 0.8, "imp_hot_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.2, "imp_hot_amb_end", 2,1)

SetVictoryMusic(ALL, "all_hot_amb_victory")
SetDefeatMusic (ALL, "all_hot_amb_defeat")
SetVictoryMusic(IMP, "imp_hot_amb_victory")
SetDefeatMusic (IMP, "imp_hot_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")

-- Camera Stats
--Tat2 Mos Eisley
AddCameraShot(0.931925, -0.108715, 0.343641, 0.040088, -5.782282, 13.685349, 221.953949);
AddCameraShot(0.358358, -0.010894, -0.933090, -0.028365, -44.763466, 2.160791, 153.530457);
AddCameraShot(0.755659, -0.094642, 0.643067, 0.080541, 162.549301, 19.342003, 249.039520);
AddCameraShot(0.558064, -0.040028, -0.826708, -0.059298, -197.403259, 8.593826, 157.532486);
AddCameraShot(0.995680, -0.092814, 0.002568, 0.000239, -51.045925, 19.905941, 308.196655);
end
[/code][/size]
I get a crash immediately after the map starts to load if I place the function in between PostLoad and ScriptInit.
BFront2.log
Hidden/Spoiler:
[code]this.CurButton = nil
cur_button = nil
this.CurButton = Launch
cur_button = nil
(none):0: attempt to call global `OnObjectKill' (a nil value)
[/code][/size]
I'm so confused!

Re: Destructable force field issue

Posted: Mon May 02, 2011 12:03 am
by AQT
Please don't ever shadow bump your own topic again for no apparent reason.

You have an extra and unnecessary end here:
Hidden/Spoiler:
[quote] animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "PowerCell1" then
KillObject("Shield-command")
end
end

)

end[/quote]
And you're still going to leave the LinkedDestroyables function in your LUA?

Re: Destructable force field issue

Posted: Mon May 02, 2011 12:58 am
by Marth8880
AQT wrote:Please don't ever shadow bump your own topic again for no apparent reason.
Sorry! :(
AQT wrote:You have an extra and unnecessary end here:
Hidden/Spoiler:
[quote] animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "PowerCell1" then
KillObject("Shield-command")
end
end

)

end
[/quote]
The shield still does not disappear and now I get these:

PC_MungeLog.txt
Hidden/Spoiler:
[code]F:\BF2_ModTools\data_PI2\_BUILD\..\..\ToolsFL\Bin\luac.exe: ..\..\common\scripts\PI2\PI2g_con.lua:282: `end' expected (to close `function' at line 17) near `<eof>'
ERROR[scriptmunge scripts\PI2\PI2g_con.lua]:Could not read input file.ERROR[scriptmunge scripts\PI2\PI2g_con.lua]:Could not read input file. [continuing]
2 Errors 0 Warnings

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

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

ucft <--

2 Errors 0 Warnings
[/code][/size]
BFront2.log
Hidden/Spoiler:
[code]Opened logfile BFront2.log 2011-05-01 2153
shell_interface: Entered
shell_interface: gPlatformStr, gOnlineServiceStr, gLangStr, gLangEnum: PC GameSpy english 0
ifs_era_handler - Entered
ifs_era_handler - Exited
shell_interface: No custom_gc_0.lvl
shell_interface: No custom_gc_1.lvl
shell_interface: No custom_gc_2.lvl
shell_interface: No custom_gc_3.lvl
shell_interface: No custom_gc_4.lvl
shell_interface: No custom_gc_5.lvl
shell_interface: No custom_gc_6.lvl
shell_interface: No custom_gc_7.lvl
shell_interface: No custom_gc_8.lvl
shell_interface: No custom_gc_9.lvl
shell_interface: Found custom_gc_10.lvl
custom_gc_10: Entered
custom_gc_10: Found custom_gc_11.lvl
custom_gc_11: Entered
ifs_freeform_init_dt.lua
ifs_freeform_start_dt.lua
custom_gc_11: Taking control of custom_GetGCButtonList()...
custom_gc_11: Taking control of custom_PressedGCButton()...
custom_gc_11: Exited
custom_gc_10: No custom_gc_12.lvl. Will stop searching for any more cGC scripts.
custom_gc_10: Exited
custom_EraButtonList(): Finished building era button table Known eras buttons: 28
custom_GetGMapEras(): Finished building era table Known eras: 28
custom_GetGMapModes(): Finished building game mode table Known Modes: 39
custom_GetMPGameModeList(): Finished building game mode list table List Length: 40
custom_SetMovieLocation()
custom_gc_11: custom_GetGCButtonList(): Entered
custom_GetGCButtonList()
custom_gc_11: custom_GetGCButtonList(): Exited
custom_SetMovieLocation()
custom_GetFreeformBattleModeList(): Finished building freeform battle mode list Known Modes: 39
ingame stream movies\crawl.mvs
shell_interface: Opening movie: movies\shell.mvs
shell_interface: Leaving
Mission Checker: Entered addme
Mission Checker: addme: Now listening in on AddDownloadableContent() calls
Mission Checker: Exited addme
Found side\rvs.lvl. Adding BRO's extra KotOR missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding BRO's extra Dark Times missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\lead.lvl. Adding ETR's extra Dark Times missions
Cannot find ..\..\addon\BF1\data\_LVL_PC\SIDE\sen.lvl. Skipping ETR's extra Dark Times + Conversion Pack missions
prev = none iLastPage = nil
prev = texture iLastPage = 1
prev = texture iLastPage = 2
prev = texture iLastPage = 3
ifs_legal.Exit

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\GameMovie.cpp(399)
Unable to find open movie segment shell_main

ifs_saveop_DoOps LoadFileList
ifs_saveop_DoOps LoadFileList
ifs_saveop_DoOps LoadProfile
ifs_saveop_DoOps LoadProfile
ifs_sp_campaign: Input_Accept(): Entered: _tab_instant
missionlist_ExpandMapList()
ifs_missionselect_pcMulti_fnSetMapPreview(): Defaulting index to 1
Checkbox for check_era7 clicked
this.CurButton = check_era7
cur_button = nil
this.CurButton = check_mode1
cur_button = nil
this.CurButton = nil
cur_button = nil
DoubleClicked
custom_AddMapNew()
custom_printTable(): table: 060D0DC4
The key, value is: era_c 1
The key, value is: era_g 1
The key, value is: mode_con_c 1
The key is mapluafile, the formated value is: PI2<A>_<B>
The key, value is: mode_con_g 1
The key, value is: bSelected 1
The key, value is: isModLevel 1
custom_printTable(): Returning
custom_printTable(): table: 05CB6B4C
The key, value is: key mode_con
The key, value is: subst con
The key, value is: showstr modename.name.con
The key, value is: descstr modename.description.con
The key, value is: icon mode_icon_con
custom_printTable(): Returning
gMapEras.key = era_g Era = era_g subst = g
Adding map: PI2g_con idx: 1
this.CurButton = Launch
cur_button = nil

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\HUDElementBitmap.cpp(380)
HUD BitmapElement unable to find texture hud_target_hint_offscreen

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\HUDElementBitmap.cpp(380)
HUD BitmapElement unable to find texture hud_target_hint_offscreen

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\HUDElementBitmap.cpp(380)
HUD BitmapElement unable to find texture btn_directional_pad_LR
game_interface: Entered
utility_functions2: Listening on AddUnitClass() calls
utility_functions2: Listening on SetHeroClass() calls
utility_functions2: Listening on ReadDataFile() calls
game_interface: Reading in custom strings
game_interface: No user_script_0.lvl
game_interface: No user_script_1.lvl
game_interface: No user_script_2.lvl
game_interface: No user_script_3.lvl
game_interface: No user_script_4.lvl
game_interface: No user_script_5.lvl
game_interface: No user_script_6.lvl
game_interface: No user_script_7.lvl
game_interface: No user_script_8.lvl
game_interface: No user_script_9.lvl
game_interface: Found user_script_10.lvl
user_script_10: Entered
user_script_10: Replacing v1.3 (r117)'s AddUnitClass as it should've had a return value. This fixes the Leia bug.
user_script_10: No user_script_11.lvl. Will stop searching for any more user scripts.
user_script_10: Exited
ifs_sideselect_fnBuildScreen()
game_interface: Exited

Message Severity: 2
C:\Battlefront2\main\RedEngineFL\Memory\RedMemoryPool.cpp(317)
Memory pool "ClothData" set item count after being allocated

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityGeometry.cpp(1058)
Entity "com_weap_veh_guided_rocket_ord" unknown terrain collision "p_front_sphere"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityGeometry.cpp(1073)
Entity "com_weap_veh_guided_rocket_ord" unknown vehicle collision "p_front_sphere"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityGeometry.cpp(1065)
Entity "com_weap_veh_guided_rocket_ord" unknown building collision "p_front_sphere"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityGeometry.cpp(1051)
Entity "com_weap_veh_guided_rocket_ord" unknown targetable collision "CollisionMesh"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityGeometry.cpp(1058)
Entity "com_weap_award_rocket_launcher_" unknown terrain collision "p_front_sphere"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityGeometry.cpp(1073)
Entity "com_weap_award_rocket_launcher_" unknown vehicle collision "p_front_sphere"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityGeometry.cpp(1065)
Entity "com_weap_award_rocket_launcher_" unknown building collision "p_front_sphere"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityGeometry.cpp(1051)
Entity "com_weap_award_rocket_launcher_" unknown targetable collision "CollisionMesh"

Message Severity: 2
C:\Battlefront2\main\RedEngineFL\Graphics\PC\pcRedTexture.cpp(553)
Texture 'a295' [2dbb7264] uses 1.33 MB

Message Severity: 2
C:\Battlefront2\main\RedEngineFL\Graphics\PC\pcRedTexture.cpp(553)
Texture 'a295' [2dbb7264] uses 1.33 MB

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\VOHelper.cpp(183)
VOSound (all3_inf_pc_com_hostile_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\VOHelper.cpp(183)
VOSound (all3_inf_pc_com_bacta_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\VOHelper.cpp(183)
VOSound (all3_inf_pc_com_mechanic_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\VOHelper.cpp(183)
VOSound (all3_inf_pc_com_ammo_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\VOHelper.cpp(183)
VOSound (all3_inf_pc_com_transport_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\VOHelper.cpp(183)
VOSound (all3_inf_pc_com_backup_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\VOHelper.cpp(183)
VOSound (all3_inf_pc_com_clear_area_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\VOHelper.cpp(183)
VOSound (all3_inf_pc_com_defend_inVehicle): unknown modifier "InVehicle"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityGeometry.cpp(1065)
Entity "com_weap_inf_remotedroid_ord" unknown building collision "p_buildingsphere"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityGeometry.cpp(1073)
Entity "com_weap_inf_remotedroid_ord" unknown vehicle collision "p_buildingsphere"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityGeometry.cpp(1089)
Entity "com_weap_inf_remotedroid_ord" unknown ordnance collision "p_sphere"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityGeometry.cpp(1081)
Entity "com_weap_inf_remotedroid_ord" unknown soldier collision "p_sphere"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityWalker.cpp(4210)
Walker 'all_walk_tauntaun' skeleton does not contain FootBoneLeft 'bone_collision'!

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntityWalker.cpp(4219)
Walker 'all_walk_tauntaun' skeleton does not contain FootBoneLeft 'bone_collision1'!

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LoadUtil.cpp(829)
Unable to find level chunk imp_hover_speederbike in data\_lvl_pc\SIDE\all.lvl


Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LoadUtil.cpp(1019)
Unable to find level chunk in SIDE\all.lvl


Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\EntitySoldier.cpp(10471)
Soldier imp_inf_darktrooper has geometry collision

Message Severity: 2
C:\Battlefront2\main\RedEngineFL\Graphics\PC\pcRedTexture.cpp(553)
Texture 'e11s' [0f20e71f] uses 1.33 MB

Message Severity: 2
C:\Battlefront2\main\RedEngineFL\Graphics\PC\pcRedTexture.cpp(553)
Texture 'e11s' [0f20e71f] uses 1.33 MB

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LoadUtil.cpp(829)
Unable to find level chunk tur_bldg_hipwrturret in data\_lvl_pc\SIDE\tur.lvl


Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LoadUtil.cpp(1019)
Unable to find level chunk in SIDE\tur.lvl

uf_updateClassIndex(): Added class: all_inf_rifleman_snow
uf_updateClassIndex(): Added class: all_inf_rocketeer_snow
uf_updateClassIndex(): Added class: all_inf_sniper_snow
uf_updateClassIndex(): Added class: all_inf_engineer_snow
uf_updateClassIndex(): Added class: all_inf_officer_snow
uf_updateClassIndex(): Added class: all_inf_wookiee_snow
uf_updateClassIndex(): Added class: imp_inf_rifleman_snow
uf_updateClassIndex(): Added class: imp_inf_rocketeer_snow
uf_updateClassIndex(): Added class: imp_inf_sniper_snow
uf_updateClassIndex(): Added class: imp_inf_engineer_snow
uf_updateClassIndex(): Added class: imp_inf_officer
uf_updateClassIndex(): Added class: imp_inf_dark_trooper
uf_updateClassIndex(): Added class: all_hero_chewbacca
uf_updateClassIndex(): Added class: imp_hero_darthvader
utility_functions2: ReadDataFile(): This map's code, mode: pi2 pi2_conquest

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\SkyManager.cpp(108)
Skyfile NearSceneRange is in old format

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\SkyManager.cpp(122)
Skyfile FarSceneRange is in old format

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\StringDB.cpp(48)
ID=25a3ab99: trying to replace "myg1_prop_tbuster" with "myg1_prop_tbuster4"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\StringDB.cpp(48)
ID=27a3aebf: trying to replace "myg1_prop_tbuster" with "myg1_prop_tbuster2"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\FLEffect.cpp(463)
Attach: model '' [932f6b6b] has no hardpoint 'hp_fire' [b3ea0ee8]

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\StringDB.cpp(48)
ID=28a3b052: trying to replace "myg1_prop_tbuster" with "myg1_prop_tbuster1"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\StringDB.cpp(48)
ID=26a3ad2c: trying to replace "myg1_prop_tbuster" with "myg1_prop_tbuster3"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\GameObject.cpp(978)
Too many damage effects specified for gameobject [tan4_prop_Console]

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\GameObject.cpp(978)
Too many damage effects specified for gameobject [tan4_prop_Console]

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\AttachedEffects.cpp(143)
AttachEffects: effect 'prop_steampipe' not found

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\AttachedEffects.cpp(143)
AttachEffects: effect 'prop_steampipe' not found

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\AttachedEffects.cpp(143)
AttachEffects: effect 'prop_steampipe' not found

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\Weapon.cpp(82)
Weapon 'tur_weap_hipwrturret_laser' is not localized for stats page

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\CommandPost.cpp(476)
Label "level.PI2.cp2" not localized

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\CommandPost.cpp(476)
Label "level.PI2.cp3" not localized

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\CommandPost.cpp(476)
Label "level.PI2.cp1" not localized

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\FLEffect.cpp(427)
Attach: model '' [b92433ae] has no hardpoint '' [f1bb7ab7]

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\FLEffect.cpp(427)
Attach: model '' [b92433ae] has no hardpoint '' [f83941d9]

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\Weapon.cpp(82)
Weapon 'tur_weap_laser_auto' is not localized for stats page

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\FLEffect.cpp(427)
Attach: model '' [b92433ae] has no hardpoint '' [f1bb7ab7]

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\FLEffect.cpp(427)
Attach: model '' [b92433ae] has no hardpoint '' [f83941d9]

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\FLEffect.cpp(463)
Attach: model '' [f62b4f6f] has no hardpoint 'hp_light_3' [a19fd6cf]

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\StringDB.cpp(48)
ID=41470d8f: trying to replace "hoth_prop_command_console_a" with "hoth_prop_command_console_a1"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\FLEffect.cpp(463)
Attach: model '' [f62b4f6f] has no hardpoint 'hp_light_3' [a19fd6cf]

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\FLEffect.cpp(463)
Attach: model '' [31a68a09] has no hardpoint 'hp_light_6' [b65abda4]

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\FLEffect.cpp(463)
Attach: model '' [f62b4f6f] has no hardpoint 'hp_light_3' [a19fd6cf]

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\StringDB.cpp(48)
ID=cd4c6721: trying to replace "hoth_prop_command_console_c" with "hoth_prop_command_console_c1"

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\FLEffect.cpp(463)
Attach: model '' [31a68a09] has no hardpoint 'hp_light_6' [b65abda4]

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\FLEffect.cpp(463)
Attach: model '' [31a68a09] has no hardpoint 'hp_light_6' [b65abda4]
ifs_sideselect_fnEnter(): Map does not support custom era teams
ifs_sideselect_fnEnter(): The award settings file exists
ifs_sideselect_fnEnter(): Starting to remove award effects...
ifs_sideselect_fnEnter(): Finished removing award effects.
[/code][/size]

PI2g_con.lua
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("LinkedDestroyables")
ScriptCB_DoFile("LinkedTurrets")

-- Empire Attacking (attacker is always #1)
local ALL = 1
local IMP = 2
-- These variables do not change
local ATT = 1
local DEF = 2

function ScriptPostLoad()

SetupDestroyables()
SetupTurrets()


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


animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "PowerCell1" then
KillObject("Shield-command")
end
end

)




function SetupDestroyables()
--IMP destroyables
turretLinkageIMP = LinkedDestroyables:New{ objectSets = {{"HiPwrTurret1", "HiPwrTurret2"}}, {"TurretMainframe1"}}
turretLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-command", "Shield-Room"}}, {"PowerCell1"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Power"}}, {"ShieldGen1"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Control"}}, {"ShieldTerminal2"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Mainframe"}}, {"Shields-Auxiliary"}}

end

function SetupTurrets()
--IMP turrets
turretLinkageIMP = LinkedTurrets:New{ team = IMP, mainframe = "TurretMainframe1",
turrets = {"HiPwrTurret1", "HiPwrTurret2"} }

turretLinkageIMP:Init()
function turretLinkageIMP:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.down", IMP)

BroadcastVoiceOver( "IOSMP_obj_21", IMP )
BroadcastVoiceOver( "AOSMP_obj_20", ALL )

end
function turretLinkageIMP:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.up", IMP)

BroadcastVoiceOver( "IOSMP_obj_23", IMP )
BroadcastVoiceOver( "AOSMP_obj_22", ALL )
end
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()

ReadDataFile("ingame.lvl")



SetMaxFlyHeight(40)
SetMaxPlayerFlyHeight(40)


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\\hot.lvl;hot1gcw")
ReadDataFile("SIDE\\all.lvl",
"all_inf_rifleman_snow",
"all_inf_rocketeer_snow",
"all_inf_sniper_snow",
"all_inf_engineer_snow",
"all_inf_officer_snow",
"all_inf_wookiee_snow",
"all_hero_chewbacca",
"imp_hover_speederbike",
"all_walk_tauntaun")

ReadDataFile("SIDE\\imp.lvl",
"imp_inf_rifleman_snow",
"imp_inf_rocketeer_snow",
"imp_inf_engineer_snow",
"imp_inf_sniper_snow",
"imp_inf_officer",
"imp_inf_dark_trooper",
"imp_hero_darthvader",
"imp_hover_speederbike",
"imp_walk_atst_snow")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_hipwrturret",
"tur_bldg_laser",
"tur_bldg_chaingun_roof",
"tur_bldg_hoth_lasermortar")

SetupTeams{
all = {
team = ALL,
units = 20,
reinforcements = 150,
soldier = { "all_inf_rifleman_snow",9, 25},
assault = { "all_inf_rocketeer_snow",1,4},
engineer = { "all_inf_engineer_snow",1,4},
sniper = { "all_inf_sniper_snow",1,4},
officer = { "all_inf_officer_snow",1,4},
special = { "all_inf_wookiee_snow",1,4},

},
imp = {
team = IMP,
units = 20,
reinforcements = 150,
soldier = { "imp_inf_rifleman_snow",9, 25},
assault = { "imp_inf_rocketeer_snow",1,4},
engineer = { "imp_inf_engineer_snow",1,4},
sniper = { "imp_inf_sniper_snow",1,4},
officer = { "imp_inf_officer",1,4},
special = { "imp_inf_dark_trooper",1,4},
},
}

SetHeroClass(ALL, "all_hero_chewbacca")
SetHeroClass(IMP, "imp_hero_darthvader")

-- Level Stats
ClearWalkers()
AddWalkerType(0, 0) -- special -> droidekas
AddWalkerType(1, 8) -- 4 atsts and tauntauns with 1 leg pair each
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("EntityRemoteTerminal", 24)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoldierAnimation", 304)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 128)
SetMemoryPoolSize("UnitController", 128)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("dc:PI2\\PI2.lvl", "PI2_conquest")
SetDenseEnvironment("false")


-- Sound Stats

voiceSlow = OpenAudioStream("sound\\global.lvl", "all_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "des_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "all_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_quick", voiceQuick)

OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\hot.lvl", "hot1gcw")
OpenAudioStream("sound\\hot.lvl", "hot1gcw")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(2, "Allleaving")
SetOutOfBoundsVoiceOver(1, "Impleaving")

SetAmbientMusic(ALL, 1.0, "all_hot_amb_start", 0,1)
SetAmbientMusic(ALL, 0.8, "all_hot_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.2, "all_hot_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_hot_amb_start", 0,1)
SetAmbientMusic(IMP, 0.8, "imp_hot_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.2, "imp_hot_amb_end", 2,1)

SetVictoryMusic(ALL, "all_hot_amb_victory")
SetDefeatMusic (ALL, "all_hot_amb_defeat")
SetVictoryMusic(IMP, "imp_hot_amb_victory")
SetDefeatMusic (IMP, "imp_hot_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")

-- Camera Stats
--Tat2 Mos Eisley
AddCameraShot(0.931925, -0.108715, 0.343641, 0.040088, -5.782282, 13.685349, 221.953949);
AddCameraShot(0.358358, -0.010894, -0.933090, -0.028365, -44.763466, 2.160791, 153.530457);
AddCameraShot(0.755659, -0.094642, 0.643067, 0.080541, 162.549301, 19.342003, 249.039520);
AddCameraShot(0.558064, -0.040028, -0.826708, -0.059298, -197.403259, 8.593826, 157.532486);
AddCameraShot(0.995680, -0.092814, 0.002568, 0.000239, -51.045925, 19.905941, 308.196655);
end
[/code][/size]

Re: Destructable force field issue

Posted: Mon May 02, 2011 4:32 pm
by CalvaryCptMike
PI2g_con.lua
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("LinkedDestroyables")
ScriptCB_DoFile("LinkedTurrets")

-- Empire Attacking (attacker is always #1)
local ALL = 1
local IMP = 2
-- These variables do not change
local ATT = 1
local DEF = 2

function ScriptPostLoad()

SetupDestroyables()
SetupTurrets()


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


animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "PowerCell1" then
KillObject("Shield-command")
end
end

)




function SetupDestroyables()
--IMP destroyables
turretLinkageIMP = LinkedDestroyables:New{ objectSets = {{"HiPwrTurret1", "HiPwrTurret2"}}, {"TurretMainframe1"}}
turretLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-command", "Shield-Room"}}, {"PowerCell1"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Power"}}, {"ShieldGen1"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Control"}}, {"ShieldTerminal2"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Mainframe"}}, {"Shields-Auxiliary"}}

end

function SetupTurrets()
--IMP turrets
turretLinkageIMP = LinkedTurrets:New{ team = IMP, mainframe = "TurretMainframe1",
turrets = {"HiPwrTurret1", "HiPwrTurret2"} }

turretLinkageIMP:Init()
function turretLinkageIMP:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.down", IMP)

BroadcastVoiceOver( "IOSMP_obj_21", IMP )
BroadcastVoiceOver( "AOSMP_obj_20", ALL )

end
function turretLinkageIMP:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.up", IMP)

BroadcastVoiceOver( "IOSMP_obj_23", IMP )
BroadcastVoiceOver( "AOSMP_obj_22", ALL )
end
end

--YOU NEED TO ADD ANOTHER end HERE

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

ReadDataFile("ingame.lvl")



SetMaxFlyHeight(40)
SetMaxPlayerFlyHeight(40)


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\\hot.lvl;hot1gcw")
ReadDataFile("SIDE\\all.lvl",
"all_inf_rifleman_snow",
"all_inf_rocketeer_snow",
"all_inf_sniper_snow",
"all_inf_engineer_snow",
"all_inf_officer_snow",
"all_inf_wookiee_snow",
"all_hero_chewbacca",
"imp_hover_speederbike",
"all_walk_tauntaun")

ReadDataFile("SIDE\\imp.lvl",
"imp_inf_rifleman_snow",
"imp_inf_rocketeer_snow",
"imp_inf_engineer_snow",
"imp_inf_sniper_snow",
"imp_inf_officer",
"imp_inf_dark_trooper",
"imp_hero_darthvader",
"imp_hover_speederbike",
"imp_walk_atst_snow")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_hipwrturret",
"tur_bldg_laser",
"tur_bldg_chaingun_roof",
"tur_bldg_hoth_lasermortar")

SetupTeams{
all = {
team = ALL,
units = 20,
reinforcements = 150,
soldier = { "all_inf_rifleman_snow",9, 25},
assault = { "all_inf_rocketeer_snow",1,4},
engineer = { "all_inf_engineer_snow",1,4},
sniper = { "all_inf_sniper_snow",1,4},
officer = { "all_inf_officer_snow",1,4},
special = { "all_inf_wookiee_snow",1,4},

},
imp = {
team = IMP,
units = 20,
reinforcements = 150,
soldier = { "imp_inf_rifleman_snow",9, 25},
assault = { "imp_inf_rocketeer_snow",1,4},
engineer = { "imp_inf_engineer_snow",1,4},
sniper = { "imp_inf_sniper_snow",1,4},
officer = { "imp_inf_officer",1,4},
special = { "imp_inf_dark_trooper",1,4},
},
}

SetHeroClass(ALL, "all_hero_chewbacca")
SetHeroClass(IMP, "imp_hero_darthvader")

-- Level Stats
ClearWalkers()
AddWalkerType(0, 0) -- special -> droidekas
AddWalkerType(1, 8) -- 4 atsts and tauntauns with 1 leg pair each
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("EntityRemoteTerminal", 24)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoldierAnimation", 304)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 128)
SetMemoryPoolSize("UnitController", 128)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("dc:PI2\\PI2.lvl", "PI2_conquest")
SetDenseEnvironment("false")


-- Sound Stats

voiceSlow = OpenAudioStream("sound\\global.lvl", "all_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "des_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "all_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_quick", voiceQuick)

OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\hot.lvl", "hot1gcw")
OpenAudioStream("sound\\hot.lvl", "hot1gcw")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(2, "Allleaving")
SetOutOfBoundsVoiceOver(1, "Impleaving")

SetAmbientMusic(ALL, 1.0, "all_hot_amb_start", 0,1)
SetAmbientMusic(ALL, 0.8, "all_hot_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.2, "all_hot_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_hot_amb_start", 0,1)
SetAmbientMusic(IMP, 0.8, "imp_hot_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.2, "imp_hot_amb_end", 2,1)

SetVictoryMusic(ALL, "all_hot_amb_victory")
SetDefeatMusic (ALL, "all_hot_amb_defeat")
SetVictoryMusic(IMP, "imp_hot_amb_victory")
SetDefeatMusic (IMP, "imp_hot_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")

-- Camera Stats
--Tat2 Mos Eisley
AddCameraShot(0.931925, -0.108715, 0.343641, 0.040088, -5.782282, 13.685349, 221.953949);
AddCameraShot(0.358358, -0.010894, -0.933090, -0.028365, -44.763466, 2.160791, 153.530457);
AddCameraShot(0.755659, -0.094642, 0.643067, 0.080541, 162.549301, 19.342003, 249.039520);
AddCameraShot(0.558064, -0.040028, -0.826708, -0.059298, -197.403259, 8.593826, 157.532486);
AddCameraShot(0.995680, -0.092814, 0.002568, 0.000239, -51.045925, 19.905941, 308.196655);
end
There, see if that fixes it.

Re: Destructable force field issue

Posted: Mon May 02, 2011 7:38 pm
by Marth8880
Nope, all that did was get rid of all of the AI for some reason, even after a manual clean.

PI2g_con.lua
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("LinkedDestroyables")
ScriptCB_DoFile("LinkedTurrets")

-- Empire Attacking (attacker is always #1)
local ALL = 1
local IMP = 2
-- These variables do not change
local ATT = 1
local DEF = 2

function ScriptPostLoad()

SetupDestroyables()
SetupTurrets()


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


animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "PowerCell1" then
KillObject("Shield-command")
end
end

)


function SetupDestroyables()
--IMP destroyables
turretLinkageIMP = LinkedDestroyables:New{ objectSets = {{"HiPwrTurret1", "HiPwrTurret2"}}, {"TurretMainframe1"}}
turretLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-command", "Shield-Room"}}, {"PowerCell1"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Power"}}, {"ShieldGen1"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Control"}}, {"ShieldTerminal2"}}
shieldLinkageIMP:Init()

shieldLinkageIMP = LinkedDestroyables:New{ objectSets = {{"Shield-Mainframe"}}, {"Shields-Auxiliary"}}

end

function SetupTurrets()
--IMP turrets
turretLinkageIMP = LinkedTurrets:New{ team = IMP, mainframe = "TurretMainframe1",
turrets = {"HiPwrTurret1", "HiPwrTurret2"} }

turretLinkageIMP:Init()
function turretLinkageIMP:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.down", IMP)

BroadcastVoiceOver( "IOSMP_obj_21", IMP )
BroadcastVoiceOver( "AOSMP_obj_20", ALL )

end
function turretLinkageIMP:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.up", IMP)

BroadcastVoiceOver( "IOSMP_obj_23", IMP )
BroadcastVoiceOver( "AOSMP_obj_22", ALL )
end
end

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

ReadDataFile("ingame.lvl")



SetMaxFlyHeight(40)
SetMaxPlayerFlyHeight(40)


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\\hot.lvl;hot1gcw")
ReadDataFile("SIDE\\all.lvl",
"all_inf_rifleman_snow",
"all_inf_rocketeer_snow",
"all_inf_sniper_snow",
"all_inf_engineer_snow",
"all_inf_officer_snow",
"all_inf_wookiee_snow",
"all_hero_chewbacca",
"imp_hover_speederbike",
"all_walk_tauntaun")

ReadDataFile("SIDE\\imp.lvl",
"imp_inf_rifleman_snow",
"imp_inf_rocketeer_snow",
"imp_inf_engineer_snow",
"imp_inf_sniper_snow",
"imp_inf_officer",
"imp_inf_dark_trooper",
"imp_hero_darthvader",
"imp_hover_speederbike",
"imp_walk_atst_snow")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_hipwrturret",
"tur_bldg_laser",
"tur_bldg_chaingun_roof",
"tur_bldg_hoth_lasermortar")

SetupTeams{
all = {
team = ALL,
units = 20,
reinforcements = 150,
soldier = { "all_inf_rifleman_snow",9, 25},
assault = { "all_inf_rocketeer_snow",1,4},
engineer = { "all_inf_engineer_snow",1,4},
sniper = { "all_inf_sniper_snow",1,4},
officer = { "all_inf_officer_snow",1,4},
special = { "all_inf_wookiee_snow",1,4},

},
imp = {
team = IMP,
units = 20,
reinforcements = 150,
soldier = { "imp_inf_rifleman_snow",9, 25},
assault = { "imp_inf_rocketeer_snow",1,4},
engineer = { "imp_inf_engineer_snow",1,4},
sniper = { "imp_inf_sniper_snow",1,4},
officer = { "imp_inf_officer",1,4},
special = { "imp_inf_dark_trooper",1,4},
},
}

SetHeroClass(ALL, "all_hero_chewbacca")
SetHeroClass(IMP, "imp_hero_darthvader")

-- Level Stats
ClearWalkers()
AddWalkerType(0, 0) -- special -> droidekas
AddWalkerType(1, 8) -- 4 atsts and tauntauns with 1 leg pair each
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("EntityRemoteTerminal", 24)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoldierAnimation", 304)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 128)
SetMemoryPoolSize("UnitController", 128)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("dc:PI2\\PI2.lvl", "PI2_conquest")
SetDenseEnvironment("false")


-- Sound Stats

voiceSlow = OpenAudioStream("sound\\global.lvl", "all_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "des_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "all_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_quick", voiceQuick)

OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\hot.lvl", "hot1gcw")
OpenAudioStream("sound\\hot.lvl", "hot1gcw")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(2, "Allleaving")
SetOutOfBoundsVoiceOver(1, "Impleaving")

SetAmbientMusic(ALL, 1.0, "all_hot_amb_start", 0,1)
SetAmbientMusic(ALL, 0.8, "all_hot_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.2, "all_hot_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_hot_amb_start", 0,1)
SetAmbientMusic(IMP, 0.8, "imp_hot_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.2, "imp_hot_amb_end", 2,1)

SetVictoryMusic(ALL, "all_hot_amb_victory")
SetDefeatMusic (ALL, "all_hot_amb_defeat")
SetVictoryMusic(IMP, "imp_hot_amb_victory")
SetDefeatMusic (IMP, "imp_hot_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")

-- Camera Stats
--Tat2 Mos Eisley
AddCameraShot(0.931925, -0.108715, 0.343641, 0.040088, -5.782282, 13.685349, 221.953949);
AddCameraShot(0.358358, -0.010894, -0.933090, -0.028365, -44.763466, 2.160791, 153.530457);
AddCameraShot(0.755659, -0.094642, 0.643067, 0.080541, 162.549301, 19.342003, 249.039520);
AddCameraShot(0.558064, -0.040028, -0.826708, -0.059298, -197.403259, 8.593826, 157.532486);
AddCameraShot(0.995680, -0.092814, 0.002568, 0.000239, -51.045925, 19.905941, 308.196655);
end

Re: Destructable force field issue

Posted: Mon May 02, 2011 8:30 pm
by CalvaryCptMike
Hmmm, I had this problem when I used a command in the lua that wasn't supported by the game engine. Play the game with the modtools then crash it by pressing ALT+F4 at the same time and look at your log it should say something like:

Code: Select all

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to call field `read' (a nil value)
stack traceback:
	(none): in function `ScriptPostLoad'

ifs_sideselect_fnEnter(): Map does not support custom era teams
ifs_sideselect_fnEnter(): The award settings file does not exist
It's weird but just take out whatever it says CallProc failed: (none):0: attempt to call field '___'
whatever is in those quotation marks are not supported by the game.

The AI is gone because you're doing something wrong, the map works because you added that missing 'end'. It's not the problem so don't take it out.

Re: Destructable force field issue

Posted: Tue May 03, 2011 12:55 am
by Marth8880
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to call global `SetupDestroyables' (a nil value)
stack traceback:
(none): in function `ScriptPostLoad'

ifs_sideselect_fnEnter(): Map does not support custom era teams
ifs_sideselect_fnEnter(): The award settings file exists
ifs_sideselect_fnEnter(): Starting to remove award effects...
ifs_sideselect_fnEnter(): Finished removing award effects.
Oh...yeah.....

I guess I had better try removing the parts about shields then, since they probably do not exist.

Re: Destructable force field issue

Posted: Tue May 03, 2011 2:06 am
by CalvaryCptMike
Yeah, what it means is that the function "SetupDestroyables" has something bad in it and thus the function is corrupted. Try removing certain shields or check the names to match the odfs or ze names.