Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic AI Functions #4908

Merged
merged 5 commits into from
Jul 9, 2024
Merged

Conversation

ghoulslash
Copy link
Collaborator

This feature lets you assign custom AI functions via scripting to customize AI logic for specific battles. This could be useful for boss fights, totem bosses, etc that you want specialized AI logic for.

An example based on use case in voyager:

setdynamicaifunc AI_TagBattlePreferFoe
multi_2_vs_2 TRAINER_SIRIUS_NOVA_HYPERION_TAG, Text_NovaInsurgence_Arrival_Hyperion_Loss, TRAINER_SIRIUS_NOVA_DEIMOS_RECRUIT_TAG, Text_NovaInsurgence_Arrival_DeimosRecruit_Loss, TRAINER_SIRIUS_WHARF_TRITON_PARTNER, TRAINER_BACK_PIC_TRITON

where AI_TagBattlePreferFoe prioritizes attacking the opposite battler index

@AlexOn1ine
Copy link
Collaborator

AlexOn1ine commented Jul 5, 2024

Could you add the function AI_TagBattlePreferFoe as an example? Or any other function like that to have an example in the repo. Also any reason to make a callnative for this instead of using a normal flag? (Ig saving flags would be one)

@ghoulslash
Copy link
Collaborator Author

Could you add the function AI_TagBattlePreferFoe as an example? Or any other function like that to have an example in the repo. Also any reason to make a callnative for this instead of using a normal flag? (Ig saving flags would be one)

Sure. The idea behind not using a flag is to be able to customize AI for specific trainers, e.g. maybe you want your gym leaders and E4 to have specialized AI, there aren't 12 ai flags available so this would help with that

@ghoulslash
Copy link
Collaborator Author

Could you add the function AI_TagBattlePreferFoe as an example? Or any other function like that to have an example in the repo. Also any reason to make a callnative for this instead of using a normal flag? (Ig saving flags would be one)

done. ready for review

src/battle_ai_main.c Outdated Show resolved Hide resolved
src/battle_ai_main.c Outdated Show resolved Hide resolved
@AlexOn1ine AlexOn1ine merged commit e1d8ef8 into rh-hideout:upcoming Jul 9, 2024
1 check passed
@Pawkkie
Copy link
Collaborator

Pawkkie commented Jul 10, 2024

I've only just this and ghoul this is really really cool, I've been dedicating a few AI flags to "important" trainer battles where I want specific behaviour and didn't even catch this in the PR stage.

This is super sweet, thanks for sharing! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants