Warhammer 40,000: Dawn of War - Soulstorm

Warhammer 40,000: Dawn of War - Soulstorm

Alastor Aug 25, 2017 @ 4:58pm
Are A.I. only battles a thing?
Is there any way that I can make a battle with only A.I. fighting im using the UA mod btw.
< >
Showing 1-14 of 14 comments
Gambit_DoW Aug 28, 2017 @ 11:05am 
You mean in order to WATCH matches among AI players only?
If so, then yes, it can be done.
Not only with UA, but any other mod.

1] First run the game in -dev mode.
2] Then, press "CTRL"+"SHIFT"+"~" (all 3 button appear at the far left of your keyboard). This will bring up the console.
3] Then, type: Cpu_ControlLocalPlayer()

This can be put into an autoexec, and called with the stroke of a button, but this will require some more work...


THE LONG ANSWER (here it gets technical)

Here is my autoexec.lua, for example:
-------------------------------------------------------------------------

screenmode = 0

function SS_ToggleModifierEvents (state)
t_ModifierList = { "builder_idle_event", "negative_cover_event_modifier", "cover_event_modifier", "morale_break_event" }
local j = World_GetPlayerCount()
for i = 1, j do
local player = World_GetPlayerAt (i-1)
for x = 1, table.getn (t_ModifierList) do
Modifier_Player_FX_Enable (player, t_ModifierList[x], state)
end
end
end

function toggle_screenmode ()
if (screenmode == 0) then
screenmode = 1
taskbar_hide ()
message_hide ()
if (ingame_stats_toggle ~= nil) then
ingame_stats_mouseover_toggle (false)
ingame_stats_toggle (false)
ingame_select_ui_toggle (false)
SS_ToggleModifierEvents (false)
end
else
screenmode = 0
taskbar_show ()
message_show ()
if (ingame_stats_toggle ~= nil) then
ingame_stats_mouseover_toggle (true)
ingame_stats_toggle (true)
ingame_select_ui_toggle (true)
SS_ToggleModifierEvents (true)
end
end
end

bind("shift+tab", "toggle_screenmode()")

bind("shift+F1","setsimrate(4)")
bind("shift+F2","setsimrate(8)")
bind("shift+F3","setsimrate(30)")
bind("shift+F4","setsimrate(100)")
bind("F5","switch_player_control()")
bind("F7","disableai()")
bind("F8","enableai()")
bind("F9","toggle_FOW()")

fowmode = 0
function toggle_FOW()
if fowmode == 0 then
FOW_RevealAll()
fowmode = 1
else
FOW_Reset()
fowmode = 0
end
end

function switch_player_control()
local player = World_GetPlayerAt(Tut_GetLocalPlayerIndex())
if Cpu_IsCpuPlayer(player) then
run = W40k_SwitchToPlayer( player, true )
else
run = Cpu_ControlLocalPlayer();
end
end

function disableai()
run = Cpu_EnableAll(false);
end

function enableai()
run = Cpu_EnableAll(true);
end

----------------------------------------------------------------------
You may find it complex, as I have coded some more goodies for my testings.
But if you copy it to notepad and save it under the name autoexec.lua (AND NOT AS A .TXT FILE), and then put it in to your SS folder and run the game in -dev,...
Everything will be automated.

Just try in-game to press the key binds:
bind("shift+F1","setsimrate(4)")
bind("shift+F2","setsimrate(8)")
bind("shift+F3","setsimrate(30)")
bind("shift+F4","setsimrate(100)")
bind("F5","switch_player_control()")
bind("F7","disableai()")
bind("F8","enableai()")
bind("F9","toggle_FOW()")
... and see what happens. :)

P.S.: Confusing, I know. If discouraged, just use my first suggestion with Cpu_ControlLocalPlayer(), and you will be OK.
Last edited by Gambit_DoW; Aug 28, 2017 @ 11:06am
Cebi May 23, 2018 @ 3:25am 
I use this technique but you say you use UA, do you find that the Player 1 AI is usually FAR worse than the other AI's in that mod? It feels like they use two different AI scripts. Wondering if anyone has experienced this and if there is a solution. The Player 1 AI gets trashed on every single time.
Gambit_DoW May 23, 2018 @ 4:20am 
Hello brother Cebi.
The above technique will work for EVERY mod, as well as the vanilla game - not only for UA :)
The reason for the AI of the 1st player performing badly, is that on game initialisation, the AI follows a SPECIFIC set of orders.

I can explain more if you want.

So when you use the above method ans have the AI play the local player, it does NOT happen on game initialisation so the AI does NOT follow that specific set of instructions.

There is no way to avoid this - I could code something in SCaR, so that to have the CPU get the AI control FROM SCRATCH, but I am not sure it will work.

Fast solution:
Before handling over the control to the CPU, start building a structure, have some more builders in cue, and definitely get some initial capturing squads. Will take just 2 minutes. Then, give the control to the CPU.

Last but not least, see here for an updated version of the code above:
https://forums.revora.net/topic/110329-playtesting-tips-and-tools/
DeMOiX Apr 27, 2021 @ 1:58pm 
Originally posted by Gambit_DoW:
Hello brother Cebi.
The above technique will work for EVERY mod, as well as the vanilla game - not only for UA :)
The reason for the AI of the 1st player performing badly, is that on game initialisation, the AI follows a SPECIFIC set of orders.

I can explain more if you want.

So when you use the above method ans have the AI play the local player, it does NOT happen on game initialisation so the AI does NOT follow that specific set of instructions.

There is no way to avoid this - I could code something in SCaR, so that to have the CPU get the AI control FROM SCRATCH, but I am not sure it will work.

Fast solution:
Before handling over the control to the CPU, start building a structure, have some more builders in cue, and definitely get some initial capturing squads. Will take just 2 minutes. Then, give the control to the CPU.

Last but not least, see here for an updated version of the code above:
https://forums.revora.net/topic/110329-playtesting-tips-and-tools/

Hi Gambit, I found exactly the same problem as fellow Cebi, AI on my player1 slot is always being crushed by the enemy and it plays way worse than actual other AI's and I ended up with this topic while searching all internet with this rare problem. A lot of time has passed, is there any update on this? It makes it difficult to test and find balance with mods and races when 1 AI is playing differently. Appreciate your efforts! Sorry for necro as I find this is only topic on across internet regarding this issue
Gambit_DoW Apr 28, 2021 @ 2:45pm 
Well, player 1 does not start with the setting that the other races start at the beginning of the game... So I suggest you should build the primary infantry building and build a couple of caper squads, before giving the player to the AI.

Last... In higher difficulties... The AI gets INCREASED resource income rates.
This is not difficult to address, but it needs a bit more coding and at the moment my hands are full!
There is an easy way to make the AI smarter. Set up your skirmish battle and start it. It will load and require you to press start to launch the game. Before pressing open the console and use the CPU control command. Close the console and click start game. The AI will behave just as any other CPU controlled player. Cheers
DeMOiX Apr 30 @ 2:19pm 
Originally posted by twitch.tv/jaybeejones26:
There is an easy way to make the AI smarter. Set up your skirmish battle and start it. It will load and require you to press start to launch the game. Before pressing open the console and use the CPU control command. Close the console and click start game. The AI will behave just as any other CPU controlled player. Cheers
Thank you very much for this incredible finding! I will reinstall DOW just because of this to have a fun time again
Originally posted by DeMOiX:
Originally posted by twitch.tv/jaybeejones26:
There is an easy way to make the AI smarter. Set up your skirmish battle and start it. It will load and require you to press start to launch the game. Before pressing open the console and use the CPU control command. Close the console and click start game. The AI will behave just as any other CPU controlled player. Cheers
Thank you very much for this incredible finding! I will reinstall DOW just because of this to have a fun time again

No Problem. Can you give me feedback about it? Because I have a majorly modded Version of the Tyranid Mod as a baseline that I created myself. Custom Maps, new AI, some new texture and effects, I made armies more versitile and bigger, added models from other mods. If it works for you I can tell its not because of my mods that this works.
DeMOiX May 4 @ 8:14am 
Originally posted by twitch.tv/jaybeejones26:
Originally posted by DeMOiX:
Thank you very much for this incredible finding! I will reinstall DOW just because of this to have a fun time again

No Problem. Can you give me feedback about it? Because I have a majorly modded Version of the Tyranid Mod as a baseline that I created myself. Custom Maps, new AI, some new texture and effects, I made armies more versitile and bigger, added models from other mods. If it works for you I can tell its not because of my mods that this works.
Do you have a discord channel related to your mod?
Did you get permission to use other mod content before you go doing that?
Originally posted by DeMOiX:
Originally posted by twitch.tv/jaybeejones26:

No Problem. Can you give me feedback about it? Because I have a majorly modded Version of the Tyranid Mod as a baseline that I created myself. Custom Maps, new AI, some new texture and effects, I made armies more versitile and bigger, added models from other mods. If it works for you I can tell its not because of my mods that this works.
Do you have a discord channel related to your mod?

Its not a public mod. I just use it for myself. I would also need permission from some folks to make it releasable. Its just larger battles on large only maps. If you get Unification Mod or Ultimate Apocalypse they are quite close. But I kept the T4 Tree Mechanic and remained closer to the original game and its tabletop baseline idea.
Alastor May 5 @ 4:00pm 
Originally posted by DeMOiX:
Originally posted by twitch.tv/jaybeejones26:

No Problem. Can you give me feedback about it? Because I have a majorly modded Version of the Tyranid Mod as a baseline that I created myself. Custom Maps, new AI, some new texture and effects, I made armies more versitile and bigger, added models from other mods. If it works for you I can tell its not because of my mods that this works.
Do you have a discord channel related to your mod?
so does it work, the method said earlier?
DeMOiX May 7 @ 2:55pm 
Originally posted by twitch.tv/jaybeejones26:
Originally posted by DeMOiX:
Thank you very much for this incredible finding! I will reinstall DOW just because of this to have a fun time again

No Problem. Can you give me feedback about it? Because I have a majorly modded Version of the Tyranid Mod as a baseline that I created myself. Custom Maps, new AI, some new texture and effects, I made armies more versitile and bigger, added models from other mods. If it works for you I can tell its not because of my mods that this works.
I can confirm this works like a charm! Before pressing start the battle, open console CTRL + SHIFT + ' (or whatever is your keyboard layout for ~) and type Cpu_ControlLocalPlayer
And then in game use function to switch to AI from Autoexec.lua file functions. This is the script I use (press F5 to activate):

run = Cpu_ControlLocalPlayer()
run = setsimrate(35)
bind("F1","setsimrate(2)")
bind("F2","setsimrate(20)")
bind("F3","setsimrate(35)")
bind("F4","setsimrate(300)")
bind("F6","setsimrate(900)")

-- debug key bindings for scar profiler and scar watcher --

-- bind scar watcher --

-- show/hide the watcher. automatically adds the showall filter for you.
toggle_scar_watcher = "LCWatcher_SelectState('SCAR'); LCWatcher_AddFilter('SCAR',''); LCWatcher_Activate(not LCWatcher_IsActive());";

-- use this to quickly add/remove the showall filter
toggle_all_vars = "if LCWatcher_FilterExists('SCAR', '') then LCWatcher_RemoveFilter('SCAR','') else LCWatcher_AddFilter('SCAR','') end";

bind("Shift+W", toggle_scar_watcher);
bind("Shift+A", toggle_all_vars);


-- bind scar profiler --
toggle_scar_profiler = "RulesProfiler_Activate(not RulesProfiler_IsActive())";

bind("Shift+P", toggle_scar_profiler);


-- nislet debug bindings --
bind("Shift+U", [[Scar_DoString("W40k_UnlockInputOnLetterBox()")]] );


bind("shift+F7", "toggle_screenmode()")
screenmode = 0
function toggle_screenmode()
if screenmode == 0 then
taskbar_hide()
message_hide()
ingame_select_ui_toggle()
ingame_stats_toggle()
screenmode = 1
else
taskbar_show()
message_show()
ingame_select_ui_toggle()
ingame_stats_toggle()
screenmode = 0
end
end

bind("shift+F8","toggle_FOW()")
fowmode = 0
function toggle_FOW()
if fowmode == 0 then
FOW_RevealAll()
fowmode = 1
else
FOW_Reset()
fowmode = 0
end
end

bind("F5","switch_player_control()")
function switch_player_control()
local player = World_GetPlayerAt(Tut_GetLocalPlayerIndex())
if Cpu_IsCpuPlayer(player) then
run = W40k_SwitchToPlayer( player, true )
else
run = Cpu_ControlLocalPlayer();
run = Cpu_SetDifficultyForDummies(World_GetPlayerAt(Tut_GetLocalPlayerIndex()), 3);
end
end
Last edited by DeMOiX; May 7 @ 2:58pm
Originally posted by DeMOiX:
Originally posted by twitch.tv/jaybeejones26:

No Problem. Can you give me feedback about it? Because I have a majorly modded Version of the Tyranid Mod as a baseline that I created myself. Custom Maps, new AI, some new texture and effects, I made armies more versitile and bigger, added models from other mods. If it works for you I can tell its not because of my mods that this works.
I can confirm this works like a charm! Before pressing start the battle, open console CTRL + SHIFT + ' (or whatever is your keyboard layout for ~) and type Cpu_ControlLocalPlayer
And then in game use function to switch to AI from Autoexec.lua file functions. This is the script I use (press F5 to activate):

run = Cpu_ControlLocalPlayer()
run = setsimrate(35)
bind("F1","setsimrate(2)")
bind("F2","setsimrate(20)")
bind("F3","setsimrate(35)")
bind("F4","setsimrate(300)")
bind("F6","setsimrate(900)")

-- debug key bindings for scar profiler and scar watcher --

-- bind scar watcher --

-- show/hide the watcher. automatically adds the showall filter for you.
toggle_scar_watcher = "LCWatcher_SelectState('SCAR'); LCWatcher_AddFilter('SCAR',''); LCWatcher_Activate(not LCWatcher_IsActive());";

-- use this to quickly add/remove the showall filter
toggle_all_vars = "if LCWatcher_FilterExists('SCAR', '') then LCWatcher_RemoveFilter('SCAR','') else LCWatcher_AddFilter('SCAR','') end";

bind("Shift+W", toggle_scar_watcher);
bind("Shift+A", toggle_all_vars);


-- bind scar profiler --
toggle_scar_profiler = "RulesProfiler_Activate(not RulesProfiler_IsActive())";

bind("Shift+P", toggle_scar_profiler);


-- nislet debug bindings --
bind("Shift+U", [[Scar_DoString("W40k_UnlockInputOnLetterBox()")]] );


bind("shift+F7", "toggle_screenmode()")
screenmode = 0
function toggle_screenmode()
if screenmode == 0 then
taskbar_hide()
message_hide()
ingame_select_ui_toggle()
ingame_stats_toggle()
screenmode = 1
else
taskbar_show()
message_show()
ingame_select_ui_toggle()
ingame_stats_toggle()
screenmode = 0
end
end

bind("shift+F8","toggle_FOW()")
fowmode = 0
function toggle_FOW()
if fowmode == 0 then
FOW_RevealAll()
fowmode = 1
else
FOW_Reset()
fowmode = 0
end
end

bind("F5","switch_player_control()")
function switch_player_control()
local player = World_GetPlayerAt(Tut_GetLocalPlayerIndex())
if Cpu_IsCpuPlayer(player) then
run = W40k_SwitchToPlayer( player, true )
else
run = Cpu_ControlLocalPlayer();
run = Cpu_SetDifficultyForDummies(World_GetPlayerAt(Tut_GetLocalPlayerIndex()), 3);
end
end


I didnt know others were not using this. I found out that AI behaves weirdly, when you activate this after the battle has already started. I know this since like 2018, its such a shame I didnt answer earlier on this, because I always come back to this thread, whenever I get back into DoW Modding. I use this also to fix the broken tyranid AI from an earlier version of the mod.
< >
Showing 1-14 of 14 comments
Per page: 1530 50