You must be logged in to post messages.
Please login or register

Game Modifications
Moderated by Aurilux

Hop to:    
Topic Subject: How to get AI to research new hero spells
posted 09-16-20 07:39 AM EDT (US)   
I am trying to add AI to a new tribe with new heroes and abilities, but got stuck on a point where the AI simply cannot research/upgrade abilities.

The original function in prodai_lib.bhs is the following:

int function sf_research_hero_spell(SpellType spell_type, Leader the_leader)

Inside the function, it first calculates next_spell_type

SpellType next_spell_type = get_next_spell_type_upgrade (spell_type, the_leader);

Then it checks

is_type_avail_to_research (next_spell_type, the_leader)

Then it adds it to the shopping list


I debugged the first two steps by printing the result to the screen, where in the first step "next_spell_type" is correctly obtained from craftrule.xml settings, but the second check returns 0(false) so it's indicating the upgrade is not available.

Also if I change the code to bypass the second check and add to the shopping list anyway, the AI still does not research so there must be something fundamentally wrong.

My xml setting contains a copied Lenora, with the ability "Boost" being exactly same as the original except
1. typename changed to "Boostm"
2. CODETAG removed
3. ICONGRAFT added

And the copied Lenora herself is exactly same as the original except
1. used reference_style="copy" from the original Lenora
2. typename changed to "Lenora, Pirata Princessm"
3. CODETAG removed
4. Attack and HP values changed (which I'm pretty sure is irrelevant)

Even this boost ability is not being researched by the AI. I hope it is not hard-coded for only the original heroes to work. If anyone has experienced similar issue please share your experience with me.

PS: I am also willing to accept any workaround, so if someone knows how to directly enable/upgrade an ability to a hero during run-time, I want to know as well. (tried to use leader_gain_tech does not work.)

[This message has been edited by modder00 (edited 09-16-2020 @ 07:48 AM).]

posted 09-16-20 06:55 PM EDT (US)     1 / 3  
As usual I can't help with this but we are currently having a email conversation about your crash fix and the user patch, would you like me to CC you?
"I hope it is not hard-coded for only the original heroes to work."
I hope so as well and was unaware this might be a possibility.
I will make a note of this and maybe we need to start a thread for what is and isn't possible with modding, what is and isn't hard coded, just like Rise of Nations and other games.
There will be uncertainties but some things may be testable and confirmable over others.

Motter might know something since he modded the heroes, I can try to get you two in touch if that helps.
posted 09-17-20 03:59 AM EDT (US)     2 / 3  
After messing around apparently it started working, although I did not pin down where exactly the reason was... At least it's not a hard-coded thing and it can work. (All I remember doing was adding some debug code/workaround code and then removing them and things started working) My guess is maybe there was a compilation delay.

As for the crash issue, I think it was a long time ago and could not remember. Could you send me the email again?
posted 09-22-20 11:29 PM EDT (US)     3 / 3  
Emailed you today but maybe a forum thread or other medium will be needed soon.
Rise of Legends Heaven » Forums » Game Modifications » How to get AI to research new hero spells
You must be logged in to post messages.
Please login or register
Hop to:    
Rise of Legends Heaven | HeavenGames