Author Topic: Enemy scripts, changing immunity after damage  (Read 5593 times)

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
Enemy scripts, changing immunity after damage
« on: 2011-08-21 19:47:07 »
The basic principle is easy and already in the game. The wonder pots take 0 damage until they got an elixir. Diamond Weapon is immune to weapons. What I want now is to make an enemy that changing immunities based on what attacks it executes and is hit by
Basically
-> On hit: physical weapon -> Immunity to X
-> On hit: magic:fire -> Immunity to Y, remove Immunity to X

the question is, can I do this in any elaborate way without making the script huge as hell?

PitBrat

  • *
  • Posts: 1376
  • Change to feed the machine.
    • View Profile
Re: Enemy scripts, changing immunity after damage
« Reply #1 on: 2011-08-21 20:08:20 »
Bosses able to change resistance is a theme in Final Fantasy.
Barrier Change Bosses

You're right, everything is in place to create such an encounter.
FF7 needs a more notable encounter with such a creature!
-PitBrat

nfitc1

  • *
  • Posts: 3013
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Enemy scripts, changing immunity after damage
« Reply #2 on: 2011-08-22 02:34:35 »
the question is, can I do this in any elaborate way without making the script huge as hell?

No. There's not a way to pull details of the attack from the AI. If you want to "absorb" the fire elemental out of Beta then you'll have to make a trigger based off of that attack by index, but it wouldn't be able to catch the fire element out of Ifrit in the same trigger....Well, if that data exists in the AI variables it hasn't been determined. It'd be nice if someone could write a prog that could produce a log of the AI vars both before and after each attack.

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Enemy scripts, changing immunity after damage
« Reply #3 on: 2011-08-22 13:06:52 »
No. There's not a way to pull details of the attack from the AI. If you want to "absorb" the fire elemental out of Beta then you'll have to make a trigger based off of that attack by index,


This. Until we actually locate a battle-memory variable that holds the element of the last attack, you'll have to write a script that basically just lists the indexes of all the attacks that'll trigger the change. That could get lengthy.


The only way to make these scripts simpler would be to rearrange attacks and spells in the KERNEL such that their indexes are easy to produce, eg all fire attacks have an index that's a multiple of three. If you managed to do this (I don't know if it's actually possible), then you'd be able to write AI scripts that could iterate through a list of indexes programmatically.


That said, why is AI script size such a big issue? Theoretically, they can slow down the frame in which they're executed, but that's not a massive deal. You can get around limitations on the SCENE.BIN size in PSX by just using my Disc Extension Patch.

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
Re: Enemy scripts, changing immunity after damage
« Reply #4 on: 2011-08-23 16:47:04 »
Basic rule of scripting:
The bigger the script, the higher the risk you fuck up somewhere and the longer it takes to fix it.
Seeing how this seems a TAD complex, how exactly does the wonder pot script handle the immunity before the elixir? I am tempted to add "more" wonder pots to the game, in different locations as rare encounter, eating different items with different rewards.
If you have played suikoden 5, like a map miniboss.

nfitc1

  • *
  • Posts: 3013
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Enemy scripts, changing immunity after damage
« Reply #5 on: 2011-12-20 19:18:16 »
I'm going to necro this because I'm redacting the previous statement I made. I have just discovered that you CAN tell details of the last attack were. There are two battle addresses that aren't used in any script that can tell you what you want.

2120 - This is the attack's elements
2160 - This is the attack's special flags (physical, MP instead of HP, drain, etc). Physical is always set if it's a physical attack even if the attack is already physical.

These are set before the action takes place so you can use these in the Pre-Action script and to clear/set immunities before the attack. Use these in the General Counter to set immunities after the attack. You can "randomize" immunities and elemental weaknesses this way a la FFVI's Debilitator.

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Enemy scripts, changing immunity after damage
« Reply #6 on: 2011-12-20 20:30:34 »
Hmm - interesting. What's the pattern of the data? Just sixteen bits representing the main 0x0F elements?

nfitc1

  • *
  • Posts: 3013
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Enemy scripts, changing immunity after damage
« Reply #7 on: 2011-12-20 20:57:51 »
Hmm - interesting. What's the pattern of the data? Just sixteen bits representing the main 0x0F elements?

Should be. It follows the 1h = Fire, 2h = Ice, etc pattern.
Same thing for the Special Attack Flags. 1h = Damage MP, 4h = Physical Attack, etc.

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Enemy scripts, changing immunity after damage
« Reply #8 on: 2011-12-20 22:37:41 »
Maybe I'll try creating a simple oil status (using blind for the 'shadow' effect). Should be straightforward to reduce the actor's level on a fire attack before swapping back the original value in a counter script.