Users browsing this thread: 1 Guest(s)
Monster AI - Variables

#1
Posts: 2,548
Threads: 98
Thanks Received: 147
Thanks Given: 156
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Thanks to Lord Envoy, the master battle script writer, I now know how to give monsters much better AI, through the use of variables, and fix a glitch with Chokesmoke as well. Before, my monsters would just continue to spam spells and status effects that are already still in effect, thus seeming retarded. This will no longer be an issue, resulting in much better AI.

Here's an example of what the script looked like before for my Howler monster, and I assume how many other beginners scripts might look as well:

F0 EE EF B0 ; Rand. spell: Battle or Special or Entwine
FF ; End first wave of attack
FF ; End

And here's how it looks now fixed:
FC 15 24 00 ; If VAR036 has all the following bit cleared: 0
F9 01 24 00 ; VAR036 set bit: 0
FC 09 43 12 ; If target allies is not affected by status Slow
F1 47 ; Targeting: use normal targeting
F0 EE EF B0 ; Rand. spell: Battle or Special or Entwine
FE ; End If and reset targeting
F0 EE EE EF ; Rand. spell: Battle or Battle or Special
F9 02 24 00 ; VAR036 clear bit: 0
FF ; End first wave of attack
FF ; End

So now, you see, if no ally is affected by slow, there is a 1/3 chance of casting Entwine, as well as battle or special. That is battle command 1. But once Entwine, (slow) is cast, and allies are slowed, it will not cast again, and switch back to battle command 2. (Battle or Battle or Special)

If you intend on giving your monsters status attacks, and do not wish for them to keep casting them over, and over, use this formula. Thanks Lord Envoy Wink

Here's a short vid showing the new AI in action:
http://www.youtube.com/watch?v=3k47ZQSFFwQ

And finally, here's a couple messages from Lord Envoy when he was helping me with a glitch in the battle script that is in FF6. It also explains battle scripts in great detail, and how to work with variables. So I thought I would share this vast knowledge with any other would-be battle script writers:

Lord Envoy: "You see, the script you gave me reads as follows:

FC 08 4A 07 ; If target ally #? is affected by status Death
FC 09 4A 01 ; If target ally #? is not affected by status Zombie
F1 4A ; Targeting: ally #?
A6 ; Lore: Chokesmoke
FE ; End If and reset targeting

This sequence is what I call an Ignition Command. The only way for this to be read by the AI, is if at least one ally meets the required conditions.

The script does not specify about targets that are Immune to Zombie. So the Boss will spam "Chokesmoke" until the Immune target is no longer dead. The same can be said about Stop / Blaster. Unfortunately, I've found NO code in the existing program to prevent this problem. However, I do know a way around this.

Use variables to control the ignition script, in this way the AI will only use Chokesmoke once per sequence. It doesn't really fix the problem but it does prevent the AI from spamming it on an immune dead ally.

Here is an example:

{Ignition Command}
If VAR036 has all the following bit cleared: 0 }---------------------{ Use this. }
VAR036 set bit: 0 }--------------------------------------------------------{ Use this. }
If target ally #? is affected by status Death
If target ally #? is not affected by status Zombie
Targeting: ally #?
Lore: Chokesmoke
End If and reset targeting

{Battle Command}
Rand. spell: Fire 3 or Ice 3 or Bolt 3
Wait until the attack sequence is called upon again, then continue (reset targeting)
Rand. spell: L.3 Muddle or L.4 Flare or L? Holy
Wait until the attack sequence is called upon again, then continue (reset targeting)
Rand. spell: Magnitude8 or Aero or CleanSweep
VAR036 clear bit: 0 }-------------------------------------------------------{ Use this. }
End first wave of attack

{Death Command}
If monster is in slot:
Monsters #1, #2, #3, #4, #5, #6 are killed, dies like a boss
End If and reset targeting

{Counter Attack Command}
If monster has been attacked by cmd: Fight or Jump, will target attacker
Rand. spell: Special or Nothing or Nothing
End

Just know that the technique I've shown you turns OFF the the Ignition Command for a short period until it's turned back ON by the Battle Command sequence. This prevents the spamming.

You can also use the same Variables to control the Ignition Command you used for Stop / Blaster. Just know that there are a number of ways to control the Ignition using this technique, you don't always have to place the switch at the Battle Command Sequence.

It's fine if you change VAR036 to VAR035, after all these bytes are just switches. Use them to turn On and Off a set of commands. Like you may already know, you can use any VAR no matter the number just as long as there isn't another VAR in the script with the same number. Otherwise you'll form bugs."
Tired of all those human monster idiots carrying around Pots and Hi-Pots and never using them near death like they should be?? Here's an example from another one of my monsters:

Monster: Dueler
HP:625

FC 06 36 02 ; If target self has less or equal than 256 HP
F1 36 ; Targeting: self
F6 00 E9 E9 ; Use random item: Hi-Potion or Hi-Potion
FE ; End If and reset targeting
F0 EE EE EF ; Rand. spell: Battle or Battle or Special
FD ; Wait until the attack sequence is called upon again, then continue (reset targeting)
F1 47 ; Targeting: use normal targeting
F0 FE FE EE ; Rand. spell: Nothing or Nothing or Battle
FF ; End first wave of attack
FC 05 00 00 ; If monster has been attacked
F0 EF FE FE ; Rand. spell: Special or Nothing or Nothing
FF ; End

With the FC 06 36 02, "if target self has less or equal than" changing the last byte alters the HP.
The higher the byte, the higher the HP. Placing this as an ignition command, followed by a "end if" will effectively have them using those items at certain HP.


We are born, live, die and then do the same thing over again.
Quote  

#2
Posts: 1,261
Threads: 250
Thanks Received: 11
Thanks Given: 7
Joined: Jun 2009
Status
Traitor
You could have asked me, but it seems like this works.
  Find
Quote  

#3
Posts: 831
Threads: 41
Thanks Received: 16
Thanks Given: 12
Joined: Nov 2009
Reputation: 18
Status
None
I've seen that in some of the boss hacks zeemis makes (example, Gestahl's battle), When enemies cast regen, the effect seems to be cumulative (the more turns the battle lasts, the greater the amount of HP recovery). I've been wondering for a while on how to do this, if anyone knows?!
Quote  

#4
Posts: 1,261
Threads: 250
Thanks Received: 11
Thanks Given: 7
Joined: Jun 2009
Status
Traitor
I do two types of regen for some of my newer bosses, nothing advanced though. Just a cleaver trick where you set the boss to start with the poison attribute and he absorbs poison so that he's gets a boost in HP. I first did this back in 2009 or so with my Eve of Darkness hack where you fight Warmech.

Look here at 3:05.
[youtube]http://www.youtube.com/watch?v=yjbxSGcJPq4[/youtube]
  Find
Quote  

#5
Posts: 831
Threads: 41
Thanks Received: 16
Thanks Given: 12
Joined: Nov 2009
Reputation: 18
Status
None
Clever, it didn't occur to me to do that. Confused

One last question: On one of your hacks (I believe it is ff7 vs. ff6), Aeris is able to summon the Seraphim esper in battle. I've tried to have a specific enemy summon the Fenrir esper of several ways, but all I get is the enemy summoning the "Dark Hood" piece of equipment, then I get a black screen, and the rom freezes.

How were you able to have an enemy summon an esper? if you wanted to, could you have an enemy summon multiple espers in one battle?
Quote  

#6
Posts: 2,548
Threads: 98
Thanks Received: 147
Thanks Given: 156
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Targeting?


We are born, live, die and then do the same thing over again.
Quote  

#7
Posts: 1,261
Threads: 250
Thanks Received: 11
Thanks Given: 7
Joined: Jun 2009
Status
Traitor
Yes, you could. Targeting is right, to a degree. You won't be editing the spells (esper stats) targeting, but instead the targeting in the script. You also need to disable concern MP I believe. I haven't had a boss summon an esper in awhile, but you can always download that hack and compare its stats to yours.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite