Page 2 of 3

Re: AI Hero Support problem

Posted: Sat Jan 23, 2010 2:06 pm
by Coley
Naboo

Re: AI Hero Support problem

Posted: Sat Jan 23, 2010 2:09 pm
by Deviss
Coley wrote:Naboo
could you try with geonosis please? and if work, so of course the problem am i xD

Re: AI Hero Support problem

Posted: Sat Jan 23, 2010 2:21 pm
by Coley
I haven´t the time to do that next week :(
(german grammar, I know....)
Maybe later, but there ar other guys who can do that too, I am sure.
Probably I had mis-read something again, but here´s the readme, at the top you said you don´t have it.
Hidden/Spoiler:
-----------------------------------------------------------------------------------------------------

---------- Hero Support Script for StarWars: BattleFront 2 ----------
Version 1.2

Script by T. Simpson
Screen names: Archer01 or Theodranis
Email: [email protected]
Date: Sept 26, 2006

This script adds AI hero support to a custom or modded map.

Sample scripts have been included to show how it works. The Conquest sample has a bunch of comments explaining everything. The CTF version does not include the comments, so it is a better example of how your script should "look".

Good luck!

Sample scripts:
Example_con.lua -- Commented sample
Example_ctf.lua -- Uncommented sample
Display_Fix.lua -- Display fix sample (see below for details)



Note: Do NOT edit the AIHeroSupport script. Override variables from your own script if needed. If you find a bug, please inform me so that I may fix it.

-----------------------------------------------------------------------------------------------------

***Tutorial:

These are the steps you need to follow to add the script to your map...

*Setting up the script so your map lua can use it:

1- Go into the "\Common" folder for your map
2- Find the "mission.req" file and open it in a text/script editor
3- You should see a few lists of items each contained in quotaion marks
4- Find the list that begins with "script"
5- Add "AIHeroSupport" to the end of the script list
6- Save and close the file
7- Copy the "AIHeroSupport.lua" file into your map's "\Common\scripts" folder
8- The script can now be used in your map's lua

*Setting up your map's lua:

1- Open your map's lua file in text/script editor
2- You will see a bunch of "ScriptCB_DoFile(something here)" commands at the top
3- Add this just after them:

ScriptCB_DoFile("AIHeroSupport")

4- Now further down in the script find the line that says something like "conquest:Start()" or "ctf:Start()". Right after this line is where the hero support code should be added...
5- First add this line:

herosupport = AIHeroSupport:New{AIATTHeroHealth = 5000, AIDEFHeroHealth = 3000, gameMode = "NonConquest",}

- Note: The stuff in the curly braces are the different settings the script uses. It is a list of variables seperated by commas. All the variables you can set here have default settings, so if you don't set a variable yourself the default setting is used. See below for a list of the variable names and what they do. Variable names ARE case sensitive.

6- After adding that line, you then set your hero classes using:

herosupport:SetHeroClass(team, "heroClassName")

-Note: If you have more than 7 unit types (including the hero type) on a side, the info boxes for them will not be sized properly during gameplay (the list will go off the end of the screen). There is an easy fix for this. Finish the tutorial, then read the section below relating to this problem.

7- After setting the hero classes, you then need to tell the script the names of the CPs and spawn paths it should use for the heroes. Do that by adding a line like the following for every CP that you want the heroes to be able to spawn at:

herosupport:AddSpawnCP("CPname","SpawnPathNameForTheCP")

8- After all the CPs have been added, add this line:

herosupport:Start()

9- Now this is a VERY important part, the "SetHeroClass" function can only be used once for each team. If it is used a second time, nasty stuff will likely happen. Go through the script and remove all uses of the "SetHeroClass" function, except for the two you added earlier of course, so there won't be any problems. Your final script should have at most only two (2) mentions of "SetHeroClass". Don't forget about your text editor's search function when making sure this is so.

10- That's it. Munge your map, and try it out!

-----------------------------------------------------------------------------------------------------

***Unit List Display Issue

When more than 7 unit types are available for selection (ie more than the standard 6 normal and 1 hero), the display boxes in the spawn screen will not be sized correctly if the code block described above is left that way. There are a variety of ways to fix this, but the simplest (and most practical) is as follows:

1- Start with the first three (3) lines of the hero code block -> the "AIHeroSupport:New{}" and the two "herosupport:SetHeroClass()" lines.

2- Now simply CUT those three lines, and paste them at the very end of the "ScriptInit()" function. If you don't know where that spot is... It is just after the "AddCameraShot()" function calls, but just before the "end" statement at the bottom of the file (that "end" statement marks the end of the function). That will fix the display problem.

Note: Make sure you move ONLY those three lines. The "AddSpawnCP" and "Start" functions may not (and likely won't) work correctly if you move them too. Leave those lines where they are.

See the packaged sample script if you need an example.

-----------------------------------------------------------------------------------------------------

***Script Variable List:

Variable name: gameMode
- Possible values: (possible values below)
- Default = "NonConquest"
This should be set to the gameMode the map is using. It can be set to any of the following:

"Conquest" -- Uses the bot count from the Conquest map select settings
"ConquestStyle" -- Like Conquest, but ignores bot count settings
"UberConquest" -- Use this if it is a conquest map that uses UberMode
"CTF" -- Uses the bot count from the CTF map select settings
"Assault" -- Uses the bot count from the Assault map select settings
"Hunt" -- Uses the bot count from the Hunt map select settings
"xl" -- Uses this if it is an XL map that uses points
"NonConquest" -- Like any non-conquest, but ignores bot count settings

NOTE: For saftey sake, only use the conquest-related gamemodes if the map tracks/uses the reinforcement count. For maps that use team "points" use the other modes.


Variable name: AIATTHeroHealth
- Possible values: (a number)
- Default = the hero unit's normal health
The health the attacking team's bot hero should have (does not affect human hero's health). If this variable is not set, the hero's normal health is used.

Variable name: AIDEFHeroHealth
- Possible values: (a number)
- Default = the hero unit's normal health
Same, but for the defender's hero.

Variable name: minSpawnTime
- Possible values: (a number in seconds)
- Default = 25 seconds
The minmal delay between a bot Hero death and it's respawn. This is only the "minimum" amount of time. Usually the bot will spawn in just fine, but not every spawn attempt will end successfully. In the unsuccessful case (team full, unit memory not fully cleared, etc), it may take a little longer for the actual spawn to occur.

Variable name: initSpawnTime
- Possible values: (a number in seconds)
- Default = 10 seconds
This is like minSpawnTime but is only used once at the start of the match. This is how long from match-start before the first bot hero spawn attempt.

Variable name: minAfterHuman
- Possible values: (a number in seconds)
- Default = 25 seconds
This is like minSpawnTime but is used after a human controlled hero dies.

Variable name: botImmuneHeroes
- Possible values: (true or false)
- Default = false
Make it so the bot heroes can only be killed by a human player.

Variable name: botDamageThreshold
- Possible values: (a number between 0 and 1)
- Default = 0.3
If botImmuneHeroes is set to true, this is how much health the hero unit will have remaining before it stops taking damage from other bots. It is represented as a percentage (example: 0.3 == 30% health remaining).

Variable name: disableInNetGame
- Possible values: (true or false)
- Default = false
Disables the AI Hero Support aspect if it is a multiplayer match. When disabled this way, the AIHeroSupport script never starts.

-----------------------------------------------------------------------------------------------------

***Global Functions (can be used at any time):

Function name -> AIHeroSupport:New{}
Returns the hero support script object reference.


***Object Functions (functions that can be used anytime AFTER New{} is called):

Function name -> objectName:AddSpawnCP(cpName,pathName)
Adds the CP and associated spawn path data to the script's list.

Function name -> objectName:Start()
Starts the hero script. Only use this once.

Function name -> objectName:EnableHeroes(boolean)
Use true or false. Enables or disables the AI hero spawn for both teams.

Function name -> objectName:EnableHeroTeam(teamPtr,inVal)
Enables or disables the AI hero spawn for the specified team. Use true or false for inVal.


***Special case Object Functions (functions that can be used AFTER New{} is called):

Function name -> objectName:SetHeroClass(teamPtr,className)
Sets the hero class className for teamPtr and records necessary information needed to run the script.
NOTE: This has to be used BEFORE the "Start()" function call. It will not work correctly if used afterwards.

-----------------------------------------------------------------------------------------------------

Known glitches:
- The AI heroes will still spawn even when heroes are disabled in the game options. The human players will not be able to play as the heroes, but the hero unit will still be on the map as a bot. I'm not sure if this can be fixed... (I'm also not sure if I want this "fixed")



Known bugs (things like crashing, stuff that can cause problems with gameplay, etc):
- None that I know of.

-----------------------------------------------------------------------------------------------------

***Legal Stuff:
You are welcome to use this script in your custom made mods and maps so long as they are not being rented or sold. If you use this script, please credit me in the readme of the project you used it in. Do not claim this script as your own (it may not be much, but I did spend some time writing it after all). Do not edit this script. If you need to override any of the variables, please do so from your own script. I am not responsible for any damages that might be incurred through the use of this script.

THIS SCRIPT IS NOT MADE, DISTRIBUTED, OR SUPPORTED BY LUCASARTS, A DIVISION OF LUCASFILM ENTERTAINMENT COMPANY LTD.

-----------------------------------------------------------------------------------------------------




-----------------------------------------------------------------------------------------------------

***STUFF FOR ADVANCED SCRIPT-WRITERS ONLY:

*** VARIBALE LIST ***
***NOTE: It is very unlikely that you will need to change the following variables (so don't unless you know what you're doing)...

Variable name: cycleTime
- Possible values: (a number in seconds)
- Default = 10
How often the script looks for heroes on the map. When the cycleTime has passed, the script checks the units for hero status. If the script happened to not catch a human changing to a hero class (thus resulting in the AI hero never being removed), the AI hero will also be removed at this time. This check does a lot of "loop" work (may slow down a map if done too often). NOTE: This is just here as an extra option for flexability, I would suggest you leave this variable alone.

Variable name: netCycleTime
- Possible values: (a number in seconds)
- Default = 20
Same as the cycleTime but is used in multiplayer games. NOTE: Also just like cycleTime, this is just here as an extra option for flexability, I would suggest you leave this variable alone.

Variable name: enforceSingleHero
- Possible values: (true of false)
- Default = false
Considering the way I setup the script, this option is not really needed, but I decided to have it available "just in case". When enabled, this option makes the cycle test more comprehensive when looking for heroes on the map. Usually it will remove all bot controlled hero units except for one. If a hero is human controlled, it will remove all bot controlled heroes from the map. This check is executed as part of the "cycle test". The ONLY time this should be enabled is if you see more than one of the AI units using the hero at once, and on more than one occasion. This test does a lot of "loop" work so it might be a problem on slower computers.

*** FUNCTION LIST ***

Function name -> objectName:SetBotCount(number)
Overrides and sets the bot count to be used. This setting is applied to all teams (that's the way it works in the game).
!!! Note: The Start() function sets the bot count itself, so using this function before the script is started won't do anything. Also remember that the conquest, ctf, tdm, etc game scripts set the bot count themselves, so they too will override this function if it is used before them.


-----------------------------------------------------------------------------------------------------
And the example
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
-- Script modified by Archer01

-----------------
-- NOTE TO THE NOVICE SCRIPTER:
-- The double dash ("--") identifies a line as a 'comment', these lines are NOT script code
-- Comments just help people read this stuff more easily
--
-- To understand the use of the AIHeroSupport script, look for the comments that start with
-- "AIHEROSUPPORT NOTE:"
--
-- Also review the CTF script to see what the HeroSupport code looks like without the comments
-----------------

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

---------------------------------
-- AIHEROSUPPORT NOTE:
-- The following line preps the hero script for use
--------

ScriptCB_DoFile("AIHeroSupport")

---------------------------------

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

WookieTeam= 3

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

AddDeathRegion("deathregion")
AddDeathRegion("deathregion2")

EnableSPHeroRules()

--CP SETUP for CONQUEST

cp1 = CommandPost:New{name = "CP1CON"}
cp3 = CommandPost:New{name = "CP3CON"}
cp4 = CommandPost:New{name = "CP4CON"}
cp5 = CommandPost:New{name = "CP5CON"}

conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, textATT = "game.modes.con", textDEF = "game.modes.con2", multiplayerRules = true}

conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp5)

conquest.OnStart = function(self)
conquest.goal1 = AddAIGoal(REP, "Defend", 30, "gatepanel")
conquest.goal2 = AddAIGoal(CIS, "Destroy", 30, "gatepanel")
conquest.goal3 = AddAIGoal(CIS, "Destroy", 10, "woodl")
conquest.goal4 = AddAIGoal(CIS, "Destroy", 10, "woodc")
conquest.goal5 = AddAIGoal(CIS, "Destroy", 10, "woodr")
conquest.goal6 = AddAIGoal(REP, "Defend", 10, "woodl")
conquest.goal7 = AddAIGoal(REP, "Defend", 10, "woodc")
conquest.goal8 = AddAIGoal(REP, "Defend", 10, "woodr")
end

conquest:Start()

---------------------------------
-- AIHEROSUPPORT NOTE:
-- The following lines were added!
-----

herosupport = AIHeroSupport:New{AIATTHeroHealth = 2500, AIDEFHeroHealth = 3000, gameMode = "conquest",}
herosupport:SetHeroClass(REP, "rep_hero_yoda")
herosupport:SetHeroClass(CIS, "cis_hero_jangofett")
herosupport:AddSpawnCP("CP1CON","CP1CONPATH")
herosupport:AddSpawnCP("CP3CON","CP3CONPATH")
herosupport:AddSpawnCP("CP4CON","CP4CONPATH")
herosupport:AddSpawnCP("CP5CON","CP5CONPATH")
herosupport:Start()

---------------------------------

--Gate Stuff --
BlockPlanningGraphArcs("seawall1")
BlockPlanningGraphArcs("woodl")
BlockPlanningGraphArcs("woodc")
BlockPlanningGraphArcs("woodr")
DisableBarriers("disableme");

SetProperty("woodl", "MaxHealth", 15000)
SetProperty("woodl", "CurHealth", 15000)
SetProperty("woodr", "MaxHealth", 15000)
SetProperty("woodr", "CurHealth", 15000)
SetProperty("woodc", "MaxHealth", 15000)
SetProperty("woodc", "CurHealth", 15000)
SetProperty("gatepanel", "MaxHealth", 1000)
SetProperty("gatepanel", "CurHealth", 1000)


OnObjectKillName(PlayAnimDown, "gatepanel");
OnObjectRespawnName(PlayAnimUp, "gatepanel");
OnObjectKillName(woodl, "woodl");
OnObjectKillName(woodc, "woodc");
OnObjectKillName(woodr, "woodr");
OnObjectRespawnName(woodlr, "woodl");
OnObjectRespawnName(woodcr, "woodc");
OnObjectRespawnName(woodrr, "woodr");
end

function PlayAnimDown()
PauseAnimation("thegateup");
RewindAnimation("thegatedown");
PlayAnimation("thegatedown");
ShowMessageText("level.kas2.objectives.gateopen",1)
ScriptCB_SndPlaySound("KAS_obj_13")
SetProperty("gatepanel", "MaxHealth", 2200)
-- SetProperty("gatepanel", "CurHealth", 50000)
-- PlayAnimation("gatepanel");
--SetProperty("gatepanel", "MaxHealth", 1e+37)
--SetProperty("gatepanel", "CurHealth", 1e+37)


-- Allowing AI to run under gate
UnblockPlanningGraphArcs("seawall1");
DisableBarriers("seawalldoor1");
DisableBarriers("vehicleblocker");

end

function PlayAnimUp()
PauseAnimation("thegatedown");
RewindAnimation("thegateup");
PlayAnimation("thegateup");


-- Allowing AI to run under gate
BlockPlanningGraphArcs("seawall1");
EnableBarriers("seawalldoor1");
EnableBarriers("vehicleblocker");
SetProperty("gatepanel", "MaxHealth", 1000)
SetProperty("gatepanel", "CurHealth", 1000)

end

function woodl()
UnblockPlanningGraphArcs("woodl");
DisableBarriers("woodl");
SetProperty("woodl", "MaxHealth", 1800)
-- SetProperty("woodl", "CurHealth", 15)
end

function woodc()
UnblockPlanningGraphArcs("woodc");
DisableBarriers("woodc");
SetProperty("woodc", "MaxHealth", 1800)
-- SetProperty("woodc", "CurHealth", 15)
end

function woodr()
UnblockPlanningGraphArcs("woodr");
DisableBarriers("woodr");
SetProperty("woodr", "MaxHealth", 1800)
-- SetProperty("woodr", "CurHealth", 15)
end

function woodlr()
BlockPlanningGraphArcs("woodl")
EnableBarriers("woodl")
SetProperty("woodl", "MaxHealth", 15000)
SetProperty("woodl", "CurHealth", 15000)
end

function woodcr()
BlockPlanningGraphArcs("woodc")
EnableBarriers("woodc")
SetProperty("woodc", "MaxHealth", 15000)
SetProperty("woodc", "CurHealth", 15000)
end

function woodrr()
BlockPlanningGraphArcs("woodr")
EnableBarriers("woodr")
SetProperty("woodr", "MaxHealth", 15000)
SetProperty("woodr", "CurHealth", 15000)
end

function ScriptInit()
-- Designers, these two lines *MUST* be first!
StealArtistHeap(800 * 1024)
SetPS2ModelMemory(3535000)
ReadDataFile("ingame.lvl")


SetMaxFlyHeight(70)

ReadDataFile("sound\\kas.lvl;kas2cw")
ReadDataFile("SIDE\\rep.lvl",
"rep_inf_ep3_rifleman",
"rep_inf_ep3_rocketeer",
"rep_inf_ep3_sniper_felucia",
"rep_inf_ep3_engineer",
"rep_inf_ep3_jettrooper",
"rep_inf_ep3_officer",
"rep_hero_yoda",
"rep_hover_fightertank",
"rep_fly_cat_dome",
"rep_hover_barcspeeder")
ReadDataFile("SIDE\\cis.lvl",
"cis_tread_snailtank",
"cis_inf_rifleman",
-- "cis_fly_gunship_dome",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_hover_stap",
"cis_inf_officer",
-- "cis_walk_spider",
"cis_hero_jangofett",
"cis_inf_droideka")
ReadDataFile("SIDE\\wok.lvl",
"wok_inf_basic")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_beam",
"tur_bldg_recoilless_kas")

SetupTeams{

rep={
team = REP,
units = 29,
reinforcements = 150,
soldier = {"rep_inf_ep3_rifleman",10, 25},
assault = {"rep_inf_ep3_rocketeer",1, 4},
engineer = {"rep_inf_ep3_engineer",1, 4},
sniper = {"rep_inf_ep3_sniper_felucia",1, 4},
officer = {"rep_inf_ep3_officer",1, 4},
special = {"rep_inf_ep3_jettrooper",1, 4},


},

cis={
team = CIS,
units = 29,
reinforcements = 150,
soldier = {"cis_inf_rifleman",10, 25},
assault = {"cis_inf_rocketeer",1, 4},
engineer = {"cis_inf_engineer",1, 4},
sniper = {"cis_inf_sniper",1, 4},
officer = {"cis_inf_officer",1, 4},
special = {"cis_inf_droideka",1, 4},
}
}

---------------------------------
-- AIHEROSUPPORT NOTE:
-- The following lines were REMOVED
-- I just commented them out here, but you could/should delete them in your map's script
----------

--SetHeroClass(REP, "rep_hero_yoda")
--SetHeroClass(CIS, "cis_hero_jangofett")

---------------------------------

SetTeamName(3, "locals")
SetTeamIcon(3, "all_icon")
AddUnitClass(3, "wok_inf_warrior",2)
AddUnitClass(3, "wok_inf_rocketeer",2)
AddUnitClass(3, "wok_inf_mechanic",1)


SetUnitCount(3, 5)
AddAIGoal(WookieTeam, "Deathmatch", 100)
SetTeamAsFriend(ATT,3)
SetTeamAsFriend(3,ATT)
SetTeamAsEnemy(DEF,3)
SetTeamAsEnemy(3,DEF)

-- Level Stats
ClearWalkers()
AddWalkerType(0, 6) -- 4 droidekas (special case: 0 leg pairs)
AddWalkerType(1, 0) --
-- AddWalkerType(2, 2) -- 2 spider walkers with 2 leg pairs each
AddWalkerType(3, 0) -- 2 attes with 3 leg pairs each
local weaponCnt = 230
SetMemoryPoolSize("Aimer", 70)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 220)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityHover", 11)
SetMemoryPoolSize("EntityLight", 40)
SetMemoryPoolSize("EntityCloth", 58)
SetMemoryPoolSize("EntityFlyer", 6)
SetMemoryPoolSize("EntitySoundStream", 3)
SetMemoryPoolSize("EntitySoundStatic", 120)
SetMemoryPoolSize("MountedTurret", 15)
SetMemoryPoolSize("Navigator", 50)
SetMemoryPoolSize("Obstacle", 300)
SetMemoryPoolSize("PathFollower", 50)
SetMemoryPoolSize("PathNode", 512)
SetMemoryPoolSize("TentacleSimulator", 8)
SetMemoryPoolSize("TreeGridStack", 300)
SetMemoryPoolSize("UnitAgent", 50)
SetMemoryPoolSize("UnitController", 50)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("KAS\\kas2.lvl", "kas2_con")
SetDenseEnvironment("false")

SetMaxFlyHeight(65)
SetMaxPlayerFlyHeight(65)

-- Birdies
SetNumBirdTypes(1)
SetBirdType(0,1.0,"bird")

-- Fishies
SetNumFishTypes(1)
SetFishType(0,0.8,"fish")

-- Local Stats
--SetTeamName(3, "locals")
--SetTeamIcon(3, "all_icon")
--AddUnitClass(3, "wok_inf_warrior", 3)
--AddUnitClass(3, "wok_inf_rocketeer", 2)
--AddUnitClass(3, "wok_inf_mechanic", 2)
--SetUnitCount(3, 7)
--SetTeamAsEnemy(3,DEF)
--SetTeamAsFriend(3,ATT)

-- Sound

voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "wok_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)
AudioStreamAppendSegments("sound\\global.lvl", "wok_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\\kas.lvl", "kas")
OpenAudioStream("sound\\kas.lvl", "kas")

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)

SetAmbientMusic(REP, 1.0, "rep_kas_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_kas_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2,"rep_kas_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_kas_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_kas_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2,"cis_kas_amb_end", 2,1)

SetVictoryMusic(REP, "rep_kas_amb_victory")
SetDefeatMusic (REP, "rep_kas_amb_defeat")
SetVictoryMusic(CIS, "cis_kas_amb_victory")
SetDefeatMusic (CIS, "cis_kas_amb_defeat")

SetOutOfBoundsVoiceOver(1, "repleaving")
SetOutOfBoundsVoiceOver(2, "cisleaving")

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

SetAttackingTeam(ATT)


--Kas2 Docks
--Wide beach shot
AddCameraShot(0.977642, -0.052163, -0.203414, -0.010853, 66.539520, 21.864969, 168.598495);
AddCameraShot(0.969455, -0.011915, 0.244960, 0.003011, 219.552948, 21.864969, 177.675674);
AddCameraShot(0.995040, -0.013447, 0.098558, 0.001332, 133.571289, 16.216759, 121.571236);
AddCameraShot(0.350433, -0.049725, -0.925991, -0.131394, 30.085188, 32.105236, -105.325264);



-- GOOD SHOTS --
-- Gate to Right


--Kinda Cool --

AddCameraShot(0.163369, -0.029669, -0.970249, -0.176203, 85.474831, 47.313362, -156.345627);
AddCameraShot(0.091112, -0.011521, -0.987907, -0.124920, 97.554062, 53.690968, -179.347076);
AddCameraShot(0.964953, -0.059962, 0.254988, 0.015845, 246.471008, 20.362143, 153.701050);

-- OLD --

-- AddCameraShot(0.993669, -0.099610, -0.051708, -0.005183, 109.473549, 34.506077, 272.889221);
-- AddCameraShot(0.940831, -0.108255, -0.319013, -0.036707, -65.793930, 66.455177, 289.432678);


end

Re: AI Hero Support problem

Posted: Sun Jan 24, 2010 11:50 am
by Deviss
Coley wrote:I haven´t the time to do that next week :(
(german grammar, I know....)
Maybe later, but there ar other guys who can do that too, I am sure.
Probably I had mis-read something again, but here´s the readme, at the top you said you don´t have it.
i will try again with that, many thanks for your effort and support me :D notice soon

EDIT: don't work again :S now i tried with jabba's palace map here my mission lua
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("AIHeroSupport")

---------------------------------------------------------------------------
-- ScriptPostLoad
---------------------------------------------------------------------------
function ScriptPostLoad()
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp5 = CommandPost:New{name = "cp5"}

--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, textATT = "game.modes.con", textDEF = "game.modes.con2", multiplayerRules = true}

--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp5)

conquest:Start()

herosupport = AIHeroSupport:New{AIATTHeroHealth = 2500, AIDEFHeroHealth = 3000, gameMode = "conquest",}
herosupport:SetHeroClass(REP, "rep_hero_aalya")
herosupport:SetHeroClass(CIS, "cis_hero")
herosupport:AddSpawnCP("cp1","cp1spawn")
herosupport:AddSpawnCP("cp2","cp2spawn")
herosupport:AddSpawnCP("cp3","cp3spawn")
herosupport:AddSpawnCP("cp4","cp4spawn")
herosupport:AddSpawnCP("cp5","cp5spawn")
herosupport:Start()

EnableSPHeroRules()
end

---------------------------------------------------------------------------
-- ScriptInit
---------------------------------------------------------------------------
function ScriptInit()
StealArtistHeap(700*1024) -- steal from art heap

-- Designers, these two lines *MUST* be first!
SetPS2ModelMemory(4087000)
SetUberMode(1);
ReadDataFile("ingame.lvl")

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


-- Memory settings ---------------------------------------------------------------------
SetMemoryPoolSize("Combo::Condition", 100)
SetMemoryPoolSize("Combo::State", 160)
SetMemoryPoolSize("Combo::Transition", 100)
local weaponCnt = 500
SetMemoryPoolSize("ActiveRegion", 8)
SetMemoryPoolSize("Aimer", 500)
SetMemoryPoolSize("AmmoCounter", 500)
SetMemoryPoolSize("BaseHint", 500)
SetMemoryPoolSize("EnergyBar", 500)
SetMemoryPoolSize("EntityCloth", 200)
SetMemoryPoolSize("EntityFlyer", 6) -- to account for rocket upgrade
SetMemoryPoolSize("EntityLight", 141)
SetMemoryPoolSize("EntitySoundStatic", 3)
SetMemoryPoolSize("EntitySoundStream", 2)
SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 500)
SetMemoryPoolSize("MountedTurret", 1)
SetMemoryPoolSize("Navigator", 300)
SetMemoryPoolSize("Obstacle", 200)
SetMemoryPoolSize("PathNode", 200)
SetMemoryPoolSize("PathFollower", 300)
SetMemoryPoolSize("RedOmniLight", 146)
SetMemoryPoolSize("SoundSpaceRegion", 80)
SetMemoryPoolSize("SoldierAnimation", 900)
SetMemoryPoolSize("TentacleSimulator", 12)
SetMemoryPoolSize("TreeGridStack", 75)
SetMemoryPoolSize("UnitAgent", 300)
SetMemoryPoolSize("UnitController", 300)
SetMemoryPoolSize("Weapon", 500)
----------------------------------------------------------------------------------------


SetTeamAggressiveness(CIS, 1.00)
SetTeamAggressiveness(REP, 1.00)

ReadDataFile("sound\\tat.lvl;tat3cw")
ReadDataFile("dc:sound\\ABC.lvl;ABCcw")
ReadDataFile("SIDE\\rep.lvl",
"rep_hero_aalya")

ReadDataFile("dc:SIDE\\327th.lvl",
"rep_clon1",
"rep_clon2",
"rep_clon3",
"rep_clon4",
"rep_clon5",
"rep_clon6",
"rep_clon7",
"rep_clon8",
"rep_clon9")

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

---[[ Gamorrean Guards
ReadDataFile("SIDE\\gam.lvl",
"gam_inf_gamorreanguard")
SetTeamName(3, "locals")
AddUnitClass(3, "gam_inf_gamorreanguard",3)
SetUnitCount(3, 2)
SetTeamAsEnemy(3, ATT)
SetTeamAsEnemy(3, DEF)
SetTeamAsEnemy(ATT, 3)
SetTeamAsEnemy(DEF, 3)
AddAIGoal(3,"Deathmatch",100)
--]]

SetupTeams{
rep = {
team = REP,
units = 40,
reinforcements = 150,
soldier = { "rep_clon1",18, 20},
heavy = { "rep_clon2",3,4},
sniper = { "rep_clon3",3,4},
engineer = { "rep_clon4",3,4},
marine = { "rep_clon5",3,4},
recon = { "rep_clon6",3,4},
gunner = { "rep_clon7",3,4},
special = { "rep_clon8",3,4},
commando = { "rep_clon9",1,2},
},

cis = {
team = CIS,
units = 40,
reinforcements = 150,
soldier = { "cis_droid1",8, 20},
heavy = { "cis_droid2",3,4},
sniper = { "cis_droid3",3,4},
engineer = { "cis_droid4",3,4},
marine = { "cis_droid5",8,15},
recon = { "cis_droid6",3,4},
gunner = { "cis_droid7",3,4},
special = { "cis_droid9",2,3},
}
}


--SetHeroClass(CIS, "cis_hero")
--SetHeroClass(REP, "rep_hero_aalya")

SetSpawnDelay(10.0, 0.25)

-- Level Stats
ClearWalkers()
AddWalkerType(0, 5) -- Droidekas
AddWalkerType(1, 0)
AddWalkerType(2, 0)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("TAT\\tat3.lvl", "tat3_con")
SetDenseEnvironment("true")
--AddDeathRegion("Sarlac01")
SetMaxFlyHeight(90)
SetMaxPlayerFlyHeight(90)
AISnipeSuitabilityDist(30)

-- Sound Stats
voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "gam_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\\tat.lvl", "tat3")
OpenAudioStream("sound\\tat.lvl", "tat3")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\tat.lvl", "tat3_emt")
OpenAudioStream("dc:sound\\ABC.lvl", "ABC")
OpenAudioStream("dc:sound\\ABC.lvl", "ABC")

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_tat_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_tat_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2, "rep_tat_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_tat_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_tat_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2, "cis_tat_amb_end", 2,1)

SetVictoryMusic(REP, "rep_tat_amb_victory")
SetDefeatMusic (REP, "rep_tat_amb_defeat")
SetVictoryMusic(CIS, "cis_tat_amb_victory")
SetDefeatMusic (CIS, "cis_tat_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
--Tat 3 - Jabbas' Palace
AddCameraShot(0.685601, -0.253606, -0.639994, -0.236735, -65.939224, -0.176558, 127.400444)
AddCameraShot(0.786944, 0.050288, -0.613719, 0.039218, -80.626396, 1.175180, 133.205551)
AddCameraShot(0.997982, 0.061865, -0.014249, 0.000883, -65.227898, 1.322798, 123.976990)
AddCameraShot(-0.367869, -0.027819, -0.926815, 0.070087, -19.548307, -5.736280, 163.360519)
AddCameraShot(0.773980, -0.100127, -0.620077, -0.080217, -61.123989, -0.629283, 176.066025)
AddCameraShot(0.978189, 0.012077, 0.207350, -0.002560, -88.388947, 5.674968, 153.745255)
AddCameraShot(-0.144606, -0.010301, -0.986935, 0.070304, -106.872772, 2.066469, 102.783096)
AddCameraShot(0.926756, -0.228578, -0.289446, -0.071390, -60.819584, -2.117482, 96.400620)
AddCameraShot(0.873080, 0.134285, 0.463274, -0.071254, -52.071609, -8.430746, 67.122437)
AddCameraShot(0.773398, -0.022789, -0.633236, -0.018659, -32.738083, -7.379394, 81.508003)
AddCameraShot(0.090190, 0.005601, -0.993994, 0.061733, -15.379695, -9.939115, 72.110054)
AddCameraShot(0.971737, -0.118739, -0.202524, -0.024747, -16.591295, -1.371236, 147.933029)
AddCameraShot(0.894918, 0.098682, -0.432560, 0.047698, -20.577391, -10.683214, 128.752563)
end

Re: AI Hero Support problem

Posted: Mon Jan 25, 2010 11:31 am
by Coley
Call me stupid.
I have a few questions.

1. You should try it first with a less complicated lua?^^
Hidden/Spoiler:
ReadDataFile("SIDE\\rep.lvl",
"rep_hero_aalya")
?^^

ReadDataFile("dc:SIDE\\327th.lvl",
"rep_clon1",
"rep_clon2",
"rep_clon3",
"rep_clon4",
"rep_clon5",
"rep_clon6",
"rep_clon7",
"rep_clon8",
"rep_clon9")

ReadDataFile("dc:SIDE\\fed.lvl",
"cis_droid1",
"cis_droid2",
"cis_droid3",
"cis_droid4",
"cis_droid5",
"cis_droid6",
"cis_droid7",
"cis_droid9",
"cis_hero")
2. Is it just called cis_hero? (Can be, just wondering :) )

3. That´s definately wrong. You forgot to delete the 2nd SetHeroClass again.... :
Hidden/Spoiler:
--SetHeroClass(CIS, "cis_hero")
--SetHeroClass(REP, "rep_hero_aalya")
NO!
Just the first (new) one!
Hidden/Spoiler:
herosupport = AIHeroSupport:New{AIATTHeroHealth = 2500, AIDEFHeroHealth = 3000, gameMode = "conquest",}
herosupport:SetHeroClass(REP, "rep_hero_aalya")
herosupport:SetHeroClass(CIS, "cis_hero")

herosupport:AddSpawnCP("cp1","cp1spawn")
herosupport:AddSpawnCP("cp2","cp2spawn")
herosupport:AddSpawnCP("cp3","cp3spawn")
herosupport:AddSpawnCP("cp4","cp4spawn")
herosupport:AddSpawnCP("cp5","cp5spawn")
herosupport:Start()
4. And don´t know if it has to do with the fail, but in the tutorial is written gameMode = "NonConquest",}

Re: AI Hero Support problem

Posted: Mon Jan 25, 2010 12:00 pm
by Deviss
Coley wrote:Call me stupid.
I have a few questions.

1. You should try it first with a less complicated lua?^^
Hidden/Spoiler:
ReadDataFile("SIDE\\rep.lvl",
"rep_hero_aalya")
?^^

ReadDataFile("dc:SIDE\\327th.lvl",
"rep_clon1",
"rep_clon2",
"rep_clon3",
"rep_clon4",
"rep_clon5",
"rep_clon6",
"rep_clon7",
"rep_clon8",
"rep_clon9")

ReadDataFile("dc:SIDE\\fed.lvl",
"cis_droid1",
"cis_droid2",
"cis_droid3",
"cis_droid4",
"cis_droid5",
"cis_droid6",
"cis_droid7",
"cis_droid9",
"cis_hero")
2. Is it just called cis_hero? (Can be, just wondering :) )

3. That´s definately wrong. You forgot to delete the 2nd SetHeroClass again.... :
Hidden/Spoiler:
--SetHeroClass(CIS, "cis_hero")
--SetHeroClass(REP, "rep_hero_aalya")
NO!
Just the first (new) one!
Hidden/Spoiler:
herosupport = AIHeroSupport:New{AIATTHeroHealth = 2500, AIDEFHeroHealth = 3000, gameMode = "conquest",}
herosupport:SetHeroClass(REP, "rep_hero_aalya")
herosupport:SetHeroClass(CIS, "cis_hero")

herosupport:AddSpawnCP("cp1","cp1spawn")
herosupport:AddSpawnCP("cp2","cp2spawn")
herosupport:AddSpawnCP("cp3","cp3spawn")
herosupport:AddSpawnCP("cp4","cp4spawn")
herosupport:AddSpawnCP("cp5","cp5spawn")
herosupport:Start()
4. And don´t know if it has to do with the fail, but in the tutorial is written gameMode = "NonConquest",}
1. i know lol because i am using heroes from stock side :P

2. yes cis_hero (grievous)

3. i tried removing that lines also and with them or without, anyway i can't use hero eighter xD

4. yeah i tried putting conquest, nonconquest etc but anywa don't work xD

Re: AI Hero Support problem

Posted: Mon Jan 25, 2010 1:32 pm
by Coley
Errmmm...Last idea:
Where have you downloaded your "AIHerosupportscript" ?
You meant, there wasn´t a readme, so it probably wasn´t the regular one...

Re: AI Hero Support problem

Posted: Mon Jan 25, 2010 2:45 pm
by Deviss
Coley wrote:Errmmm...Last idea:
Where have you downloaded your "AIHerosupportscript" ?
You meant, there wasn´t a readme, so it probably wasn´t the regular one...
link you posted i used :P

Re: AI Hero Support problem

Posted: Mon Jan 25, 2010 2:46 pm
by Coley
I posted a link? mom...

EDIT
That was someone else^^
Okay, I don´t have any more ideas...

Re: AI Hero Support problem

Posted: Mon Jan 25, 2010 6:32 pm
by Deviss
Coley wrote:I posted a link? mom...

EDIT
That was someone else^^
Okay, I don´t have any more ideas...
mm me too XD, i tried with 5 maps moving thing per thing but anyway don't work, only work fine on toola frozen tundra but well always there is a first time for surrender :P

Re: AI Hero Support problem

Posted: Tue Jan 26, 2010 1:25 am
by lucasfart
so you're sure you put the aiherosupport script in you data_ABC/common/scripts??? not data_ABC/common/scripts/ABC?
DEVISS-REX wrote: 4. yeah i tried putting conquest, nonconquest etc but anywa don't work xD
also, like i said earlier try doing conquest with a capital "C", he says that case matters for the variables......

Re: AI Hero Support problem

Posted: Tue Jan 26, 2010 1:27 am
by Deviss
lucasfart wrote:so you're sure you put the aiherosupport script in you data_ABC/common/scripts??? not data_ABC/common/scripts/ABC?
yes i am sure if not, toola tundra musn't work no?xD anyway yes also i tried putting in both places

Re: AI Hero Support problem

Posted: Tue Jan 26, 2010 1:57 am
by lucasfart
lucasfart wrote:
DEVISS-REX wrote: 4. yeah i tried putting conquest, nonconquest etc but anywa don't work xD
also, like i said earlier try doing conquest with a capital "C", he says that case matters for the variables......
added this in after you posted so you might have missed it.....

Re: AI Hero Support problem

Posted: Tue Jan 26, 2010 10:53 am
by Deviss
lucasfart wrote:
lucasfart wrote:
DEVISS-REX wrote: 4. yeah i tried putting conquest, nonconquest etc but anywa don't work xD
also, like i said earlier try doing conquest with a capital "C", he says that case matters for the variables......
added this in after you posted so you might have missed it.....
i tried also because in my first try i used copy/paste from toola tundra mission lua :P

Re: AI Hero Support problem

Posted: Tue Jan 26, 2010 5:55 pm
by lucasfart
ah ok....i getcha :wink:

oh. and i know you're probably just testing it on stock maps, but Archer01 actually released a mod with his AIHeroSupport on all stock maps if thats what you're trying to do......

EDIT: Have you tried a manual clean? something mightn't've been munged properly....

Re: AI Hero Support problem

Posted: Tue Jan 26, 2010 6:44 pm
by Deviss
lucasfart wrote:ah ok....i getcha :wink:

oh. and i know you're probably just testing it on stock maps, but Archer01 actually released a mod with his AIHeroSupport on all stock maps if thats what you're trying to do......

EDIT: Have you tried a manual clean? something mightn't've been munged properly....
yeah i tried manual clean and cool where i can download that mod :D ?

Re: AI Hero Support problem

Posted: Tue Jan 26, 2010 11:05 pm
by lucasfart
DEVISS-REX wrote:
lucasfart wrote:ah ok....i getcha :wink:

oh. and i know you're probably just testing it on stock maps, but Archer01 actually released a mod with his AIHeroSupport on all stock maps if thats what you're trying to do......

EDIT: Have you tried a manual clean? something mightn't've been munged properly....
yeah i tried manual clean and cool where i can download that mod :D ?
http://starwarsbattlefront.filefront.co ... iMod;72415

i would say try deleting everything you added for the hero support (text and files) and just redoing EVERYTHING.......you never know, it might work

Re: AI Hero Support problem

Posted: Wed Jan 27, 2010 7:29 am
by [RDH]Zerted
I think your first script had too many units on the REP side. You really need to post your error log and the mission script that generated it if you want any help.

Re: AI Hero Support problem

Posted: Wed Jan 27, 2010 10:55 am
by Deviss
[RDH]Zerted wrote:I think your first script had too many units on the REP side. You really need to post your error log and the mission script that generated it if you want any help.
i believe side isn't the problem because so toola tundra musnt work XD
BFront2.txt

Re: AI Hero Support problem

Posted: Wed Jan 27, 2010 11:35 am
by [RDH]Zerted
First, fix your memory pools.

The main error is
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #1 to `SetHeroClass' (number expected, got nil)
stack traceback:
[C]: in function `SetHeroClass'
(none): in function `SetHeroClass'
(none): in function `ScriptPostLoad'
It says that the first parameter to the game's SetHeroClass function is nil. That function is called through the AI script's SetHeroClass, which is why it's in the error's stack trace twice. The first parameter is REP meaning REP is nil. It is nil because the team variables were moved into ScriptInit(). Move the following text back to the top of the script file:
-- Empire Attacking (attacker is always #1)
local REP = 1
local CIS = 2
-- These variables do not change
local ATT = 1
local DEF = 2