tactics
#1
Posted 26 October 2007 - 09:16 AM
I am trying to write a tactics file for a command squad I have put together (based on the impeial guard tactic file) but for some reason the tactic kills the ai :(
how do I reference the units within the tactic is it their ebps name? Also is there a special name for the ability suvh as from LOTW the shadowsword ability does that have a particular name/designation I just can't seem to get?
Also is there a way to get the ai to target buildings over troops with long range weaponry? at the moment my ai is firing the area effect weapon onto the front line killing its own troops (normally after dropping them into the comabt it follows with a bomb destroying all its own men.
any clues much appreciated. I imagine this is so self explanatory I just can't understand it :( (woods for the trees and all that)
Also a big thanks for all your work upto 2.5 makes the game much better
#2
Posted 28 October 2007 - 09:53 AM
how do I reference the units within the tactic is it their ebps name?
sbps
Also is there a special name for the ability suvh as from LOTW the shadowsword ability does that have a particular name/designation I just can't seem to get?
???
Also is there a way to get the ai to target buildings over troops with long range weaponry? at the moment my ai is firing the area effect weapon onto the front line killing its own troops (normally after dropping them into the comabt it follows with a bomb destroying all its own men.
No.
#4
Posted 28 October 2007 - 04:13 PM
per the logfile
RaceLoader: Init space_marine_race...
*ALERT: expected class to derive from or a newline
Lua Races/space_marine_race/Loader.ai Ln 42 (LoadRace)
Lua Races/RaceLoader.ai Ln 94 (?)
Lua Core/cpu_manager.ai Ln 348 (Initialize)
Lua DATA:AI/default.ai Ln 115 (InitializeAI)
main DATA:AI/default.ai Ln 133 ((null))
Error loading script file 'DATA:AI/default.ai' for race 'space_marine_race'!
Contents of marinecommandsquadtactic.ai
class 'marinecommandsquadtactic' (spacemarineInfantryTactic)
function command_squadTactic:__init( squad_ai ) super( squad_ai )
self:SetName("Leader Tactic")
end
function command_squadTactic:Reinforce()
-- Allow free reinforcing during harassing time
if (g_iGMT > DefendChokePointPlan.HarassingTime * 60) then
-- If there are no ressources available, don't upgrade!
if (not Tactic.Options.can_reinforce or not self:CanSpendMoney()) then
return
end
end
if (not self.squad_ai:IsReinforcing()) then
-- Try for different types of squad members
local apothcaryIndex = 0
local sergeantIndex = 1
local championIndex = 2
local bannerIndex = 3
-- Get current leader count
local numapothcarys = self.squad_ai:GetLeaderCount( apothcaryIndex )
local numsergeants = self.squad_ai:GetLeaderCount( sergeantIndex)
local numchampions = self.squad_ai:GetLeaderCount( championIndex )
local numbanners = self.squad_ai:GetLeaderCount( bannerIndex )
-- Desired number of each leader type
local desiredapothcarys = 1
local desiredsergeants = 1
local desiredchampions = 1
local desiredbanners = 1
-- Desired order of reinforcing
if (numsergeants < desiredsergeants) then
if self.squad_ai:CanReinforce( true, sergeantIndex ) then
self.squad_ai:DoReinforce( true, sergeantIndex )
end
elseif (numapothcarys < desiredapothcarys) then
if self.squad_ai:CanReinforce( true, apothcaryIndex ) then
self.squad_ai:DoReinforce( true, apothcaryIndex )
end
elseif (numbanners < desiredbanners) then
if self.squad_ai:CanReinforce( true, bannerIndex ) then
self.squad_ai:DoReinforce( true, bannerIndex )
end
elseif (numchampions < desiredchampions) then
if self.squad_ai:CanReinforce( true, championIndex ) then
self.squad_ai:DoReinforce( true, championIndex )
end
end
end
end
and finally contents of the loader.ai
----------------------------------------
-- File: 'smloader.ai'
-- Edited by Arkhan @ 23.10.2006
-- Renamed by Corsix @ 13.02.2006
-- Edited by Thudmeizer @ 14.10.2006
class 'space_marine_race'
-- Constructor
function space_marine_race:__init()
end
-- Returns the name of the race
function space_marine_race:GetRaceName()
return "space_marine_race"
end
-- This function is called if space marines are the race being played
function space_marine_race:LoadRace( eDifficulty )
-- Import strategies
import( 'Races/space_marine_race/Strategies/MarineBuildBaseStrategy.ai' )
-- Import strategy info
import( "Races/space_marine_race/Strategies/MarineStrategyInfo.ai" )
-- Import tactics
import( 'Races/space_marine_race/Tactics/SpaceMarineInfantryTactic.ai' )
import( 'Races/space_marine_race/Tactics/SpaceMarineVehicleTactic.ai' )
import( 'Races/space_marine_race/Tactics/LandRaiderTactic.ai' )
import( 'Races/space_marine_race/Tactics/RhinoTactic.ai' )
import( 'Races/space_marine_race/Tactics/ForceCommanderTactic.ai' )
import( 'Races/space_marine_race/Tactics/LibrarianTactic.ai' )
import( 'Races/space_marine_race/Tactics/ApothecaryTactic.ai' )
import( 'Races/space_marine_race/Tactics/ChaplainTactic.ai' )
import( 'Races/space_marine_race/Tactics/ServitorTactic.ai' )
import( 'Races/space_marine_race/Tactics/ScoutTactic.ai' )
import( 'Races/space_marine_race/Tactics/SkullProbeTactic.ai' )
import( 'Races/space_marine_race/Tactics/MarineBarracksTactic.ai' )
import( 'Races/space_marine_race/Tactics/OrbitalRelayTactic.ai' )
import( 'Races/space_marine_race/Tactics/marinecommandsquadtactic.ai' )
return true
end
-- This function is called even if space marines are not the race being played
function space_marine_race:LoadGlobalInfo()
-- Import info files
import( 'Races/space_marine_race/Info/marineunitstats.ai' )
-- Add space marine unit stats
table.insert(UnitStats, SpaceMarineUnitStats)
return true
end
-- Creates build base strategy
function space_marine_race:CreateBuildBaseStrategy()
return MarineBuildBaseStrategy(BuildBaseStrategyInfo)
end
-- Creates a special tactic for a space marine unit
function space_marine_race:CreateTactic(oSquadAI)
-- Get unit name and class
local sUnitName = oSquadAI:GetSquadName()
local eClass = oSquadAI:GetStats():GetClass()
-- Check if there is a special tactic for the unit available
if (sUnitName == "space_marine_squad_servitor") then
return ServitorTactic(oSquadAI)
elseif (sUnitName == "space_marine_squad_chaplain") then
return ChaplainTactic(oSquadAI)
elseif (sUnitName == "space_marine_squad_apothecary") then
return ApothecaryTactic(oSquadAI)
elseif (sUnitName == "space_marine_squad_librarian") then
return LibrarianTactic(oSquadAI)
elseif (sUnitName == "space_marine_squad_force_commander") then
return ForceCommanderTactic(oSquadAI)
elseif (sUnitName == "space_marine_squad_scout") then
return ScoutTactic(oSquadAI)
elseif (sUnitName == "space_marine_squad_skull_probe") then
return SkullProbeTactic(oSquadAI)
elseif (sUnitName == "space_marine_squad_land_raider") then
return LandRaiderTactic(oSquadAI)
elseif (sUnitName == "space_marine_squad_command_squad") then
return marinecommandsquadtactic(oSquadAI)
elseif (sUnitName == "space_marine_squad_rhino") then
return RhinoTactic(oSquadAI)
elseif (eClass == UnitStatsAI.UC_VehicleLow or eClass == UnitStatsAI.UC_VehicleMed or eClass == UnitStatsAI.UC_VehicleHigh) then
return SpaceMarineVehicleTactic(oSquadAI)
end
return SpaceMarineInfantryTactic(oSquadAI)
end
-- Creates a base tactic
function space_marine_race:CreateBaseTactic(oBuilding)
-- Get building name
local sBuildingName = oBuilding:GetBaseName()
-- Check if their is a special tactic for the building available
if (sBuildingName == "space_marine_barracks") then
return MarineBarracksTactic(oBuilding)
elseif (sBuildingName == "space_marine_orbital_relay") then
return OrbitalRelayTactic(oBuilding)
end
return nil
end
-- Returns a specific information
function space_marine_race:GetInfo(sType)
-- Check info type
if (sType == "TurretPower") then
return 300
elseif (sType == "SupportAllyFactor") then
return 9 / 4
elseif (sType == "AttackModifier") then
return -5
elseif (sType == "CriticalRangeIncreasePerTier") then
return 10
elseif (sType == "MinArmyStrengthPerTier") then
return 750
elseif (sType == "AttackRatio") then
return 4 / 5
elseif (sType == "RetreatRatio") then
return 3 / 5
elseif (sType == "InvisibleBuildings") then
return false
end
return nil
end
-- Returns the building type and threat
function space_marine_race:GetBuildingType(sBuildingName)
-- Return race specific object string
if (sBuildingName == "space_marine_hq") then
return "HQ", 0
elseif (sBuildingName == "space_marine_generator") then
return "Generator", 0
elseif (sBuildingName == "space_marine_thermo_generator") then
return "BiggerGenerator", 0
elseif (sBuildingName == "space_marine_vehicle_building") then
return "VehicleBuilding", 0
elseif (sBuildingName == "space_marine_armoury") then
return "Armoury", 0
elseif (sBuildingName == "space_marine_listening_post") then
return "ListeningPost", 0
elseif (sBuildingName == "space_marine_turret_bolter") then
return "Turret", 300
elseif (sBuildingName == "space_marine_mine_field") then
return "Mine", 150
end
return nil, 0
end
sorry for the very long post but I am so confused I have copied the IG command squad tactic and extracted the relevant bits. any help would once again be greatly appreciated.
#6
Posted 28 October 2007 - 09:12 PM
It appears from the log that it is a loading error rather then an error within the tactic itself (if only it would crash at that point it would be a start)
thanks for all your help
#7
Posted 28 October 2007 - 09:13 PM
AI cannot target specific squads -- its hardcoded and we've ask the Relic devs long before DarkCrusade to add that in. Why not make that area effect weapon an targettable ability that only works against enemy vehicles and/or buildings? Makes more sense, gameplay-wise.Also is there a way to get the ai to target buildings over troops with long range weaponry? at the moment my ai is firing the area effect weapon onto the front line killing its own troops (normally after dropping them into the comabt it follows with a bomb destroying all its own men.
What mod are you coding this for? With the help of the AI team, I've done no less than 10+ customized command squads for the AI to use. No issues whatsoever.
Dawn of War Advanced AI Headquarters
Latest DoW Advanced AI Download!
#8
Posted 28 October 2007 - 10:43 PM
I wanted to try and get the computer to drop the vortex missile within the lotw mod on our bases/whirlwinds rather then right after dropping its own men onto the front line thereby killing everyone including its own squads
must admit more fussed over my command squad as I copied the imp guard parts that I thought were relevant and the fact it doesn't work for me is really irritating. Even though i know i have missed something somewhere.
if there is an ai you have programmed in a mod i can look at that would be excellent
#9
Posted 29 October 2007 - 12:43 AM
Dawn of War Advanced AI Headquarters
Latest DoW Advanced AI Download!
Reply to this topic
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users