• Welcome to Freedom Reborn Archive.
 

melee not working

Started by Podmark, May 24, 2008, 10:29:03 PM

Previous topic - Next topic

Podmark

It's been a long time since I've played much FF and I'm on a new computer. I made up some new hero files in alex's newest EZhero and took them into the danger room using FF3. I ran into a major problem though - none of the heroes could use melee attacks! Anyone know how to fix this?

If it matters none of the meshes I'm using have been converted yet.

Previsionary

are these customs or "built ins"? I haven't made custom hero files using alex's tool, but I think this may be a case of the the melee distance values being incorrect. You might want to go into the hero editor inside of FFVTTR and check it + the animation out in the "create a character" screen and resave.

Podmark

they are customs and the problem is unique to these newly created files. I just checked a built-in Minute Man and a custom I'd made in game and they both work.

I've converted but that doesn't seem to have made a difference.

Podmark

Well I've pretty much narrowed it down to an error in EZhero. Anyone else ever have any problems like this?

Previsionary

Quote from: Podmark on May 24, 2008, 11:30:23 PM
Well I've pretty much narrowed it down to an error in EZhero. Anyone else ever have any problems like this?

Tomato had a similar problem in a mod but those were built in. That's why I suggested you open the custom characters you made with alex's tool in game and resave to see if the values reset. Otherwise, you may have to remake them or upload them for someone else to test and fiddle with.

stumpy

I just want to be sure: Which version of the game are you using, FF (which patch?) or FFvT3R? Which version of EZHero? And which version of FFX (if that's what you meant)?

I am assuming FFvT3R (North American release), EZHero 3.2, and FFX 3.2. (If it turns out you are playing the first game, I would try EZHero version 2.6, since melee distances aren't exactly the same between the two games.)

I haven't used Alex' tool for FFvT3R, but if you go into the RR with a custom that has the melee problem, you can get some info that might help determine what the issue is. Start an RR session with a problem hero in the squad, then open the console and enter
for char in getAllHeroes(): ShowHero(GetCharacterData(char))
Then post your script.log.

Podmark

Yeah it's FFvT3R (NA), EZHero 3.2, and FFX3.2.

The problem is definitely related to the EZhero because I fixed the melee attacks in-game by resetting the melee options.

I can post that script in a bit.

stumpy

If you look at the powers listings in your script.log and the melee powers have the lines
RangeMin = short
RangeMax = short

then there appears to be a bug in EZHero 3.2 that is setting the melee ranges improperly. From your description, I am almost certain that is what's going on.

It turns out I wrote some code a while back to correct a different issue that can be modified to deal with this one. Here is the modified code
# ChangeZeroMeleeRanges.py by stumpy, copyright 2008

# Adapted from ChangeAreaMeleeRanges.py

# Script to change the ranges of melee powers of custom heroes that
# have the both short and long ranges set to zero. This happens with
# powers created for custom heroes by EZHero 3.2 for FFvT3R
# characters.
#
# This quick'n'dirty implementation will change the min and max ranges
# of any melee power with short and long ranges equal to 0 to the
# specified values, which default to minRange=2 and maxRange=6, the
# FFvT3R defaults.
#
# Neither of these functions do anything to powers that aren't melee
# powers with zero ranges nor to powers for built-in characters.  Both
# print some info to the console about the powers or heroes where
# powers were changed
#
# A backup file is made for changed HERO file.
#
# I have designed this to run in game (from the console) to make it
# easier to use.  Because of that, there is no need to have the user
# enter the exact filenames since the datfiles module can figure that
# out on its own.
#
#
# For HERO files, use
#     ChangeZeroMeleeRanges_Custom(HeroFile, minRange=MIN_DEFAULT, maxRange=MAX_DEFAULT)
# or
#     ChangeZeroMeleeRanges_AllCustoms(HeroFolder='', minRange=MIN_DEFAULT, maxRange=MAX_DEFAULT).
#
# The first changes the power ranges for the custom hero specified as
# the first parameter to the function.  The HeroFile parameter is NOT
# optional, but it can be either a full pathname or just the name of
# the hero file itself
#
# The second _Custom function hunts through all the HERO files in the
# user's HEROES directory and changes any qualifying characters.  If
# the HeroFolder parameter is not given, the functio will try and find
# the standard folder where HERO files are kept and look through all
# the files there.
#
# The optional range parameters are
#
#     minRange: an integer (defaults to 1) that specifies the minimum
#         range that the powers are to have.
#     maxRange: an integer (defaults to 5) that specifies the maximum
#         range that the powers are to have.
#
# Example calls:
#     ChangeZeroMeleeRanges_Custom('kal.hero')
#     ChangeZeroMeleeRanges_Custom('kal.hero', minRange=0)
#     ChangeZeroMeleeRanges_AllCustoms().
#     ChangeZeroMeleeRanges_AllCustoms(maxRange=4).


# These are the defaults that will be used for ranges when the
# functions are called without specified range parameters.
MIN_DEFAULT = 2
MAX_DEFAULT = 6


from datfiles import *
import os
import os.path

def ChangeZeroMeleeRanges_Custom(HeroFile, minRange=MIN_DEFAULT, maxRange=MAX_DEFAULT):
    if not os.path.isfile(HeroFile):
        OrigFile = HeroFile
        HeroFile = os.path.join(GetHeroFilePath(),HeroFile)
    if not os.path.isfile(HeroFile):
        print 'ChangeZeroMeleeRanges_Custom: neither file <%s> nor <%s> were found. Quitting.' % (OrigFile,HeroFile,)
        return
    hero = Campaign_ReadHeroFile(HeroFile,ForceRead=1)
    powers = hero.get('powers')
    if not powers:
        print 'ChangeZeroMeleeRanges_Custom: no powers found for %s.' % hero['charName']
        return
    PowerNames = powers.keys()
    ZeroRangeMelees = filter(lambda p,powers=powers: ( powers[p].get('PowerType') == PT_MELEE ) \
                             and ( powers[p].get('RangeMin')==0 ) \
                             and ( powers[p].get('RangeMax')==0 ), PowerNames)
    if ZeroRangeMelees:
        skip = 0
        try:
            i = 1
            BackupFileName = '%s.bak' % (HeroFile,)
            while os.path.isfile(BackupFileName):
                i = i + 1   # first numbered .bak will be '.bak2'
                BackupFileName = '%s.bak%d' % (HeroFile,i)
            os.rename(HeroFile,BackupFileName)
        except OSError:
            print 'ChangeZeroMeleeRanges_Custom: Unable to create backup of file <%s>, possible Read-Only problem.  Skipping' % (HeroFile,)
            skip = 1
        except:
            print 'ChangeZeroMeleeRanges_Custom: Unable to create backup of file <%s>.  Skipping' % (HeroFile,)
            skip = 1
        if not skip:
            f = open(BackupFileName,'rb')
            dat = f.read()
            f.close()
            pos = 814
            for i in range(10):
                pname = string.split(dat[pos:],'\x00',1)[0]
                if pname in ZeroRangeMelees:
                    print 'ChangeZeroMeleeRanges_Custom: <%s> changing ranges for power %s' % (hero['charName'],repr(pname))
                    dat = dat[:pos+126] + chr(minRange) + chr(maxRange) + dat[pos+128:]
                pos = pos + 184
            f = open(HeroFile,'wb')
            f.write('%s' % dat)
            f.close()
    else:
        print 'ChangeZeroMeleeRanges_Custom: <%s> no area melee attacks found needing changed ranges' % hero['charName']

def ChangeZeroMeleeRanges_AllCustoms(HeroFolder='', minRange=MIN_DEFAULT, maxRange=MAX_DEFAULT):
    if not HeroFolder:
        HeroFolder = GetHeroFilePath()
    else:
        HeroFolder = os.path.abspath(HeroFolder)
    if not os.path.isdir(HeroFolder):
        print 'ChangeZeroMeleeRanges_AllCustoms: Folder <%s> not found. Quitting.' % (HeroFolder,)
        return
    files = os.listdir(HeroFolder)
    HeroFiles = filter(lambda f: string.lower(f[-5:])=='.hero', files)
    HeroFiles = map(lambda f,HeroFolder=HeroFolder: os.path.join(HeroFolder,f), HeroFiles)
    for HeroFile in HeroFiles:
        ChangeZeroMeleeRanges_Custom(HeroFile, minRange=minRange, maxRange=maxRange)


To use this to look through all your customs with the odd ranges for melee powers and set them to the FFvT3R standards:

  • First, create the file.

       
    • Use a plain text editor (like Notepad) paste the above code into a file.
    • Save the file as "ChangeZeroMeleeRanges.py" in the ..\Missions\Scripts folder of whatever mod you are running (in Notepad, you need the quotes, otherwise it will save the file as ChangeZeroMeleeRanges.py.txt which will not work).
    So, now you have a file like C:\Program Files\Irrational Games\Freedom Force vs The 3rd Reich\ffx3\Missions\Scripts\ChangeZeroMeleeRanges.py.

  • Now, run the change commands at the game console.

       
    • Start a Rumble Room session and open the console
    • Enter the two lines, one at a time:
      from ChangeZeroMeleeRanges import *
      ChangeZeroMeleeRanges_AllCustoms()
    • Watch a bunch of stuff scroll past (which you can look at in the script.log to see which HERO files were changed). (If trouble occurs, check here.)

  • You're done!
If you create more customs with EZHero, just run it again. It makes no changes to customs not needing changes.

If you are later running in a different mod than the one where you created the ChangeZeroMeleeRanges.py file and want to run it from that mod, you will need to copy the file to the new mod's ..\Missions\Scripts folder. (But, once a HERO file is fixed for one mod, it is fixed for all of them, at least until you use EZHero on it again. For instance, if you create IronMan.hero and run the code above from the FFX mod, there is no need to run it again to play the custom character in the Patriot City mod.)

If you want to run it just for individual HERO files, see the notes in the code.

I am not sure if he is too busy to fix things these days, but it would be a good thing to write Alex and let him know about this.

Podmark

wow thanks alot Stumpy, I didn't expect to actually get a fix about this. I'll try it out later today and let you know how it goes.

I'll let Alex know about it too.

abenavides

hey, thx for letting me know abut this podmark. I'll see if I can whip up a corrected EXE.

Just to be clear (it's been so long since I wrote this stuff :) ) - melee powers for FFv 3R heroes should be set to min=2 and max=6?

Is that the only thing required for the fix?

USAgent

Hi Alex, I dont want to jack a thread here but if you are interested in the bugs in the EZhero I could start a new thread or post them here. I have came across a few of them myself.

Thanks for stoping by!

stumpy

Hey, Alex!

Quote from: abenavides on May 26, 2008, 07:11:18 PMJust to be clear (it's been so long since I wrote this stuff :) ) - melee powers for FFv 3R heroes should be set to min=2 and max=6?

For normal melee powers, those are the right ranges [2,6].

For area melee powers (those with a non-zero arc), they should be set to [1,5]. I know it sounds like a small difference, but the second game treats the ranges a little differently and setting the max to 6 means objects too far away from the attacker get clobbered. That's an Irrational bug and the fix to that (ChangeAreaMeleeRanges()) already runs when the AI Generator does, so you cold probably let it slide, though (depending on whether EZHero leaves the ranges alone once they have been set) it could still bite people who make a change to an area melee power and don't re-run the IA Generator...

abenavides

usagent, happy if you want to set up a thread for ezhero fixes (no guarantees of course :) ).

Just PM me a link, cause I may never find it otherwise :)