Author Topic: Adding more elemental reactions to FFVII ?  (Read 9665 times)

Armorvil

  • *
  • Posts: 621
  • Working on : FFVII Total Grudge
    • View Profile
Adding more elemental reactions to FFVII ?
« on: 2010-11-24 19:45:50 »
I briefly mentionned this in another topic. My question is : would it be possible to add more elemental reactions, than the 4 existing one ?

They are : absorb, nullify (0 damage), halve (50% damage), and weak (200% damage).

I'd love to be able to make our characters reduce an element to 25% or 12,5% damage, for example. Also, I noticed you can't make a character weak against an element, and this is something that would be interesting (with my new idea of a main physical element and a main magical element, one could imagine Aeris reducing magic by at least 50%, while being weak against physical attacks).

Likewise, I'd love to give enemies a "super weakness" to a particular element. IE, making it suffer 300% or 400% damage from it.

Alternatively, I *could* do without it if the characters' maximum stat was 510 (512?), instead of the usual 255. It would allow me to give a wider range of effect to the starting stats, some characters starting the game with already 255 in Spirit or Vitality. Actually, now that I think about it, could an AI code for the characters tell them to always have the full Dragon Force effect, even after being revived during a battle ?

EDIT:

Also, would it be possible for the game to take into accounts all elements of an attack in the damage calculation ? Like, if an enemy that is both weak against Fire and Ice would take triple damage from Kjata (and not just double) ?... ...I guess the answer is "yes, if you know what you're doing", but it would be great if someone who had the knowledge, time and dedication could make this into a reality. Throwing the idea around, anyway.
« Last Edit: 2010-11-24 23:12:10 by Armorvil »

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Adding more elemental reactions to FFVII ?
« Reply #1 on: 2010-11-25 12:20:07 »
Hmm. Good question. I don't have the opcode and address list to hand, so I can't say *exactly* what's in the scope of the possible. But I do know:

* You can return the index of an attack, and see if it fits a particular range (this is how Reno responds to bolt spells in a particular way)
* You can use pre-turn scripts to change defence levels before an attack 'connects'. You then use a counter script to undo that change the moment afterwards.
* A script can return the user's DEF and MDEF data, store somewhere, double it, then half after the attack ends.
* You can reduce character stats this very same way
* You can edit character levels on the fly, which makes a huge impact on damage dealt
* No-one yet knows which variable(s) store dragon force data. We could try and find out, though.

Armorvil

  • *
  • Posts: 621
  • Working on : FFVII Total Grudge
    • View Profile
Re: Adding more elemental reactions to FFVII ?
« Reply #2 on: 2010-11-25 20:23:06 »
Interesting! So it might be possible through AI-editing, huh...

Lion

  • *
  • Posts: 172
  • Sleeping Lionheart
    • View Profile
Re: Adding more elemental reactions to FFVII ?
« Reply #3 on: 2010-11-28 21:45:10 »
this already exists in a sense. the elemental materia depending on its mastery level will go 20 40 60 80 100 i believe.

purple.platypus

  • *
  • Posts: 12
    • View Profile
Re: Adding more elemental reactions to FFVII ?
« Reply #4 on: 2010-11-29 01:32:08 »
this already exists in a sense. the elemental materia depending on its mastery level will go 20 40 60 80 100 i believe.
Incorrect. It goes half damage, no damage, absorb.

nfitc1

  • *
  • Posts: 3013
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Adding more elemental reactions to FFVII ?
« Reply #5 on: 2010-11-29 07:15:24 »
I bet it would be, but it'd take some creative re-writing. What the game does is it takes that elemental modifier on an enemy and plays with the damage in a function depending on the value. To add more values you'd have to recreate the table it currently uses then add your own:

Select ElementalModifier:
Case 1: Do Stuff
Case 2: Do different Stuff
Case 3: Do another thing
Case 4: Do that one thing
Case 5: Do something else
Case 6: Do something new
Case 7: Do another new thing


I don't have the code in front of me so I can't tell you where to look. I CAN tell you that there are about 7 or so functions:

Death
Double-Damage  (Weak)
Normal Damage
Half-Damage  (Resistant)
No-Damage  (Immune)
Negative Damage  (Absorbs)
Full Heal

Based on the way the damage is calculated it will (I believe) take all the elemental modifiers the attack is based upon and calculate damage that way. Kujata is a good example to use.

Despite its attack's name and appearance, it only does Fire, Ice, and Bolt damage. Hitting an enemy that is weak to fire and absorbs Ice makes it heal double the damage IIRC because it's calculating both Fire and Ice elementals. This might actually pose a problem if you hit a monster that Full Heals with Fire and Dies to Ice.

* You can return the index of an attack, and see if it fits a particular range (this is how Reno responds to bolt spells in a particular way)
* You can use pre-turn scripts to change defence levels before an attack 'connects'. You then use a counter script to undo that change the moment afterwards.
* A script can return the user's DEF and MDEF data, store somewhere, double it, then half after the attack ends.
* You can reduce character stats this very same way
* You can edit character levels on the fly, which makes a huge impact on damage dealt

I'm against all these suggestions because in order for it to be exactly a percentage higher/lower a wealth of stats would have to be examined and calculated based on the attack's power. I don't think the AI has access to that info. I'm not telling you not to do it, but I wouldn't.

* No-one yet knows which variable(s) store dragon force data. We could try and find out, though.

I'm pretty sure this isn't stored in the range of the AI's memory addresses. Dragon Force itself is just a status that "prevents you" from stacking the bonuses it gives.

If it weren't so late and I weren't so sleep deprived already I could give a much better response. Maybe I'll try again later.

Terence Fergusson

  • *
  • Posts: 262
    • View Profile
Re: Adding more elemental reactions to FFVII ?
« Reply #6 on: 2010-12-05 20:59:21 »
I bet it would be, but it'd take some creative re-writing. What the game does is it takes that elemental modifier on an enemy and plays with the damage in a function depending on the value. To add more values you'd have to recreate the table it currently uses then add your own:

Far, *far* more complicated than that.  First, there's 8 levels of resistance: you forgot Auto Hit weakness (as opposed to Death Weakness and Double Damage Weakness).  Secondly, the system's split into at least two parts: the setup that collects element *and* status resistances into a single dword that's set, which is then called by everything that cares about it (which is a lot, though most just care about Death Weakness and Restorative).  That's widespread code changes required to allow for more element differences (especially given that the setup routine uses 16 dwords worth of stack space to collate all the element and status resistances before combining them).  Changing this would not be trivial.

Based on the way the damage is calculated it will (I believe) take all the elemental modifiers the attack is based upon and calculate damage that way. Kujata is a good example to use.

It does take all elemental resistances, but it doesn't use all of them.  The only three that can interact are Absorb, Double Damage Weakness and Half Damage.  Death, Full Recovery and Immunity override all of the above (and they have a priority which goes Death > Full Recovery > Immunity, so there's no clashes there either).

* No-one yet knows which variable(s) store dragon force data. We could try and find out, though.

I'm pretty sure this isn't stored in the range of the AI's memory addresses. Dragon Force itself is just a status that "prevents you" from stacking the bonuses it gives.

Dragon Force is not a status: it just does the same thing as Hero Drinks, except to different stats with a different value.  So it can stack with itself just as well as any other StatMod-modifying routine can.  And those modifiers are stored in 'Object Block #1' (which has other fun stuff like whether the character has had its item stolen, or how much time is left on various status effects), and is impossible for scripting to reference.

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Adding more elemental reactions to FFVII ?
« Reply #7 on: 2010-12-06 01:18:16 »
Say, whilst you're here - do you know anything about the 'sleep' and 'confusion' elements that crop up from time to time? I know it's possible to give a creature 'sleep' weakness, make sleep deal damage, and lo! behold! double-damage!

At which point are these 'elements' considered?

Also, just for trivia - where does the nomenclature of AI scripts get set? That is, at which point does FF7 decide that Address 0400 points to 0xSOMETHING? Not that I'm planning to deal with the (horrific) consequences of changing this.

On topic, you could probably have a trainer / Gameshark codes forcibly overwrite the StatMod value with something stored in, let's say 21A0. Unless those values move around 'Object Block #1' (possible).

Alternatively, modders can think about elemental reactions that don't involve increasing or decreasing damage dealt. Counter scripts like "If attack is in range of [electric attacks], gain regen / dual" or "If attack is in range of [poisonous attacks], lose buffs". Sounds like a cop-out, but unless you want to rewrite FF7's battle engine, it might be the most pragmatic solution.

nfitc1

  • *
  • Posts: 3013
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Adding more elemental reactions to FFVII ?
« Reply #8 on: 2010-12-06 02:41:33 »
Far, *far* more complicated than that.  First, there's 8 levels of resistance: you forgot Auto Hit weakness (as opposed to Death Weakness and Double Damage Weakness).  Secondly, the system's split into at least two parts: the setup that collects element *and* status resistances into a single dword that's set, which is then called by everything that cares about it (which is a lot, though most just care about Death Weakness and Restorative).  That's widespread code changes required to allow for more element differences (especially given that the setup routine uses 16 dwords worth of stack space to collate all the element and status resistances before combining them).  Changing this would not be trivial.

I didn't think it would be trivial, but that's more complicated that I expected to be. The whole thing might need to be rewritten then if more effects are to be added. Bummer.
I was speaking more in generalities since I haven't looked at any of this in detail (and can't at the moment). I did forget about the "never miss" weakness too, but I don't think that's ever used for elemental damages, is it? Just statuses, right? Actually, when I wrote this I was only half awake so I wasn't really paying attention to what I was writing. :)

It does take all elemental resistances, but it doesn't use all of them.  The only three that can interact are Absorb, Double Damage Weakness and Half Damage.  Death, Full Recovery and Immunity override all of the above (and they have a priority which goes Death > Full Recovery > Immunity, so there's no clashes there either).

I didn't ever do any testings on different immunity combinations, but that's good to know that they can't overlap. I just noticed the "Kujata paradox" a long time ago when I first played the game and used it in and around the Forgotten Capital.

So the hierarchy goes:
Death
Full Recovery
Immune
Absorb/Weak/Half

Where does "Never miss" fall into that?

Dragon Force is not a status: it just does the same thing as Hero Drinks, except to different stats with a different value.  So it can stack with itself just as well as any other StatMod-modifying routine can.  And those modifiers are stored in 'Object Block #1' (which has other fun stuff like whether the character has had its item stolen, or how much time is left on various status effects), and is impossible for scripting to reference.

Again, here's that half-awake thing at work again. I was thinking "Death Force", which is a status. Also, I got it in my head way back when that Dragon Force and Hero Drinks did the same thing at different magnitudes. I know that's not the case now, but it's still hard to unlearn things like that.

Say, whilst you're here - do you know anything about the 'sleep' and 'confusion' elements that crop up from time to time? I know it's possible to give a creature 'sleep' weakness, make sleep deal damage, and lo! behold! double-damage!

I think these are handled like elements because of the "Never miss" effect Terence reminded me of. If the action is supposed to do "sleep" then it will always hit and always inflict. Change that modifier to double-damage and it will do just that.

...where does the nomenclature of AI scripts get set? That is, at which point does FF7 decide that Address 0400 points to 0xSOMETHING?

Nomenclature isn't the word you're looking for there. That deals with naming things or a set of terms used by certain disciplines.

Terence Fergusson

  • *
  • Posts: 262
    • View Profile
Re: Adding more elemental reactions to FFVII ?
« Reply #9 on: 2010-12-06 03:50:05 »
I was speaking more in generalities since I haven't looked at any of this in detail (and can't at the moment). I did forget about the "never miss" weakness too, but I don't think that's ever used for elemental damages, is it? Just statuses, right? Actually, when I wrote this I was only half awake so I wasn't really paying attention to what I was writing. :)

Um, other way around.  'Auto Hit' is never used for status chances.  No weaknesses/immunities/resistances, even to 'status' elements, affect status chances.  Auto Hit affects the PAt or MAt of the ability itself, allowing it to connect in the first place before it even worries about whether statuses are hitting.  Weakness/Resistances can affect PAt and MAt as well, but only if the ability has a Power of 0 (and is thus not intended to cause damage anyways).

Where does "Never miss" fall into that?

It really doesn't, seeing how it doesn't affect damage at all.  Unless otherwise specified, the game remembers all the weaknesses, absorbs or immunities it hit... it just doesn't care to remember *which* elements were weaknesses, absorbs and immunities, or how many of each there were.  So Auto Hit gets checked for during the hit chance calculation (along with a bunch of other things that can cause auto hit, like Death or Immunity (the latter so it can properly throw away the status inflictions and print up a big fat 0 damage).


I think these are handled like elements because of the "Never miss" effect Terence reminded me of. If the action is supposed to do "sleep" then it will always hit and always inflict. Change that modifier to double-damage and it will do just that.

Nope.  Nothing in the game has an Auto-Hit weakness to a status ability, in the first place.  Even if they did, they'd just cause the attacks to always hit (Lucky Evade could dodge physical auto hits, but enemies don't get Lucky Evades), but the infliction would still have its original chance.  There's only three enemies in the game with an Auto-Hit weakness, and they're all 'weak' to Punch.

Instead, enemies are either Weak to or Absorb these 'status elements'.  Weakness just doubles the damage if the ability does damage in addition to inflicting the status.  If it doesn't do damage, it doubles the hit rate of the ability (but not the status infliction chance).  Absorb will just toggle the Restorative bit, allowing the enemy to heal from any damage the ability inflicts and swap status infliction with status removal and vice-versa.

Honestly, most of this is all in the Battle Mechanics Guide (though I guess I don't make it clear enough that weaknesses/resistances/etc don't have any effect on status infliction chances).  Pretty much everything in Section 3.2 Status and Elemental Resistance is dealt with during the first routine I mentioned that collates all the resistances together so that everything else that comes after can just ask whether the ability was Absorbed, Resisted, etc and not worry about *which* elements are used anymore.

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Adding more elemental reactions to FFVII ?
« Reply #10 on: 2010-12-06 12:41:18 »
Quote
Nomenclature isn't the word you're looking for there. That deals with naming things or a set of terms used by certain disciplines.

Digression, but surely it is? Fairly sure 'nomenclature' can quite generally refer to 'a system of naming'.

In at least my own field (literary criticism), 'nomenclature' often refers quite generally to arbitrarily dividing undifferentiated data with a series of signifiers, no matter what the field. So you could, for instance, talk about signed and unsigned integers as just using a different 'nomenclature' for the same electronic data (which is my preference to thinking of 'sign' bits), etc. etc. Then again, we're pretty shameless in hijacking all kinds of terminology from a variety of fields, and misuse it without much care. So.

Anyway.

Quote
I didn't ever do any testings on different immunity combinations, but that's good to know that they can't overlap. I just noticed the "Kujata paradox" a long time ago when I first played the game and used it in and around the Forgotten Capital got screwed over in the Schizo fight.

Fixed for me.

Quote
It really doesn't, seeing how it doesn't affect damage at all.  Unless otherwise specified, the game remembers all the weaknesses, absorbs or immunities it hit... it just doesn't care to remember *which* elements were weaknesses, absorbs and immunities, or how many of each there were.  So Auto Hit gets checked for during the hit chance calculation (along with a bunch of other things that can cause auto hit, like Death or Immunity (the latter so it can properly throw away the status inflictions and print up a big fat 0 damage).

Ah, so the elements don't really 'interact', per se. Rather, some function 'accumulates' elemental 'modifiers'. But certain modifiers can override others.

Quote
Half asleep at work

> Post date: Monday

One of THOSE weekends, huh?
« Last Edit: 2010-12-06 12:44:54 by Bosola »

nfitc1

  • *
  • Posts: 3013
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Adding more elemental reactions to FFVII ?
« Reply #11 on: 2010-12-06 13:44:52 »
Quote
Nomenclature isn't the word you're looking for there. That deals with naming things or a set of terms used by certain disciplines.

Digression, but surely it is? Fairly sure 'nomenclature' can quite generally refer to 'a system of naming'.

In at least my own field (literary criticism), 'nomenclature' often refers quite generally to arbitrarily dividing undifferentiated data with a series of signifiers, no matter what the field. So you could, for instance, talk about signed and unsigned integers as just using a different 'nomenclature' for the same electronic data (which is my preference to thinking of 'sign' bits), etc. etc. Then again, we're pretty shameless in hijacking all kinds of terminology from a variety of fields, and misuse it without much care.

Yes, but you're not talking about names, you're talking about addresses. I don't see the correlation.

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Adding more elemental reactions to FFVII ?
« Reply #12 on: 2010-12-06 16:33:52 »
Names and addresses are much the same thing, really, because they're both sets of signifiers.

A lot of philology, especially that 'developed' by continental philosophy, doesn't really distinguish between 'names', 'concepts' and 'signs'. It's one of the reason terms like 'signs' and 'semiotics' get used: because they don't commit to a particular kind of signifier.

In these fields, 'nomenclature' (often) refers to *any* system of signs. That could mean anything that's used as a reference, or to represent another thing, especially when that choice is quite arbitrary (like words). The scripting addresses are just one example.

Continental linguistic philosophy almost has its own language, really. It's easy for outsiders to get tripped up by the way these people use terms like 'signs' and 'rhetoric' (which would take a whole essay to explain).