[Ohrrpgce] SVN: james/12702 Implement very simple (random) hero AI for when a hero should attack aut

Ralph Versteegen teeemcee at gmail.com
Wed Jan 26 06:13:51 PST 2022


Fun! It can be expanded in various directions later. We could have a
setting in each spell list (or even each spell list slot) to say whether
the spell list/slot should be used by hero AI.

I see some bugs in the battle menu code though.
You don't actually use valid_for_ai for anything! "WITH
*bspr.batmenu.items[randint(choice_count)]" is wrong.
You forgot to check .disabled, and it ignores .check_costs_as_weapon (which
is misnamed and has dubious effect), however currently .disabled is only
updated and .check_costs_as_weapon is only applied in update_battle_menu(),
which is called from inside battle_display() and apparently is not called
when a hero is under player control. I think maybe you intentionally didn't
want to use update_battle_menu, but only that checks tag conditions, and I
don't see a reason to duplicate that code in update_battle_menu.

Since valid_for_ai is a vector, you could just use v_remove to delete
options that fail atkallowed, and stop when none are left, then you can do
away with 'safety' entirely.


On Sun, 23 Jan 2022 at 04:22, James Paige <Bob at hamsterrepublic.com> wrote:

> Right now the hero just randomly picks any regular attack.
> I do plan to support picking from spell lists also
> I have no plans to support item use in automatic attacking mode
>
> I intend to keep hero AI very simple. I might add a mode that only ever
> uses the first valid attack, since I can see that being handy for cutscene
> battles, but any really fancy hero ai (like if ally hp is low, then use
> healing, or conserve MP if enemies are weak) will have to wait for
> battlescripting
>
> Also, known bug with both player controlled enemies, and auto controlled
> heroes is that they screw up the "ESC to go back" feature in turn-based
> battle mode. I'll find a fix for that soon though.
>
>
>
> On Sat, Jan 22, 2022 at 10:14 AM <subversion at hamsterrepublic.com> wrote:
>
>> james
>> 2022-01-22 07:14:27 -0800 (Sat, 22 Jan 2022)
>> 82
>> Implement very simple (random) hero AI for when a hero should attack
>> automatically
>> ---
>> U   wip/bmod.bi
>> U   wip/bmod.rbas
>>
>> _______________________________________________
>> Ohrrpgce mailing list
>> ohrrpgce at lists.motherhamster.org
>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>>
> _______________________________________________
> Ohrrpgce mailing list
> ohrrpgce at lists.motherhamster.org
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20220127/192362fd/attachment.html>


More information about the Ohrrpgce mailing list