Jump to content

Re: Making the AI attack?


Mr.Caine
 Share

Recommended Posts

hmm, i edited the TacticalMultiplayerBuildLandUnitsGeneric.lua in landmode, is there anything i have to do to it to get the game to read it other than putting it in my mod folder in the correct place? Also does it matter which row you add the units to and i have no idea what the numbers at the end mean...

 

ie:

	,"Rebel_Speeder_Wing | Gallofree_HTT_Company | Rebel_MDU_Company = 0,1"

 

Sry I only tested the Space things till now...

I think the nuber is for the buildpriority.

Link to comment
Share on other sites

i think the number is to build between 0 and 1 or 0 and 3 of that unit cos for the barracks:

 

"Republic_Ground_Barracks | Separatists_Ground_Barracks = 1"

 

i think the space units counterpart file works the same, is the TacticalMultiplayerBuildSpaceUnitsGeneric.lua the only file u changed to get AI building space units?

Link to comment
Share on other sites

i think the number is to build between 0 and 1 or 0 and 3 of that unit cos for the barracks:

 

"Republic_Ground_Barracks | Separatists_Ground_Barracks = 1"

 

i think the space units counterpart file works the same, is the TacticalMultiplayerBuildSpaceUnitsGeneric.lua the only file u changed to get AI building space units?

 

I also changed "SpaceArtillery.lua" and "BuildStructureSpace.lua"

Link to comment
Share on other sites

I think this discussion is going places ! :) I have done some editing of my own on the scripts and will test them today. But thanks for sharing this information - I had no idea it would be necessary to edit those files to get the AI using and building new units and structures you add to the game.

http://i37.photobucket.com/albums/e99/drone_pilot/JC_Sig.jpg

 

Sote Mod Website @

 

http://sote-mod.com/forum/index.php?act=home

Link to comment
Share on other sites

OK I edited a good view Lua files I found and added new units to them, However what I noticed was this:

 

AI concentrates on building Space Bases first, and then Ground bases, I have not been able to get the AI yet to build any new space units. ( I use ship yards ) which I did add to the Lua files but they still don't seem to build them.

 

The other weird thing is the AI now has stopped altogether trying to corrupt planets :(

 

I might have to go back to the drawing board...

http://i37.photobucket.com/albums/e99/drone_pilot/JC_Sig.jpg

 

Sote Mod Website @

 

http://sote-mod.com/forum/index.php?act=home

Link to comment
Share on other sites

Think I am making some progress I got the AI to build a ship yard and a golan station in my mod. The AI doesn't seem to want to corrupt planets any more though when I am playing as the Empire. (Works still when playing as the Rebels)

http://i37.photobucket.com/albums/e99/drone_pilot/JC_Sig.jpg

 

Sote Mod Website @

 

http://sote-mod.com/forum/index.php?act=home

Link to comment
Share on other sites

Umm...

 

Upon further testing, I found that setting it to 1 makes all sides spam like the Consortium does. It's in my mod. Yeah, it's really tough as the CIS. You have to keep 'evacuating' planets and conquering others.

"I feel fantastic and I'm

Still Alive

and when you're dying I will be

Still Alive

and when you're dead I will be

Still Alive

STILL ALIVE"~GLaDOS

Anybody who thinks Palpatine is a sepratist knows NOTHING about star Wars

When in doubt- rocket it.

Dowload The Underworld's Might beta from Filefront!

Link to comment
Share on other sites

Have anybody tried edit PGAICommands.lua? I saw very interesting on change the weights of the units on one space attack because I do not see very realistic one bomber fighting with a fighter ignoring a capital ship or a starbase.

By the moment I did it.

require("PGCommands")

 

function Base_Definitions()

-- DebugMessage("%s -- In Base_Definitions", tostring(Script))

 

InSpaceConflict = false

MagicPlan = false

 

-- Scale all counter forces by this factor

MinContrastScale = 1.1

MaxContrastScale = 1.5

PerFailureContrastAdjust = 0.1

EnemyContrastTypes = {}

FriendlyContrastTypes = {}

ContrastTypeScale = {}

 

-- Track abilities that got cancelled (nebula or whatever) so we can turn them on later

lib_cancelled_abilities = {}

 

Common_Base_Definitions()

 

-- nil out the global Taskforce variables.

if TaskForce and type(TaskForce) == "table" then

for idx,tfdef in pairs(TaskForce) do

        if type(tfdef) == "table" and type(tfdef[1]) == "string" then

_G[tfdef[1]] = nil

end

end

end

 

if PlanDefinitionLoad then

Set_Contrast_Values()

end

 

PlanDefinitionLoad = nil

 

if Definitions then

Definitions()

end

end

 

function Set_Contrast_Values()

_e_cnt = 1;

 

EnemyContrastTypes[_e_cnt] = "Fighter"

FriendlyContrastTypeNames = {"AntiFighter", "Bomber", "Fighter", "Corvette", "Frigate", "Capital"}

FriendlyContrastWeights = {4.0, 0.25, 1.0, 1.0, 1.0, 1.0}

FriendlyContrastTypes[_e_cnt] = WeightedTypeList.Create()

FriendlyContrastTypes[_e_cnt].Parse(FriendlyContrastTypeNames, FriendlyContrastWeights)

_e_cnt = _e_cnt+1;

 

EnemyContrastTypes[_e_cnt] = "Bomber"

FriendlyContrastTypeNames = {"AntiBomber", "Frigate", "Capital", "Fighter", "Bomber", "Corvette"}

FriendlyContrastWeights = {4.0, 0.25, 0.25, 1.0, 1.0, 1.0}

FriendlyContrastTypes[_e_cnt] = WeightedTypeList.Create()

FriendlyContrastTypes[_e_cnt].Parse(FriendlyContrastTypeNames, FriendlyContrastWeights)

_e_cnt = _e_cnt+1;

 

EnemyContrastTypes[_e_cnt] = "Transport"

FriendlyContrastTypeNames = {"Fighter", "Bomber", "Corvette", "Frigate", "Capital", }

FriendlyContrastWeights = {1.0, 1.0, 1.0, 1.0, 1.0}

FriendlyContrastTypes[_e_cnt] = WeightedTypeList.Create()

FriendlyContrastTypes[_e_cnt].Parse(FriendlyContrastTypeNames, FriendlyContrastWeights)

_e_cnt = _e_cnt+1;

 

EnemyContrastTypes[_e_cnt] = "Corvette"

FriendlyContrastTypeNames = {"AntiCorvette", "Fighter", "Bomber", "Corvette", "Frigate", "Capital"}

FriendlyContrastWeights = {4.0, 0.25, 0.25, 1.0, 1.0, 1.0}

FriendlyContrastTypes[_e_cnt] = WeightedTypeList.Create()

FriendlyContrastTypes[_e_cnt].Parse(FriendlyContrastTypeNames, FriendlyContrastWeights)

_e_cnt = _e_cnt+1;

 

EnemyContrastTypes[_e_cnt] = "Frigate"

FriendlyContrastTypeNames = {"AntiFrigate", "Corvette", "Fighter", "Bomber", "Frigate", "Capital"}

FriendlyContrastWeights = {4.0, 0.25, 1.0, 1.0, 1.0, 1.0}

FriendlyContrastTypes[_e_cnt] = WeightedTypeList.Create()

FriendlyContrastTypes[_e_cnt].Parse(FriendlyContrastTypeNames, FriendlyContrastWeights)

_e_cnt = _e_cnt+1;

 

EnemyContrastTypes[_e_cnt] = "Capital"

FriendlyContrastTypeNames = {"AntiCapital", "Corvette", "Frigate", "Fighter", "Bomber", "Capital"}

FriendlyContrastWeights = {2.0, 0.25, 0.25, 1.0, 1.0, 1.0}

FriendlyContrastTypes[_e_cnt] = WeightedTypeList.Create()

FriendlyContrastTypes[_e_cnt].Parse(FriendlyContrastTypeNames, FriendlyContrastWeights)

_e_cnt = _e_cnt+1;

 

EnemyContrastTypes[_e_cnt] = "Infantry"

FriendlyContrastTypeNames = {"AntiInfantry", "Vehicle", "Infantry", "Air", "Structure", "LandHero"}

FriendlyContrastWeights = {4.0, 0.5, 1.0, 1.0, 1.0, 4.0}

FriendlyContrastTypes[_e_cnt] = WeightedTypeList.Create()

FriendlyContrastTypes[_e_cnt].Parse(FriendlyContrastTypeNames, FriendlyContrastWeights)

_e_cnt = _e_cnt+1;

 

EnemyContrastTypes[_e_cnt] = "Vehicle"

FriendlyContrastTypeNames = {"AntiVehicle", "Infantry", "Vehicle", "Air", "Structure", "LandHero"}

FriendlyContrastWeights = {4.0, 0.25, 1.0, 1.0, 1.0, 2.0}

FriendlyContrastTypes[_e_cnt] = WeightedTypeList.Create()

FriendlyContrastTypes[_e_cnt].Parse(FriendlyContrastTypeNames, FriendlyContrastWeights)

_e_cnt = _e_cnt+1;

 

EnemyContrastTypes[_e_cnt] = "Air"

FriendlyContrastTypeNames = {"AntiAir", "Infantry", "Vehicle", "Air", "Structure", "LandHero"}

FriendlyContrastWeights = {4.0, 1.0, 1.0, 1.0, 1.0, 1.0}

FriendlyContrastTypes[_e_cnt] = WeightedTypeList.Create()

FriendlyContrastTypes[_e_cnt].Parse(FriendlyContrastTypeNames, FriendlyContrastWeights)

_e_cnt = _e_cnt+1;

 

EnemyContrastTypes[_e_cnt] = "Structure"

FriendlyContrastTypeNames = {"AntiStructure", "Infantry", "Vehicle", "Air", "Structure", "LandHero"}

FriendlyContrastWeights = {4.0, 1.0, 1.0, 1.0, 1.0, 1.0}

FriendlyContrastTypes[_e_cnt] = WeightedTypeList.Create()

FriendlyContrastTypes[_e_cnt].Parse(FriendlyContrastTypeNames, FriendlyContrastWeights)

_e_cnt = _e_cnt+1;

 

EnemyContrastTypes[_e_cnt] = "LandHero"

FriendlyContrastTypeNames = {"Infantry", "Vehicle", "Air", "Structure", "LandHero"}

FriendlyContrastWeights =  {0.5, 0.5, 0.5, 0.25, 1.0}

FriendlyContrastTypes[_e_cnt] = WeightedTypeList.Create()

FriendlyContrastTypes[_e_cnt].Parse(FriendlyContrastTypeNames, FriendlyContrastWeights)

_e_cnt = _e_cnt+1;

 

end

And I have seen the changes on space battles. What do you think?

"Nada escapa a mis dominios".

Clan Nomada Web Site

FirefoxCCMods Web Site

(Only www.FirefoxCCMods.com is a English web site).

Link to comment
Share on other sites

hmm, my PGAICommands.lus isnt decompiled properly... is that the whole of it youve posted or is there more cos it sounds like it could have more stuff to reveal ...

 

in PGBaseDefinitions.lua there is this interesting block:

 

-- Remove all invalid or dead units from a list and return it.
function Cull_Unit_List(unit_list)
for k, unit in pairs(unit_list) do
	if not TestValid(unit) then
		unit_list[k] = nil
	end
end
return unit_list
end

 

which sounds a lot like it is referencing a unit_List, anybody know anything else concerning this?

Link to comment
Share on other sites

Hmm its all of the file except for the bit at the top of the file it should have

 

-- $Id: //depot/Projects/StarWars_Expansion/Run/Data/Scripts/Library/PGAICommands.lua#2 $

--/////////////////////////////////////////////////////////////////////////////////////////////////

--

-- © Petroglyph Games, Inc.

--

--

--  *****          **                          *                  *

--  *  **          *                          *                  *

--  *    *          *                          *                  *

--  *    *          *    *                *  *          *        *

--  *  *    *** ******  * **  ****      ***  * *      * *****    * ***

--  *  **    *  *  *    **  *  **  **  *  *  *    * **  **  **  *

--  ***    *****  *    *  *    *  *    *  *  *  **  *    *  *    *

--  *      *      *    *  *    *  *    *  *  *  *  *    *  *    *

--  *      *      *    *  *    *  *    *  *  * **  *  *    *    *

--  *      **      *    *  **  *  **  *  *    **    *  *    *  *

-- **        ****    **  *    ****    *****  *    **    ***      *  *

--                                          *        *    *

--                                          *        *    *

--                                          *      *      *

--                                      *  *        *      *

--                                      ****      *      *

--

--/////////////////////////////////////////////////////////////////////////////////////////////////

-- C O N F I D E N T I A L  S O U R C E  C O D E -- D O  N O T  D I S T R I B U T E

--/////////////////////////////////////////////////////////////////////////////////////////////////

--

--              $File: //depot/Projects/StarWars_Expansion/Run/Data/Scripts/Library/PGAICommands.lua $

--

--    Original Author: Brian Hayes

--

--            $Author: James_Yarrow $

--

--            $Change: 57990 $

--

--          $DateTime: 2006/11/13 17:33:10 $

--

--          $Revision: #2 $

--

--/////////////////////////////////////////////////////////////////////////////////////////////////

 

By the way I tested the file and it does seem to have a difference.

http://i37.photobucket.com/albums/e99/drone_pilot/JC_Sig.jpg

 

Sote Mod Website @

 

http://sote-mod.com/forum/index.php?act=home

Link to comment
Share on other sites

Wait which part did you set to all 1? The bottom with the turns and stuff? And how did you get the AI to build shipyards and Golans? I tried its almost impossible.
http://i10.photobucket.com/albums/a105/333Super/BESERKER.jpg
Link to comment
Share on other sites

@Mr Cain

 

took a bit of studying on other files I have from mods like SAU 3.0 so their mod gave me some clues how to get this done. The Rebel AI definitely built a Golan I defence station last night, and today most certainly must have built a Heavy ship yard.

 

OK, I edited these files:

 

BuildBaseComponentBarracks.lua

BuildBaseComponentLightVehicleFactory.lua

BuildBaseComponentOfficerAcademy.lua

BuildJammingStationPlan.lua

BuildScannerPlan.lua

BuildSpaceDefensiveStructurePlan.lua

BuildWeaponStructurePlan.lua

 

There was some other edits I did in the AI folder - but not sure if they are directly related to what changed the building behaviour of the game. However.. I notice now that the Rebel faction are more aggressive and fight you more - where as the ZC are now more like a lame duck and won't attack - where before my script changes they were always attacking with the corrupt planet abilities they have. Now when I play as the Empire - ZC don't bother to attack  :-\

 

On the other hand the Rebel Alliance are a good foe to play against now because before they weren't doing much. I seem to have tipped the game play some how so its more between the Alliance and Empire again. The ZC seem to a be a sleep more LOL..

 

BTW Mr. Cain if you like I will share the edited Lua files with you so you can study what I have done to them - maybe you can modify them for your own use in your mod then too. Just let me know :)

http://i37.photobucket.com/albums/e99/drone_pilot/JC_Sig.jpg

 

Sote Mod Website @

 

http://sote-mod.com/forum/index.php?act=home

Link to comment
Share on other sites

ive figured out why the AI will build new heros you add in skirmish but nothing else, its cos the AI have much less stopping them building units compared to heros, look at landheros.lua (in AI/LANDMODE/) The generic unit build counterpart is similar but has some stuff to stop them building if the AI is saving money. Also rather than including all landheros, the generic one lists all units, which seems a bit strange...
Link to comment
Share on other sites

theres this that makes the AI want to attack shield generators more:

 

	<Unit_Needs_To_Be_Disabled>
	Function_Allowed_As_Defender_Space.Evaluate
	*
	(1 - Function_Is_Space_Structure_Indestructable.Evaluate)
	*
	(
		4.0 * ((Variable_Target.Location.FriendlyForce - Variable_Target.Location.EnemyForce) > 0.0)
		+
		3.0 * (1.0 - Variable_Target.Location.EnemyForce)
		+
		3.0 * (Variable_Target.HardPointHealth {Parameter_Hard_Point_Type = HardPointType[Shield_Generator]} > 0.0)
		+
		2.0 * (Variable_Target.Shield > 0.66)
		+
		2.0 * Variable_Target.ForceNBTD
		+
		1.0 * Variable_Target.Health
	)
</Unit_Needs_To_Be_Disabled>

 

in offensivespaceequations.xml

Link to comment
Share on other sites

Editing TacticalMultiplayerBuildSpaceUnitsGeneric.lua AI build all the units on skirmiss mode.

-- $Id: //depot/Projects/StarWars/Run/Data/Scripts/AI/SpaceMode/TacticalMultiplayerBuildSpaceUnitsGeneric.lua#11 $

--/////////////////////////////////////////////////////////////////////////////////////////////////

--

-- © Petroglyph Games, Inc.

--

--

--  *****          **                          *                  *

--  *  **          *                          *                  *

--  *    *          *                          *                  *

--  *    *          *    *                *  *          *        *

--  *  *    *** ******  * **  ****      ***  * *      * *****    * ***

--  *  **    *  *  *    **  *  **  **  *  *  *    * **  **  **  *

--  ***    *****  *    *  *    *  *    *  *  *  **  *    *  *    *

--  *      *      *    *  *    *  *    *  *  *  *  *    *  *    *

--  *      *      *    *  *    *  *    *  *  * **  *  *    *    *

--  *      **      *    *  **  *  **  *  *    **    *  *    *  *

-- **        ****    **  *    ****    *****  *    **    ***      *  *

--                                          *        *    *

--                                          *        *    *

--                                          *      *      *

--                                      *  *        *      *

--                                      ****      *      *

--

--/////////////////////////////////////////////////////////////////////////////////////////////////

-- C O N F I D E N T I A L  S O U R C E  C O D E -- D O  N O T  D I S T R I B U T E

--/////////////////////////////////////////////////////////////////////////////////////////////////

--

--              $File: //depot/Projects/StarWars/Run/Data/Scripts/AI/SpaceMode/TacticalMultiplayerBuildSpaceUnitsGeneric.lua $

--

--    Original Author: James Yarrow

--

--            $Author: Steve_Copeland $

--

--            $Change: 34987 $

--

--          $DateTime: 2005/12/12 21:23:52 $

--

--          $Revision: #11 $

--

--/////////////////////////////////////////////////////////////////////////////////////////////////

 

require("pgevents")

 

 

function Definitions()

 

Category = "Tactical_Multiplayer_Build_Space_Units_Generic"

IgnoreTarget = true

TaskForce = {

{"ReserveForce"

,"RS_Level_Two_Starbase_Upgrade | RS_Level_Three_Starbase_Upgrade | RS_Level_Four_Starbase_Upgrade | RS_Level_Five_Starbase_Upgrade = 0,1"

,"ES_Level_Two_Starbase_Upgrade | ES_Level_Three_Starbase_Upgrade | ES_Level_Four_Starbase_Upgrade | ES_Level_Five_Starbase_Upgrade = 0,1"

,"Rebel_Carrier | Rebel_Dreadnought | Nebulon_B_Frigate | Nebulon_B2_Frigate | Alliance_Assault_Frigate | Light_Calamary_Cruiser | Carrack_Cruiser | Rebel_Strike_Cruiser | Calamari_Cruiser | Mc80a_Calamari_Cruiser | Home_One | Mc85_Calamari_Cruiser | Dauntless_Cruiser | Alliance_Assault_Frigate2 | Calamari_Cruiser_MC60 | Mc90_Cruiser | Mc104_Calamari_Cruiser | Liberator_Carrier | Mediator_Cruiser | Imperial_Escort_Carrier | Imperial_Dreadnought | Tartan_Patrol_Cruiser | IMP_Corellian_Corvette | Acclamator_Assault_Ship | Empire_Nebulon_B_Frigate | IMP_Carrack_Cruiser | Nebulon_B2E_Frigate | TIE_Scout_Squadron | Interdictor_Cruiser | Imperial_Lancer_Frigate | IMP_Modified_Corellian_Corvette | Victory_Destroyer | Imperial_Strike_Cruiser | Star_Destroyer | Allegiance_Destroyer | Dominator_Cruiser | VSD2 | ISD2 | SSD | Titan_Cruiser | Jedi_Cruiser_E | Jedi_Cruiser_R | Empire_Pirate_IPV | Rebel_Pirate_IPV | Empire_Pirate_Frigate | Rebel_Pirate_Frigate | Empire_Pirate_Munificent_Frigate | Empire_Recusant_Frigate | Empire_Pinance_Frigate | Empire_KDY_Frigate | Empire_Corona_Frigate | Empire_Leviathan_Dreadnought | Empire_Balrus | Corellian_Destroyer | Corellian_Heavy_Gunboat | Empire_Sacheen_Corvette | Empire_Pirate_ltCor_Frigate | Empire_Pirate_Cor_Frigate | Empire_Watchkeeper_Frigate | Empire_Battledragon | Providence_Cruiser | Venganza | Praetor_Super_Stardestroyer | Harrow_Destroyer | SOVEREIGN_SSD | Rebel_Bothan_Assaultcruiser | Rebel_Pirate_Munificent_Frigate | Rebel_Recusant_Frigate | Rebel_Pinance_Frigate | Rebel_KDY_Frigate | Rebel_Corona_Frigate | Rebel_Leviathan_Dreadnought | Rebel_Balrus | Rebel_Sacheen_Corvette | Rebel_Pirate_ltCor_Frigate | Rebel_Pirate_Cor_Frigate | Rebel_Watchkeeper_Frigate | Rebel_Battledragon | MC902_Calamari_Cruiser | RSD | MC_75 | Fleet_Com_Rebel_Team | Fleet_Com_Empire_Team | Boba_Fett_Team_Space_MP | Accuser_Star_Destroyer | Darth_Team_Space_MP | Home_One | Han_Solo_Team_Space_MP | Red_Squadron | Sundered_Heart = 0,3"}

}

RequiredCategories = {"Fighter | Bomber | Corvette | Frigate | Capital | SpaceHero"}

AllowFreeStoreUnits = false

 

end

 

function ReserveForce_Thread()

 

BlockOnCommand(ReserveForce.Produce_Force())

ReserveForce.Set_Plan_Result(true)

ReserveForce.Set_As_Goal_System_Removable(false)

 

-- Give some time to accumulate money.

tech_level = PlayerObject.Get_Tech_Level()

min_credits = 2000

if tech_level == 1 then

min_credits = 3000

elseif tech_level >= 2 then

min_credits = 4000

end

 

max_sleep_seconds = 80

current_sleep_seconds = 0

while (PlayerObject.Get_Credits() < min_credits) and (current_sleep_seconds < max_sleep_seconds) do

current_sleep_seconds = current_sleep_seconds + 1

Sleep(1)

end

 

ScriptExit()

end

"Nada escapa a mis dominios".

Clan Nomada Web Site

FirefoxCCMods Web Site

(Only www.FirefoxCCMods.com is a English web site).

Link to comment
Share on other sites

well if it does, then it must do it very slowly mate. I haven't seen the ZC build a single ship yard or Golan station during testing the mod I am working on yet. Only the rebels seem to be actively working at building things. THAT is only because I have edited the Lua files to add the stuff needed for the AI to know that they exist in the game. I think both me and Mr Cain noticed how difficult it was to get the AI to do this properly and effectively. I have the AI building things (space structures) for the rebels but as always the ZC seem like a lame duck.

http://i37.photobucket.com/albums/e99/drone_pilot/JC_Sig.jpg

 

Sote Mod Website @

 

http://sote-mod.com/forum/index.php?act=home

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

Copyright (c) 1999-2022 by SWRebellion Community - All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Star Wars(TM) is a registered trademark of LucasFilm, Ltd. We are not affiliated with LucasFilm or Walt Disney. This is a fan site and online gaming community (non-profit). Powered by Invision Community

×
×
  • Create New...