iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
 
Reply to this topicStart new topic
> Enemy AI State (v 1.0), Use enemy action lists on actors. ATB & SBS compatable.
Rating 5 V
Mithran
post Feb 28 2009, 08:44 AM
Post #1


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




Enemy AI State v 1.0
by Mithran


Introduction
This one is a little hard to explain. This script makes the actor mimic the action list of an enemy by adding a state. When the state is inflicted, the character will autobattle using the action list of the enemy specificed by the state. Certain enemy actions can be excluded altogether.

Features
- force actor into autobattle, using enemy action lists, by using a state

How to Use
Install on its own script page in the materials section of the script editor above main and below default scripts. Also move below any custom battle systems.

Script
» Click to show Spoiler - click again to hide... «


FAQ
q: I want to make my own AI list and give it to an actor.
a: For now, you can create a 'dummy enemy' not used in game. Make the state use enemy AI from the dummy enemy.

q: I want to mimic the stats and or auto states of the enemy, also.
a: Well, you can set something up with my State Parameters PLUS script and Conditional Autostate script. Both are found in my signature.

q: How about a full 'rage' system like on 'Gau' from FFVI?
a: I dont have time for another full system at the moment. For now, you will have to event this out.

Credit and Thanks
- Mithran
- requested by squareenix

Author's Notes
Feedback is welcome. Please do not redistribute without asking. I may expand on this at some point.


--------------------
Go to the top of the page
 
+Quote Post
   
Zxaldien
post Feb 28 2009, 08:48 AM
Post #2


Sneaking into the night
Group Icon


Type: Designer




wow mithran. you've been pumping out a lot of quality scripts recently. Nice job!


--------------------

Story-90%, Event/scripts-25%, Maps-5%, Other-10%
Thanks for the userbar Zabre!



GrandmaDeb's Resource Index

GrandmaDeb's Script Index


Thanks Even Angels!

You call me arrogant because I speak the truth when I proclaim myself to be superior to you. If it wasn't the truth, then you would be calling me a liar not arrogant.

you can only get the clap so many times before it turns into applause
Go to the top of the page
 
+Quote Post
   
Mr. Bubble
post Feb 28 2009, 09:20 AM
Post #3



Group Icon


Type: Undisclosed
Alignment: Unaligned




Very cool, Mithran. Scripter of the Year in 10 months time for sure. laugh.gif

This can be used to customize the Auto Battle AI of actors like if they only join you for a short time. This is probably the closest way to customize the priority of usage for skills used by Auto Battle members aside from events.

Got a question: Did you script this normally and it turned out to be compatible with the SBS or was there anything you needed to add for it to work?


--------------------
I no longer support Tankentai.
Go to the top of the page
 
+Quote Post
   
Mithran
post Feb 28 2009, 09:37 AM
Post #4


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (Mr. Bubble @ Feb 28 2009, 01:20 AM) *
Very cool, Mithran. Scripter of the Year in 10 months time for sure. laugh.gif

This can be used to customize the Auto Battle AI of actors like if they only join you for a short time. This is probably the closest way to customize the priority of usage for skills used by Auto Battle members aside from events.

Got a question: Did you script this normally and it turned out to be compatible with the SBS or was there anything you needed to add for it to work?


The methods used for determining auto battle are, thankfully, the same in ATB/SBS as they are in the default battler. It was requested to be compatable with SBS and ATB. This probably would have been compatible with SBS had I just made it for the normal battler. I just turned the autobattle flag on if any of the actor's states specified AI input, then directed them to make their action according to the list, which is essentialy the same methods enemies use with very minor changes for certain conditions (party level) and exclusion of certain actions from the list (like escape). The only bug I ran into with this is that actor's stayed in command input mode if hit by one of these states, when they should have been forced into autobattle. All I really had to do here for ATB compatability is to have, on state add, if the actor's enemy AI index changed, to reset the battler's currently charging(atc, I think?) atb action and to subtract 1 from the atb counter (if full) to kill 'input' mode (so actor command window closes and they use the action list instead). After changing that, everything ran smoothly.

Oh, and in case you were wondering why I had options to exclude items from the action list, well.. I *might* do something with that at some point.


--------------------
Go to the top of the page
 
+Quote Post
   
woratana
post Feb 28 2009, 11:04 AM
Post #5


*O* ~(>_<)~
Group Icon


Type: Coder




Is it really compatible with ABS?
This would be definitely a good script. ^^/

Nice work as always, Mithran


--------------------
Check out my new blog!!!

Go to the top of the page
 
+Quote Post
   
Mithran
post Feb 28 2009, 11:07 AM
Post #6


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (woratana @ Feb 28 2009, 03:04 AM) *
Is it really compatible with ABS?
This would be definitely a good script. ^^/

Nice work as always, Mithran


Yep, tested compatable with all three wait modes in the RPG Tankentai Sideview Battle System. Let me know if there are any issues. smile.gif


--------------------
Go to the top of the page
 
+Quote Post
   
woratana
post Feb 28 2009, 11:23 AM
Post #7


*O* ~(>_<)~
Group Icon


Type: Coder




Is it worked with PRABS or Requiem?


--------------------
Check out my new blog!!!

Go to the top of the page
 
+Quote Post
   
Mithran
post Feb 28 2009, 12:08 PM
Post #8


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (woratana @ Feb 28 2009, 03:23 AM) *
Is it worked with PRABS or Requiem?


Sorry, I meant to say compatable with ATB. As for ABS, uses pretty much the methods to determine action as normal enemy actions do. If ATB has some extra or redefined methods to determine enemy actions, I can update it to use those too for ATB compatability. How about a link?


--------------------
Go to the top of the page
 
+Quote Post
   
woratana
post Feb 28 2009, 02:02 PM
Post #9


*O* ~(>_<)~
Group Icon


Type: Coder




I think most ABS scripts don't use the same way to determine action.
That's why I'm pretty much surprised when you said it worked with ABS. >_>"

Though, still a nice script. ^^


--------------------
Check out my new blog!!!

Go to the top of the page
 
+Quote Post
   
squareenix
post Feb 28 2009, 04:03 PM
Post #10



Group Icon


Type: Undisclosed




Sorry for the late reply.
Thanks a million!

EDIT: For some reason, whenever an actor in this state tries to do a skill that attacks all enemies, he/she attacks themselves instead. Any suggestions?

This post has been edited by squareenix: Mar 1 2009, 07:58 AM
Go to the top of the page
 
+Quote Post
   
Mithran
post Mar 2 2009, 01:53 AM
Post #11


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (squareenix @ Feb 28 2009, 08:03 AM) *
Sorry for the late reply.
Thanks a million!

EDIT: For some reason, whenever an actor in this state tries to do a skill that attacks all enemies, he/she attacks themselves instead. Any suggestions?


Im not seeing this problem. I gave a dummy enemy a few 'attack all' spells (sickle weasel, poison breath, blizzard II) and gave their AI state to Ulrika. Tested it in the ATB/SBS demo and it worked just fine. Is it a particular skill you are having a problem with? Is it just the animation? Not sure how reflect works in SBS, but maybe they are reflecting? Perhaps they fell under 'confusion' before the attack executed, which will force them to attack allies over using the AI list (confusion, berzerk take priority).


--------------------
Go to the top of the page
 
+Quote Post
   
John Dane
post May 24 2010, 01:15 PM
Post #12



Group Icon


Type: Undisclosed




Hey Mitrhan, this is one of my favorite scripts. I see no one has posted here for a while, so I hope this isn't a necropost, seeing as you're an active member of the forum.

I'm using this script extensively for my auto battle actors (in my game, you essentially only control the main character), but I've changed it a bit so they only use skills if they have learned them already.

On line 161, I changed it to:

CODE
return super if use_enemy_ai_index > 0 && @skills.include?(skill.id)


This allows me to set up more conditions where a skill can be used by an auto battle actor. Before I was just using switches for each and every skill that an actor could learn, but of course that got tedious. It's amazing what a tiny line of code can achieve...(or in some cases, ruin). smile.gif

I'm just posting my results here just in case someone else had similar preferences.

There don't seem to be any bugs so far. I'm also using this in conjunction with Yanfly's YEZ Aggro/AI script. Now my autobattle actors are geniuses. smile.gif

Thanks Mithran.
Go to the top of the page
 
+Quote Post
   
Mithran
post May 24 2010, 07:57 PM
Post #13


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




Yep, that will work. You can also accomplish the same by simply commenting out the entire definition for 'skill_can_use?' here, because the only thing it accomplishes is to allow actors to use skills they wouldn't otherwise have access to. Thanks for pointing that out.


--------------------
Go to the top of the page
 
+Quote Post
   
John Dane
post May 26 2010, 09:29 AM
Post #14



Group Icon


Type: Undisclosed




Thanks for all your hard work Mithran.

This post has been edited by John Dane: May 26 2010, 09:42 AM
Go to the top of the page
 
+Quote Post
   
tioluko
post May 26 2010, 11:00 AM
Post #15



Group Icon


Type: Artist
Alignment: Chaotic Neutral




Did I understand, or with this the actor can completely imitate the enemy actions?

Serious this is the most "Gau" thing xD

Awesome script^^

Whould you give me authorization to show it in an brazilian community?


Thanks and See ya^^


--------------------
Take a look in my gallery please ^^


_________________________________________________


Go to the top of the page
 
+Quote Post
   
Sky00Valentine
post Jul 28 2011, 10:56 PM
Post #16


Cold Fire
Group Icon


Type: Coder
Alignment: Neutral Good




Hey Mithran found a little fix for someones issue with using skills they don't want. Thought you could put this in or make your own edit.

Spoiler:
CODE
module Mithran
  module EnemyAI
    
    KNOWN_SKILLS = [3,4]
    #Any actor_id's in KNOWN_SKILLS will only use skills they know at that time.
    
  end
end

alias skill_can_use_enemyai skill_can_use?
  def skill_can_use?(skill)
    unless Mithran::EnemyAI::KNOWN_SKILLS.include?(id.to_i)
       return super if use_enemy_ai_index > 0
    end
    return skill_can_use_enemyai(skill)
  end


--------------------
Go to the top of the page
 
+Quote Post
   
luigi bros
post Sep 14 2012, 01:09 AM
Post #17



Group Icon


Type: Undisclosed




Sorry if this is against the rules (for the necropost), but I have a question about the script. How do I set which enemy is used for the state? I want to pick enemy 001 (only attacks), but I have no idea how to customize it.
Go to the top of the page
 
+Quote Post
   
Mithran
post Sep 14 2012, 07:39 AM
Post #18


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (luigi bros @ Sep 13 2012, 06:09 PM) *
Sorry if this is against the rules (for the necropost), but I have a question about the script. How do I set which enemy is used for the state? I want to pick enemy 001 (only attacks), but I have no idea how to customize it.


This script operates off note tags. All you need to do is put the appropriate text in the note box of a state, and whoever is inflicted with that state will use the specified enemy AI.

The note tag is:
CODE
<enemy ai n>

Where n is the id of the enemy.

So in order to have the state make the character use enemy 1's AI:

CODE
<enemy ai 1>

When the state is inflicted upon an actor, they will use the AI of the enemy ID 1.

However, no script is needed if all you want to do is have the actor uncontrollably attack enemies with normal attack, all you need to do is have a state with the restriction field set to "always attack enemies". This script is intended to instead have actors autobattle with a certain skillset they wouldn't otherwise have access to.


--------------------
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd August 2014 - 04:40 AM

RPGMakerVX.net is an Privacy Policy, Legal.