Ally Actor AI

I apologize if this is in the wrong thread, this is probably a script request.


What I am looking to do is program an Ally Actor AI, much in the way that you can script an enemy.


What I mean, is how you can make an enemy use certain abilities on specific turns or at certain % of health, mana etc.  or even use Conditional Branches to determine if specific states are active and have them do something in response.


I want to do this with Ally Actors.


For example.


Have an actor run a conditional check every turn to determine if an Ally is at X%, if they are, use a heal.  if they are lower, use a bigger heal.


Have a Mage Ally run a conditional check to see if an enemy has a state that increases Fire damage taken, if yes, use a fire spell.


I can do all this on enemies with the editor, but I want to do this with Allies.
I had some minute and i found this workaround aproach.


1. Skill number one is shared as skill/placeholder for the normal attack button.


Use this Script to give your Auto Hero his own skill he runs if he uses normal attack skill.


http://www.rpgmakercentral.com/topic/5618-set-guardattack-skills/


2.


Make that that skill does nothing accept calling a common event and targeting none i supose? In that common Event you can try to realise your AI.


3.Make sure to seal all his skill types in battle, because we need to force the auto hero to use his only choice atack command which activates the AI for that turn.


4.


The AI can check for learned Skills of the Hero and than use them if conditions aply.


Atleast this works in theorie, never tested it fully, and it looks like a lot of work and time consuming testing.


Good luck or maybe someone else can recoment something.


The normal autobattle function also uses Healing  from Time to Time but mostly focuses on the skills that do most damage to enemy.
Hey, Bex.  Thanks for your reply! 😀o


I had posted this while I was at work and after I had some time to think and I had come up with something similar to that.


I am glad to hear that someone else thinks like I do.  At least I know it doesn't sound, too, outlandish.


I have not had an opportunity to test his yet, but I will make a reply on if we can get this to work.


I know of the Auto-Battle feature and I find it is too unreliable.  I wanted to put see form of Random Variance into my "AI" but I needed it to be for precise that what the auto-battle can function.


I might have the system do something with generating random numbers and acting on if the number he greater or less than a pre-determined number.


I don't mind the complexity or the time it takes, honestly, it's stuff like this that is my favourite part of development.  I just hope it doesn't run too heavy and cause performance issues with the heavy eventing.


Anyways, thanks for the reply.  Should have time to work something out, today.
So, after I have had some time to tinker with this, I have come to snag.

I've done everything you've suggested, but there is a slight problem in sealing off all of my Healer's Skill types.
I've sealed off all of her skill types, set up her attack command to perform a different skill ID, one that activates the AI Event.


The event tells her to use a heal on specified target, if said target is below 50% health.

She wont use the skill.  Why?  Because we sealed off the skill-type that that skill is under.
If I make the heal have no skill type, she'll use it - But only because it's 1 of 2 options from the Auto-Battle command.


I'm going to have to play around with this some more.
Okay thanks, didnt thought about that Bug.... hmmm i take a look.


Edit:


Strange if i use Eventcommand Force Action in a Test, Eric uses Stone attack even if he has not learned it.


Nor has he access to magic or special abilities.
I found out why it wasn't working - It wasn't that Kinata did not have access to the skill, it's that she is out-right refusing to use my AI Test attack command.

I took her off Auto-Battle and went into a test-fight and manually selected the Attack that would run the Common Event, and it worked - also displaying animations she didn't before.  So, it isn't that the event isn't running properly, or that she doesn't have access to the skills - It's that she is simply not using the ability  that runs the Common event, even though, it's her only option.


EDIT:
I've read that some people had issues with Auto-Battlers not using commands that didn't do any damage.  I added a point a damage to my Common Event activating skill and even still, she refuses to use the skill.
This Sounds fun i give it 1 try to rebuild it.
Okay, so, for testing purposes, the Skill that I have given Kinata to run the Healer AI Common Event is AI Test.
This whole thing, would work perfectly, if it were not for the fact that the Auto-Battle function, refuses to choose an option that does no damage.


I set AI Test to do 12 Damage, and it works like a charm, expect for the fact that Kinata now punches things for 12 points of damage and then runs the common event


This simply wont do, but we are getting somewhere.
Hmm on my end it works.


1. I inserted the Script to Script Editor.


2. Than i gave Eric the Note Tag in the Database: <Attack_ID 5>


3. Than i made that skill call common event 1


4. I inserted a textbox into the script


5. i also gave eric auto battle after testing it manualy


He uses his invicible skill and than imidietly the textbox will be shown.


Maybe retry it in  a fresh project to eliminate the possibility of a human mistake somewhere.


Happens to me very often while testing new stuff.


Edit:


My Skill nr 5 also does no damage, it gets choosed.


Edit2:


If you get this to work on your end too, we could start and figure out how complicated the ai might grow 🙂.
I've done everything I can think of - If AI Test doesn't register damage, the Auto Battle Function wont choose it and Kinata just stands there like a ed puppy.
Make sure your skill looks like this, and make it certain hit, else the common event maybe will not be executed because the skill needs to succeed which in this scenario maybe not happen, needs to deal damage or heal to work.


The picture fixes that: Edit: MAybe also delete the using message.


skill setup.PNG
That is what mine looks like, minus the description and the using message, but I can hardly imagine that that is what is causing the issue.  We'll see when I can get back on my computer.
Hit Type! Make sure its Certain Hit!
Aye.  that is default.
Than i have no clue, because on my end it works, test it in a fresh project, so you can make sure no other scripts are interferring.


Edit: OH NO iam using vx-ace and now i recognize that you are using MV, that can mean that mv got a BUG, you should report that to the developers.

Original thread: https://forums.rpgmakerweb.com/threads/ally-actor-ai.70603/