Freedom Reborn

Freedom Force Forums => Scripting Forum => Topic started by: BentonGrey on July 09, 2022, 05:17:48 PM

Title: Invulnerability and Genetic Damage
Post by: BentonGrey on July 09, 2022, 05:17:48 PM
Howdy folks, I'm still working on the DCUG, and one of my main goals is to rebalance and generally improve existing characters.  As part of that, I've been experimenting with how I represented invulnerable characters like Superman.  My DCUG strategy was to use Physical Resistance plus low Invulnerable levels, and this worked well in capturing how tough they were, while still making it possible to hurt them if lower powered characters tried hard enough.  However, because of the dominance of this approach, it renders Genetic Damage attacks much less useful in the mod, and thus renders characters whose primary powers are their intelligence, like Brainiac 5, less useful.  I experimented with switching this up, using Concerete, PR, and less Inv., but this is proving difficult to balance AND it requires extra attribute slots, as Concrete doesn't block energy.  I'm trying to think of other options, and I was wondering if there is any way to make the Invulnerable or PR attributes respond to Genetic Damage attacks, like if they can be temporarily turned off by them.  Does anyone know enough scripting to take a look at that?
Title: Re: Invulnerability and Genetic Damage
Post by: Epimethee on July 10, 2022, 12:09:25 AM
The issue is that Genetic Damage (altered structure in the code) can be set in code, but not detected: IG didn't provide the corresponding function for the "generic damage" types (OBJSTATE_ELECTRIFIED, OBJSTATE_MOLECULAR_EXCITE, OBJSTATE_ALTERED_STRUCTURE,  OBJSTATE_ATTACKBONUS, OBJSTATE_DENSITY_CHANGE), contrarily to the primary and secondary damage types.

Maybe we could use MLOG Reader to get the damage type (the base code is there to do this, even if it has some limitations), but since it'd require quite a bit of trials and errors, and I can't currently run FFvsTTR, that's a no go for me at the moment. As an alternative, would a power swap be an acceptable source?
Title: Re: Invulnerability and Genetic Damage
Post by: BentonGrey on July 10, 2022, 03:47:26 AM
Epi, I really appreciate the response and the explanation, man.  I didn't know there wasn't a to detect genetic damage attacks.  Bah!  I think I'd best avoid a power swap for something this common, as they are unstable for me and often fail.
Title: Re: Invulnerability and Genetic Damage
Post by: Epimethee on July 10, 2022, 05:15:14 PM
If we're talking super-scheming villains' plot-level trick, maybe a custom command would do? i.e.,Brainiac uses his one-time (or once per hero-point, maybe) custom power on Superboy, automatically triggering genetic damage and disabling invulnerability & physical resistance for the duration.
Title: Re: Invulnerability and Genetic Damage
Post by: BentonGrey on July 10, 2022, 06:57:51 PM
Hmm, that's very interesting, Epi.  That could be an intriguing alternative.
Title: Re: Invulnerability and Genetic Damage
Post by: Epimethee on July 16, 2022, 03:47:55 PM
Draft code, FWIW (I don't expect it to work out of the box, as I couldn't test it and I doubt I ever got anything working on first try). This should go in ffx.py (if the file isn't full, can't remember the exact situation); I'm presuming you're using FFX 3.3. Please back up first obviously, and post any log file for errors.

########################### SCRAMBLER #############################
# Add a custom command on enemies to do temporary genetic damage to target, while removing their invulnerability
# and physical resistance (toughguy2) for the duration.
# Requires 1 hero point per use.

def initscrambler(char, update=0, remove=0):
    if remove:
        for target in getAllEnemies():
            Mission_RemoveCustomAction('CUSTOM_SCRAMBLER',char, target)
    else:
        for target in getAllEnemies():
            Mission_CustomAction('CUSTOM_SCRAMBLER', char, target, 'scrambleTarget', 50, 1)

def scrambleTarget(target, char):
    heroPoints = Object_GetAttr(char, 'heroPoints')
    if heroPoints < 1:
        initscrambler(char, 0, 1) # remove custom command
        Mission_StatusText("I needed a hero point to scramble my enemy!")
        return
    heroPoints = max(0, heroPoints - 1)
    Object_SetAttr(char,'heroPoints', heroPoints)
    Object_SetGenericState(target, OBJSTATE_ALTERED_STRUCTURE, 15, 0)
    # does the target have Invulnerable?
    invPoints = FFX_ObjectGetAttr(target, 'invPoints')
    if invPoints != 0:
        FFX_ObjectSetAttr(target, 'invPoints', 0)
        RegTimer('OnUnscrambleInvulnerable', 15, 0, target, invPoints)
    # does the target have Physical resistance?
    tg2Fraction = FFX_ObjectGetAttr(target, 'tg2Fraction')
    if tg2Fraction != 0:
        FFX_ObjectSetAttr(target, 'tg2Fraction', 0)
        RegTimer('OnUnscrambleToughGuy2', 15, 0, target, tg2Fraction)

def OnUnscrambleInvulnerable(event):
    target = event.object
    invPoints = int(event.string)
    if Object_Exists(target):
        FFX_ObjectSetAttr(target, 'invPoints', invPoints)

def OnUnscrambleToughGuy2(event):
    target = event.object
    tg2Fraction = float(event.string)
    if Object_Exists(target):
        FFX_ObjectSetAttr(target, 'tg2Fraction', tg2Fraction)
Title: Re: Invulnerability and Genetic Damage
Post by: BentonGrey on July 17, 2022, 02:12:01 AM
Oh man, this is awesome!  Thanks so much, Epi!  I'll have to experiment with this soon.