Scripting (Solved)
Posted: Mon Feb 23, 2009 4:37 pm
by MandeRek
Well, I'm making a script with 1 objective.. Which is kill Artel Darc (cis_hero_arteldarc)
Ingame, no pop-up screen, objective, artel darc, or geonosian at all!
Someone an idea? I think i'm starting to understand scripting, but i've missed an essential part for sure!
Ingame, no pop-up screen, objective, artel darc, or geonosian at all!
Someone an idea? I think i'm starting to understand scripting, but i've missed an essential part for sure!
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
-- load the gametype script
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("setup_teams")
-- REP Attacking (attacker is always #1)
REP = 1
CIS = 2
-- These variables do not change
ATT = 1
DEF = 2
function ScriptPostLoad()
ScriptCB_SetGameRules("campaign")-- Here you can see a script being used; The script to define the gameRules(of wich I don't really know what they do EXACTLY)
SetAIDifficulty(0, 0, "medium")-- I'd say this influences the dumbness of the A.I. to compensate for difficult maps.
DisableAIAutoBalance()--Help requested on explaining this
onfirstspawn = OnCharacterSpawn(
function(character)
if IsCharacterHuman(character) then
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
BeginObjectives()
end
end)
--This is the main objective: destroy Artel Darc
Objective1= ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF,
text = "level.zer.objectives.campaign.killartel", popupText = "level.zer.objectives.long.killartel"}
JediKiller = TargetType:New{classname = "cis_hero_arteldarc", killLimit = 1}
Objective1:AddTarget(JediKiller)
Objective1.OnStart = function(self)
AddAIGoal(ATT, "Deathmatch", 1000)
AddAIGoal(DEF, "Deathmatch", 1000)
SetClassProperty("cis_hero_arteldarc", "MaxHealth", "3300.0")
SetClassProperty("cis_hero_arteldarc", "AddHealth", "120.0")
MapAddEntityMarker("cis_hero_arteldarc", "hud_objective_icon", 3.0, ATT, "YELLOW", true, true, true)
end
Objective1.OnComplete = function(self)
ScriptCB_SndPlaySound("UTA_obj_34")
ShowMessageText("game.objectives.complete", ATT)
end
--That was the main objective.. I guess
SetProperty("CP1", "CaptureRegion", "no_region")
SetProperty("CP2", "CaptureRegion", "no_region")
SetProperty("CP3", "CaptureRegion", "no_region")
SetProperty("CP4", "CaptureRegion", "no_region")
SetProperty("CP5", "CaptureRegion", "no_region")
SetClassProperty("jed_master_01", "PointsToUnlock", 6)
SetClassProperty("cis_inf_droideka", "PointsToUnlock", 6)
end
function BeginObjectives()
--This creates the objective "container" and specifies order of objectives, and gets that running
-- objectiveSequence = MultiObjectiveContainer:New{}
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 4.5}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:Start()
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()
-- Designers, these two lines *MUST* be first.
SetPS2ModelMemory(4100000)
ReadDataFile("ingame.lvl")
ReadDataFile("dc:ingame.lvl")
ReadDataFile("dc:Load\\gna.lvl")
SetMemoryPoolSize("Music", 36)
SetTeamAggressiveness(CIS, 1.0)
SetTeamAggressiveness(REP, 1.0)
ReadDataFile("sound\\uta.lvl;uta1cw")
ReadDataFile("SIDE\\geo.lvl",
"gen_inf_geonosian")
ReadDataFile("dc:SIDE\\mher2.lvl",
"cis_hero_arteldarc")
ReadDataFile("SIDE\\cis.lvl",
"cis_inf_droideka")
ReadDataFile("SIDE\\jed.lvl",
"jed_knight_01",
"jed_master_01")
-- Level Stats
ClearWalkers()
SetMemoryPoolSize("EntityWalker", -1)
AddWalkerType(0, 3) -- 8 droidekas (special case: 0 leg pairs)
AddWalkerType(2, 2) -- 2 spider walkers with 2 leg pairs each
AddWalkerType(3, 2) -- 2 attes with 3 leg pairs each
SetMemoryPoolSize("Aimer", 70)
SetMemoryPoolSize("BaseHint", 200)
SetMemoryPoolSize("CommandWalker", 1)
SetMemoryPoolSize("EntityFlyer", 4)
SetMemoryPoolSize("EntityHover", 12)
SetMemoryPoolSize("EntityLight", 50)
SetMemoryPoolSize("MountedTurret", 12)
SetMemoryPoolSize("Obstacle", 338)
SetMemoryPoolSize("PathNode", 100)
SetSpawnDelay(10.0, 0.25)
SetupTeams{
rep = {
team = REP,
units = 32,
reinforcements = -1,
sniper = { "jed_knight_01",10},
engineer = { "jed_master_01",5},
},
cis = {
team = CIS,
units = 40,
reinforcements = -1,
soldier = { "geo_inf_geonosian",30},
engineer = { "cis_hero_arteldarc",8},
}
}
-- Attacker Stats
--SetUnitCount(ATT, 32)
--SetReinforcementCount(ATT, 250)
--teamATT = ConquestTeam:New{team = ATT}
--teamATT:AddBleedThreshold(21, 0.75)
--teamATT:AddBleedThreshold(11, 2.25)
--teamATT:AddBleedThreshold(1, 3.0)
--teamATT:Init()
--SetTeamAsEnemy(ATT,3)
-- Defender Stats
--SetUnitCount(DEF, 25)
--SetReinforcementCount(DEF, 250)
--teamDEF = ConquestTeam:New{team = DEF}
--teamDEF:AddBleedThreshold(21, 0.75)
--teamDEF:AddBleedThreshold(11, 2.25)
--teamDEF:AddBleedThreshold(1, 3.0)
--teamDEF:Init()
SetTeamAsFriend(DEF,3)
-- Local Stats
--SetTeamName(4, "locals")
--AddUnitClass(4, "rep_inf_jedimale",1)
--AddUnitClass(4, "rep_inf_jedimaleb",1)
--AddUnitClass(4, "rep_inf_jedimaley",1)
--SetUnitCount(4, 3)
--SetTeamAsFriend(4, ATT)
ReadDataFile("dc:GEA\\GEA.lvl", "GEA_conquest")
SetDenseEnvironment("false")
SetMinFlyHeight(-65)
SetMaxFlyHeight(50)
SetMaxPlayerFlyHeight(50)
-- Birdies
--SetNumBirdTypes(1)
--SetBirdType(0.0,10.0,"dragon")
--SetBirdFlockMinHeight(90.0)
-- Sound
voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)
voiceQuick = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_quick", voiceQuick)
OpenAudioStream("sound\\global.lvl", "cw_music")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\geo.lvl", "geo1cw")
OpenAudioStream("sound\\geo.lvl", "geo1cw")
-- SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
-- SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing", 1)
-- SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing", 1)
-- SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)
-- SetLowReinforcementsVoiceOver(REP, REP, "rep_off_defeat_im", .1, 1)
-- SetLowReinforcementsVoiceOver(REP, CIS, "rep_off_victory_im", .1, 1)
-- SetLowReinforcementsVoiceOver(CIS, CIS, "cis_off_defeat_im", .1, 1)
-- SetLowReinforcementsVoiceOver(CIS, REP, "cis_off_victory_im", .1, 1)
SetOutOfBoundsVoiceOver(1, "repleaving")
SetOutOfBoundsVoiceOver(2, "cisleaving")
SetAmbientMusic(REP, 1.0, "rep_geo_amb_hunt", 0,1)
-- SetAmbientMusic(REP, 0.99, "rep_GEO_amb_middle", 1,1)
-- SetAmbientMusic(REP, 0.1,"rep_GEO_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_geo_amb_hunt", 0,1)
-- SetAmbientMusic(CIS, 0.99, "cis_GEO_amb_middle", 1,1)
-- SetAmbientMusic(CIS, 0.1,"cis_GEO_amb_end", 2,1)
SetVictoryMusic(REP, "rep_geo_amb_victory")
SetDefeatMusic (REP, "rep_geo_amb_defeat")
SetVictoryMusic(CIS, "cis_geo_amb_victory")
SetDefeatMusic (CIS, "cis_geo_amb_defeat")
SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
--SetSoundEffect("WeaponUnableSelect", "com_weap_inf_weaponchange_null")
--SetSoundEffect("WeaponModeUnableSelect", "com_weap_inf_modechange_null")
SetSoundEffect("SpawnDisplayUnitChange", "shell_select_unit")
SetSoundEffect("SpawnDisplayUnitAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplayBack", "shell_menu_exit")
--ActivateBonus(CIS, "SNEAK_ATTACK")
--ActivateBonus(REP, "SNEAK_ATTACK")
SetAttackingTeam(ATT)
--OpeningSateliteShot
AddCameraShot(0.896930, -0.191575, -0.389725, -0.083241, -86.631836, 44.870083, 95.218506);
end
[/code]
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
-- load the gametype script
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("setup_teams")
-- REP Attacking (attacker is always #1)
REP = 1
CIS = 2
-- These variables do not change
ATT = 1
DEF = 2
function ScriptPostLoad()
ScriptCB_SetGameRules("campaign")-- Here you can see a script being used; The script to define the gameRules(of wich I don't really know what they do EXACTLY)
SetAIDifficulty(0, 0, "medium")-- I'd say this influences the dumbness of the A.I. to compensate for difficult maps.
DisableAIAutoBalance()--Help requested on explaining this
onfirstspawn = OnCharacterSpawn(
function(character)
if IsCharacterHuman(character) then
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
BeginObjectives()
end
end)
--This is the main objective: destroy Artel Darc
Objective1= ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF,
text = "level.zer.objectives.campaign.killartel", popupText = "level.zer.objectives.long.killartel"}
JediKiller = TargetType:New{classname = "cis_hero_arteldarc", killLimit = 1}
Objective1:AddTarget(JediKiller)
Objective1.OnStart = function(self)
AddAIGoal(ATT, "Deathmatch", 1000)
AddAIGoal(DEF, "Deathmatch", 1000)
SetClassProperty("cis_hero_arteldarc", "MaxHealth", "3300.0")
SetClassProperty("cis_hero_arteldarc", "AddHealth", "120.0")
MapAddEntityMarker("cis_hero_arteldarc", "hud_objective_icon", 3.0, ATT, "YELLOW", true, true, true)
end
Objective1.OnComplete = function(self)
ScriptCB_SndPlaySound("UTA_obj_34")
ShowMessageText("game.objectives.complete", ATT)
end
--That was the main objective.. I guess
SetProperty("CP1", "CaptureRegion", "no_region")
SetProperty("CP2", "CaptureRegion", "no_region")
SetProperty("CP3", "CaptureRegion", "no_region")
SetProperty("CP4", "CaptureRegion", "no_region")
SetProperty("CP5", "CaptureRegion", "no_region")
SetClassProperty("jed_master_01", "PointsToUnlock", 6)
SetClassProperty("cis_inf_droideka", "PointsToUnlock", 6)
end
function BeginObjectives()
--This creates the objective "container" and specifies order of objectives, and gets that running
-- objectiveSequence = MultiObjectiveContainer:New{}
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 4.5}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:Start()
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()
-- Designers, these two lines *MUST* be first.
SetPS2ModelMemory(4100000)
ReadDataFile("ingame.lvl")
ReadDataFile("dc:ingame.lvl")
ReadDataFile("dc:Load\\gna.lvl")
SetMemoryPoolSize("Music", 36)
SetTeamAggressiveness(CIS, 1.0)
SetTeamAggressiveness(REP, 1.0)
ReadDataFile("sound\\uta.lvl;uta1cw")
ReadDataFile("SIDE\\geo.lvl",
"gen_inf_geonosian")
ReadDataFile("dc:SIDE\\mher2.lvl",
"cis_hero_arteldarc")
ReadDataFile("SIDE\\cis.lvl",
"cis_inf_droideka")
ReadDataFile("SIDE\\jed.lvl",
"jed_knight_01",
"jed_master_01")
-- Level Stats
ClearWalkers()
SetMemoryPoolSize("EntityWalker", -1)
AddWalkerType(0, 3) -- 8 droidekas (special case: 0 leg pairs)
AddWalkerType(2, 2) -- 2 spider walkers with 2 leg pairs each
AddWalkerType(3, 2) -- 2 attes with 3 leg pairs each
SetMemoryPoolSize("Aimer", 70)
SetMemoryPoolSize("BaseHint", 200)
SetMemoryPoolSize("CommandWalker", 1)
SetMemoryPoolSize("EntityFlyer", 4)
SetMemoryPoolSize("EntityHover", 12)
SetMemoryPoolSize("EntityLight", 50)
SetMemoryPoolSize("MountedTurret", 12)
SetMemoryPoolSize("Obstacle", 338)
SetMemoryPoolSize("PathNode", 100)
SetSpawnDelay(10.0, 0.25)
SetupTeams{
rep = {
team = REP,
units = 32,
reinforcements = -1,
sniper = { "jed_knight_01",10},
engineer = { "jed_master_01",5},
},
cis = {
team = CIS,
units = 40,
reinforcements = -1,
soldier = { "geo_inf_geonosian",30},
engineer = { "cis_hero_arteldarc",8},
}
}
-- Attacker Stats
--SetUnitCount(ATT, 32)
--SetReinforcementCount(ATT, 250)
--teamATT = ConquestTeam:New{team = ATT}
--teamATT:AddBleedThreshold(21, 0.75)
--teamATT:AddBleedThreshold(11, 2.25)
--teamATT:AddBleedThreshold(1, 3.0)
--teamATT:Init()
--SetTeamAsEnemy(ATT,3)
-- Defender Stats
--SetUnitCount(DEF, 25)
--SetReinforcementCount(DEF, 250)
--teamDEF = ConquestTeam:New{team = DEF}
--teamDEF:AddBleedThreshold(21, 0.75)
--teamDEF:AddBleedThreshold(11, 2.25)
--teamDEF:AddBleedThreshold(1, 3.0)
--teamDEF:Init()
SetTeamAsFriend(DEF,3)
-- Local Stats
--SetTeamName(4, "locals")
--AddUnitClass(4, "rep_inf_jedimale",1)
--AddUnitClass(4, "rep_inf_jedimaleb",1)
--AddUnitClass(4, "rep_inf_jedimaley",1)
--SetUnitCount(4, 3)
--SetTeamAsFriend(4, ATT)
ReadDataFile("dc:GEA\\GEA.lvl", "GEA_conquest")
SetDenseEnvironment("false")
SetMinFlyHeight(-65)
SetMaxFlyHeight(50)
SetMaxPlayerFlyHeight(50)
-- Birdies
--SetNumBirdTypes(1)
--SetBirdType(0.0,10.0,"dragon")
--SetBirdFlockMinHeight(90.0)
-- Sound
voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)
voiceQuick = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_quick", voiceQuick)
OpenAudioStream("sound\\global.lvl", "cw_music")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\geo.lvl", "geo1cw")
OpenAudioStream("sound\\geo.lvl", "geo1cw")
-- SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
-- SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing", 1)
-- SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing", 1)
-- SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)
-- SetLowReinforcementsVoiceOver(REP, REP, "rep_off_defeat_im", .1, 1)
-- SetLowReinforcementsVoiceOver(REP, CIS, "rep_off_victory_im", .1, 1)
-- SetLowReinforcementsVoiceOver(CIS, CIS, "cis_off_defeat_im", .1, 1)
-- SetLowReinforcementsVoiceOver(CIS, REP, "cis_off_victory_im", .1, 1)
SetOutOfBoundsVoiceOver(1, "repleaving")
SetOutOfBoundsVoiceOver(2, "cisleaving")
SetAmbientMusic(REP, 1.0, "rep_geo_amb_hunt", 0,1)
-- SetAmbientMusic(REP, 0.99, "rep_GEO_amb_middle", 1,1)
-- SetAmbientMusic(REP, 0.1,"rep_GEO_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_geo_amb_hunt", 0,1)
-- SetAmbientMusic(CIS, 0.99, "cis_GEO_amb_middle", 1,1)
-- SetAmbientMusic(CIS, 0.1,"cis_GEO_amb_end", 2,1)
SetVictoryMusic(REP, "rep_geo_amb_victory")
SetDefeatMusic (REP, "rep_geo_amb_defeat")
SetVictoryMusic(CIS, "cis_geo_amb_victory")
SetDefeatMusic (CIS, "cis_geo_amb_defeat")
SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
--SetSoundEffect("WeaponUnableSelect", "com_weap_inf_weaponchange_null")
--SetSoundEffect("WeaponModeUnableSelect", "com_weap_inf_modechange_null")
SetSoundEffect("SpawnDisplayUnitChange", "shell_select_unit")
SetSoundEffect("SpawnDisplayUnitAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplayBack", "shell_menu_exit")
--ActivateBonus(CIS, "SNEAK_ATTACK")
--ActivateBonus(REP, "SNEAK_ATTACK")
SetAttackingTeam(ATT)
--OpeningSateliteShot
AddCameraShot(0.896930, -0.191575, -0.389725, -0.083241, -86.631836, 44.870083, 95.218506);
end
[/code]