• Welcome to Freedom Reborn Archive.
 

clarification on subtypes

Started by Podmark, May 14, 2007, 04:25:33 PM

Previous topic - Next topic

Podmark

Just getting into the new FFX stuff. Now I've been reading the manual and I'm quite intrigued by the subtype scripting, but I'm not quite sure how I set it up and how exactly it works. Here's what I think I know, please correct me if wrong:

-material subtypes override character material types selected in in-game hero editor (resistances still used)
-attributes like magnetic and  absorber will use the subtypes
-subtypes have to be set in the m25aidata.py, in this section of a hero:

['subtype',
            'sonic', #Subtype Section
            'magnetism',
],

so some questions:
-do attacks like 'magnetic pull' use the subtypes?
-how many subtypes can a character have?
-material and power subtypes, do they go in the same spot

So I could create a hero file for the X-Man Wolverine that would be both 'flesh' and 'adamantium', and possibly 'pierce_weapon', and that would make him targetable by magnetic attacks and could have absorb metal and absorb_metal_attack on them, correct? Or a file for the Avengers villain Ultron which would have the subtypes 'adamantium', 'energy_vision', and 'robot'.

Is there anything I'm missing? Thanks for the help guys.

TaskMasterX

Quote from: Podmark on May 14, 2007, 04:25:33 PM
-material subtypes override character material types selected in in-game hero editor (resistances still used)
Correct.

Quote from: Podmark on May 14, 2007, 04:25:33 PM
-attributes like magnetic and  absorber will use the subtypes
Yes. And Amplifier uses some subtypes, too. I think those are it.

Quote from: Podmark on May 14, 2007, 04:25:33 PM
-subtypes have to be set in the m25aidata.py, in this section of a hero:

['subtype',
            'sonic', #Subtype Section
            'magnetism',
],
Correct for Built-in characters. Custom Characters use their .m25ai file which you have to add the subtype section there, too.

Quote from: Podmark on May 14, 2007, 04:25:33 PM
so some questions:
-do attacks like 'magnetic pull' use the subtypes?
I don't think so. Although getting it to use the subtypes should be easy.

Quote from: Podmark on May 14, 2007, 04:25:33 PM
-how many subtypes can a character have?
I'm not aware of a limit. M25 should be able to tell us exactly.

Quote from: Podmark on May 14, 2007, 04:25:33 PM
-material and power subtypes, do they go in the same spot
Yes. All subtypes go into the same section.

Quote from: Podmark on May 14, 2007, 04:25:33 PM
So I could create a hero file for the X-Man Wolverine that would be both 'flesh' and 'adamantium', and possibly 'pierce_weapon', and that would make him targetable by magnetic attacks and could have absorb metal and absorb_metal_attack on them, correct? Or a file for the Avengers villain Ultron which would have the subtypes 'adamantium', 'energy_vision', and 'robot'.
When you use the Absorb Metal Attack command it turns the character into metal, not adamantium. I was thinking only about bullets and knives, etc. in the case of the pierce_weapon subtype. The Absorb Metal Attack command has a greater range, like the "Absorb Radiation Attack","Absorb Energy Attack", etc. of the Absorb Energy attribute, than the regular Absorb Adamantium, Absorb Metal, etc. commands and is meant for absorbing ranged metal piercing attacks. I guess I could easily update the code to check if the character is made of adamantium or super_alloy and create a command for incoming adamantium or super_alloy pierce attacks.
As for Ultron, because you have the robot subtype, Power Absorbers would never be able to absorb his powers, therefore his energy_vision subtype is unneeded. Material Absorber's would have an Absorb Adamantium command and Energy Absorbers would have an Absorb Incoming Energy Attack, but only if Ultron has a ranged energy Power, not because the energy_vision subtype is there.
Hope that helps. Feel free to ask more questions, though!

M25

There is no limit on the number of subtypes a character can have.


Podmark

Ok thanks alot guys, that really clears things up for me.

TaskmasterX, now that I know what 'pierce_weapon' subtype is meant for it makes prefect sense. I don't think you'd need to change it. If you can adjust the state swap attacks to account for subtypes I think that would be a really good idea.

I'm a huge fan of subtypes idea, I think they're a great addition to the game.

TaskMasterX

Okay, to get MagneticPull and MagneticThrow to use the subtypes, look for "def pullCheck" (w/out quotes) in ffx.py and replace the code with this:

def pullCheck(char,intensity,metalonly=0):
    #Ep./Kuertee 2006-09-10: Prevent the map itself (whose template is '') from appearing in that list
    staticObjects = list( Mission_GetObjects() )
    staticObjects.remove( Object_GetTerrain() )
    for obj in staticObjects:
        if obj!=char:
            if Object_GetAttr(obj,'physical'):
                subtype = m25ai.FindTacticType(obj, 'subtype')
                if (metalonly==0) or (Object_GetAttr(obj,'material')==FFX_MATERIAL_METAL) or ('metal' in subtype) | ('adamantium' in subtype) | ('super_alloy' in subtype):
                    if distanceSq(obj,char)<40000:
                        makepull(obj,char,intensity)


For MagneticThrow, find "def throwCheck" and replace the code with:
def throwCheck(char,intensity,metalonly=0):
    #Ep./Kuertee 2006-09-10: Prevent the map itself (whose template is '') from appearing in that list
    staticObjects = list( Mission_GetObjects() )
    staticObjects.remove( Object_GetTerrain() )
    for obj in staticObjects:
        if obj!=char:
            if Object_GetAttr(obj,'physical'):
                subtype = m25ai.FindTacticType(obj, 'subtype')
                if (metalonly==0) or (Object_GetAttr(obj,'material')==FFX_MATERIAL_METAL) or ('metal' in subtype) | ('adamantium' in subtype) | ('super_alloy' in subtype):
                    if distanceSq(obj,char)<40000:
                        makethrow(obj,char,intensity)


For Magnetize to use the subtypes, find "def getMetals" in ffx.py and replace it with:

def getMetals():
    global metals
    if len(metals)==0:
        for name in Mission_GetObjects():
            if Object_GetClass(name)&FFX_CHARACTER==0:
                subtype = m25ai.FindTacticType(name, 'subtype')
                if Object_GetAttr(name,'material')==1 | ('metal' in subtype) | ('adamantium' in subtype) | ('super_alloy' in subtype):
                    metals.append(name)
    return metals


This will allow these powers to be used on any character with 'metal','adamantium', or 'super_alloy' in their subtypes. Keep in mind that you'll have to add these subtypes to the AI tactic for the power to get the AI to use them correctly.
Also, the Magnetic Attribute is already set to use these three subtypes as well as the AI tactic for them too, so you don't need to add the subtype= parameter to the tactic for the Magnetic Attribute.

These are untested, so I hope it works. Report back if you have any problems.

Podmark

Thanks, I'll let you know how it goes when I try it. However I don't get much time to play the game so if anyone else tries them please let Taskmaster know.

apfarmakis

Say you've set up a series of special combo attributes called Green Lantern (Levels 1-3) and you want a character to absorb their energy via an existing attribute like urbandweller.

I know that you would define this in the M25AI file but how would you set up a new subtype and where would you put the code?


TaskMasterX

I hope I understand your question correctly. If you want to have a character with the UrbanDweller absorb energy from nearby characters that have the GreenLantern Combo Attribute, you'll need a new Query Function, like the ones listed in the FFX3.2 Manual, not a new subtype. (like isBuilding, isEnergyX, etc.) isParasite() looks like something that could be modified to do what you need. Maybe something like this might work?
def isGreenLantern(obj,char=''):
    if not (Object_Exists(obj) and Object_Exists(char)):
        return 0
    if obj != char:
        if hasAttribute(obj, 'greenlantern1') | hasAttribute(obj, 'greenlantern2') | hasAttribute(obj, 'greenlantern3'):
                return 1
    return 0

greenlantern1,greenlantern2,etc. are the names of the attribute as shown in FFEdit. You'd add the above code to your ffx.py file and then you'd need to open up the ffxdefault.py file and add
["isGreenLantern"],
to the FFX_TRIGGERS=[] list so it would appear in the drop-down list when customizing the UrbanDweller attribute in FFXCC.