Issue 57: FX recolouring

Started by Jimaras8, October 22, 2013, 01:13:44 PM

Previous topic - Next topic

spydermann93

#540
Quote from: Jimaras8 on October 27, 2017, 06:32:08 AM
Ok, spyder you kinda lost me there. I didn't change anything in  the datfiles.py and the power still workis in game without crashes. Do i still need to do that?


Also i have no idea where the m25ai file is or how to add the Ai tactic  :P. Every AI i have made is through the AI generator in-game.


Edit: Ok if i understand this correctly the campaignchangeactivedefense function is if you want the AD to be longer than 10 seconds. In my case 10 seconds is exactly the duration i want. So, do i still need to do the first paragraph that spyder wrote?

Ok, so you won't actually modify anything in the datfiles.py.

Do you have anything that can run python scripts? If not, download this: http://www.mediafire.com/file/8pvl4i96grgqu6l/FFvtTR_Ghosting_Fix.zip

In it, there will be a readme file. Go ahead and follow the instructions in that file. After you go through it, you will have PythonWin installed.

From there, you will right-click on the datfiles.py in your ffx3/Missions/Scripts folder and select "Edit with PythonWin"

Once that window is up, follow the instructions above.

While you might have this particular AD working just the way you want it, there might be some ADs that you'll want to last longer than 10 seconds. Following the method in my previous post will allow for ADs that have Medium (20) and Long (30) durations, and more.

Another technique is just creating a dummy character in EZHero, give that character an AD that is exactly how you like it, then import that character with EZHero. That will put the AD in the game, but if you ever edit that power in FFEdit, you'll have to import the AD again.

As for the m25AI tactic for FFAD, you can find it in the ffx3/Manual/index.html file. Just open that file in any browser of your choice and go to the AI Tactics section. There is a LOT to learn in there and it's a really good read.

Jimaras8

Ah, pythonwin, i have that and i have used the ghost fix before. It's a good method to remember. My main concern now is the m25ai tactic. if i understand it correctly if i don't put it in when the character is controlled by the AI he won't use the AD even if it's fully functional? That's a problem considering graviton is a glass cannon. So i go to the tactic section and i will know what i need to do next?

Jimaras8

I'm sorry another thing i need to clarify. In the tactics when i should put the power name does it mean the FFEdit power name? graviton's AD is called mvgraviton_s in FFedit.

spydermann93

You shouldn't have to specify it in the tactics

Here's what you use for FFActiveDefense:

"TActiveDefenseFFRemote(pct=50, time=3, energy=33, mindist=0, maxdist=200, type='friend', subtype='not active_defense', situation='none', role='none', priority='medium')",

Use the FF Active Defense Remotely on an ally.

"TActiveDefenseFFSelf(pct=100, time=3, energy=33, mindist=0, maxdist=400, type='enemy', subtype='none', situation='not active_defense', role='none', priority='medium')",

Use the FF Active Defense on yourself.


You can adjust all of the parameters, but since a character can only have one FFActiveDefense, there is no need to specify any names.

This tactic is NOT to be confused with the ActiveDefense tactic:

"TActiveDefense('power name', pct=80, time=3, energy=None, mindist=0, maxdist='long', type='enemy', subtype='none', situation='not displaced', role='none', priority='high', defense_time=None)",

Notice that this tactic is TActiveDefense() while the tactic for the FFActiveDefense attribute is TActiveDefenseFFRemote() or TActiveDefenseFFSelf()

BentonGrey

I'm really glad you got it working, Jim!  I am far from certain, but I wonder if the culprit might be the space in the name.  Despite the fact that the default powers have spaces, FFEdit and the system sometimes doesn't like spaces.  I try to avoid them in whatever I do.  You're right in that it shouldn't have been the name length, but I was grasping at straws.

Thanks for the duration change instructions, Spyder!  I've always just copied an existing AD that I knew was the length I wanted, because that functionality is missing from FFEdit.

Also, thanks for the AI info!  I need that as well!
God Bless
"If God came down upon me and gave me a wish again, I'd wish to be like Aquaman, 'cause Aquaman can take the pain..." -Ballad of Aquaman
Check out mymods and blog!
https://bentongrey.wordpress.com/

spydermann93

#545
Quote from: BentonGrey on October 27, 2017, 06:27:07 PM
I'm really glad you got it working, Jim!  I am far from certain, but I wonder if the culprit might be the space in the name.  Despite the fact that the default powers have spaces, FFEdit and the system sometimes doesn't like spaces.  I try to avoid them in whatever I do.  You're right in that it shouldn't have been the name length, but I was grasping at straws.

Thanks for the duration change instructions, Spyder!  I've always just copied an existing AD that I knew was the length I wanted, because that functionality is missing from FFEdit.

Also, thanks for the AI info!  I need that as well!

Copying the power, at least in my experience, has always reset the Active Defense length to short. Using that script was the only way I could get an FFAD to be longer than 10 seconds.

Now, I haven't fully and extensively tested that, but maybe the original active defenses don't get their length changed when copied?

And don't thank me on the m25AI info. It's all in that wonderful manual. There are a lot of really good nuggets of info in there, and it's just amazing that so much documentation was written for it. Big props to Dr Mike and M25! If anybody else has written to that doc, my thanks to you guys and gals, too!

EDIT: I took a look at the FFADs in your MA mod, Benton, and it does seem like you're right! That's really handy to know. Perhaps it's just when you save an ffactivedefense that it resets to short? hmmm...

Jimaras8

Quote from: spydermann93 on October 27, 2017, 06:25:12 PM
You shouldn't have to specify it in the tactics

Here's what you use for FFActiveDefense:

"TActiveDefenseFFRemote(pct=50, time=3, energy=33, mindist=0, maxdist=200, type='friend', subtype='not active_defense', situation='none', role='none', priority='medium')",

Use the FF Active Defense Remotely on an ally.

"TActiveDefenseFFSelf(pct=100, time=3, energy=33, mindist=0, maxdist=400, type='enemy', subtype='none', situation='not active_defense', role='none', priority='medium')",

Use the FF Active Defense on yourself.


You can adjust all of the parameters, but since a character can only have one FFActiveDefense, there is no need to specify any names.

This tactic is NOT to be confused with the ActiveDefense tactic:

"TActiveDefense('power name', pct=80, time=3, energy=None, mindist=0, maxdist='long', type='enemy', subtype='none', situation='not displaced', role='none', priority='high', defense_time=None)",

Notice that this tactic is TActiveDefense() while the tactic for the FFActiveDefense attribute is TActiveDefenseFFRemote() or TActiveDefenseFFSelf()

Ok spyder just one more thing before i put it in the m25aidata file. If i just copy/paste the line you posted in the graviton section without any specification since it's his only FF Active Defense will it work? Also does it matter if paste the line in the end or in the middle of the section. Graviton's section btw looks like this:

['mvgraviton',
   ['target enemy',
      'weakness_melee_crushing',
      'not staticked',
      'weakness_ranged_crushing',
      'weakness_area_crushing',
      'weakness_direct_crushing',
   ],
   ["timer", 'auto',
      'TUseRemedy()',
      "TFleeMelee(mindist='medium',movetype='fly',time=0.88)",
      'TFleeMelee(type="any",subtype="emitting_damage",time=0.88)',
      'TTK()',
      'TArea("mvgraviton newton\'s theory",time=1.27)',
      "TArea('mvgraviton gravitational hold',time=2.07)",
      'TArea("mvgraviton jupiter\'s gravity",time=1.27)',
      "TDirect('mvgraviton 200 g-force',time=1.27)",
      "TRanged('mvgraviton graviton blast',time=1.27)",
      "TDirect('mvgraviton 0 g-force',time=1.27)",
      "TDirect('mvgraviton graviton cocoon',time=1.27)",
      "TRanged('mvgraviton maximum gravity be',time=1.27)",
      "TMelee('mvgraviton megalomaniac punch',time=1.4)",
      'TLand()',
      'TMoveTo(mindist=\'long\' ,subtype="not emitting_damage",time=0.88)',

spydermann93

Yes, it will be the only AD he'll use since you can only have one FFActiveDefense on a character at a time.

Placement only matters if you want to alter the "priority" of the power. What happens is that the AI will go down the list of powers in the AI file and randomly land on one. Powers higher on the list will typically be used more often, but you can alter the parameters of the power to give it a higher priority.

Typically, defenses are usually placed right before the offensive powers, but after the "flee melee" lines and the occasional FFX attributes, but you can place it wherever you want it. Below is a very simple example:

['mvgraviton',
   ['target enemy',
      'weakness_melee_crushing',
      'not staticked',
      'weakness_ranged_crushing',
      'weakness_area_crushing',
      'weakness_direct_crushing',
   ],
   ["timer", 'auto',
      'TUseRemedy()',
      "TFleeMelee(mindist='medium',movetype='fly',time=0.88)",
      'TFleeMelee(type="any",subtype="emitting_damage",time=0.88)',
      'TTK()',
      TActiveDefenseFFSelf(time=3, type='enemy', situation='not active_defense')
      'TArea("mvgraviton newton\'s theory",time=1.27)',
      "TArea('mvgraviton gravitational hold',time=2.07)",
      'TArea("mvgraviton jupiter\'s gravity",time=1.27)',
      "TDirect('mvgraviton 200 g-force',time=1.27)",
      "TRanged('mvgraviton graviton blast',time=1.27)",
      "TDirect('mvgraviton 0 g-force',time=1.27)",
      "TDirect('mvgraviton graviton cocoon',time=1.27)",
      "TRanged('mvgraviton maximum gravity be',time=1.27)",
      "TMelee('mvgraviton megalomaniac punch',time=1.4)",
      'TLand()',
      'TMoveTo(mindist=\'long\' ,subtype="not emitting_damage",time=0.88)',


Jimaras8

Thanks a lot pyder and everyone who has chimed in. Coding always scared but i think i learned  thing or two the past days. You have been a huge help. I will try it and i ill report back  :D.

Jimaras8

Ok, so i put Spyder's line in the m25aidata and he now uses the AD in-game although sparingly. The file looks like that:

['mvgraviton',
   ['target enemy',
      'weakness_melee_crushing',
      'not staticked',
      'weakness_ranged_crushing',
      'weakness_area_crushing',
      'weakness_direct_crushing',
   ],
   ["timer", 'auto',
      'TUseRemedy()',
      "TFleeMelee(mindist='medium',movetype='fly',time=0.88)",
      'TFleeMelee(type="any",subtype="emitting_damage",time=0.88)',
      'TTK()',
                "TActiveDefenseFFSelf(time=3,type='enemy',situation='not active_defense')",
      'TArea("mvgraviton newton\'s theory",time=1.27)',
      "TArea('mvgraviton gravitational hold',time=2.07)",
      'TArea("mvgraviton jupiter\'s gravity",time=1.27)',
      "TDirect('mvgraviton 200 g-force',time=1.27)",
      "TRanged('mvgraviton graviton blast',time=1.27)",
      "TDirect('mvgraviton 0 g-force',time=1.27)",
      "TDirect('mvgraviton graviton cocoon',time=1.27)",
      "TRanged('mvgraviton maximum gravity be',time=1.27)",
      "TMelee('mvgraviton megalomaniac punch',time=1.4)",
      'TLand()',
      'TMoveTo(mindist=\'long\' ,subtype="not emitting_damage",time=0.88)',

In order for him to use it more do i have to add a priority value in the end? Make it priority=high?

spydermann93


Jimaras8

Unfortunately it didn't  :(. I put a priority='high' in the end of the sentence and it caused him to not use it all in-game. In order for you to get the picture in an average 10 minute RR of Absorbing Man (me) vs Graviton (AI) graviton used the AD 3-4 before the priority line. After i put it in the end he didn't use the power at all. I also noticed that after the altering he didn't chase me throughout the man and stayed in one spot. Something changed int he AI? Again for reference this is how graviton's ai looks in the m25aidata file:

['mvgraviton',
   ['target enemy',
      'weakness_melee_crushing',
      'not staticked',
      'weakness_ranged_crushing',
      'weakness_area_crushing',
      'weakness_direct_crushing',
   ],
   ["timer", 'auto',
      'TUseRemedy()',
      "TFleeMelee(mindist='medium',movetype='fly',time=0.88)",
      'TFleeMelee(type="any",subtype="emitting_damage",time=0.88)',
      'TTK()',
                "TActiveDefenseFFSelf(time=3,type='enemy',situation='not active_defense')",
      'TArea("mvgraviton newton\'s theory",time=1.27)',
      "TArea('mvgraviton gravitational hold',time=2.07)",
      'TArea("mvgraviton jupiter\'s gravity",time=1.27)',
      "TDirect('mvgraviton 200 g-force',time=1.27)",
      "TRanged('mvgraviton graviton blast',time=1.27)",
      "TDirect('mvgraviton 0 g-force',time=1.27)",
      "TDirect('mvgraviton graviton cocoon',time=1.27)",
      "TRanged('mvgraviton maximum gravity be',time=1.27)",
      "TMelee('mvgraviton megalomaniac punch',time=1.4)",
      'TLand()',
      'TMoveTo(mindist=\'long\' ,subtype="not emitting_damage",time=0.88)',

spydermann93

hmm... looks like I have some experimenting to do

Cyber Burn

Ok!!! What language are you guys speaking already???  :banghead:

spydermann93

#554
Hey Jim,

Try something like this line:

"TActiveDefenseFFSelf(pct=60,mindist=100,time=4,,situation=['not active_defense','higherenergy 66'],priority=50)",

Also, make sure that you don't have the power tabbed like your text. I'm not sure if it's that way in your m25ai file, but try keeping all of the lines aligned.

For example, here's my Spider-Man file:

['m spider-man',
["target enemy",
'weakness_melee_crushing',
'not staticked',
'weakness_ranged_crushing',
],
["timer", 'auto',
'TUseRemedy()',
"TActiveDefenseFFSelf(pct=60,mindist=100,time=4,,situation=['not active_defense','higherenergy 66'],priority=50)",
'TFleeMelee(type="any",subtype="emitting_damage",time=3)',
"TRangedCone('funnel web',time=3)",
"TMelee('acrobatic spider',time=2.84)",
"TRanged('tangling webs',time=3)",
"TRanged('web bullet',time=3)",
"TMelee('spidey sting',time=2.8)",
'TThrow(pickup_time=3,throw_time=3)',
'TMoveTo(mindist=\'medium\' ,subtype="not emitting_damage",time=3)',
],
]


EDIT: Also, if you need any help with this, Cyber, just let me know and I'll do my best to assist ya. I'm in the process of learning how this all works, but I *think* I'm starting to get a handle on it.

Jimaras8

#555
The thing is that my AD has 33 energy cost and i prefer it this way so will this change the cost of the power? Oh and the lines are perfectly aligned in the file, it's just a weird thing that happens when i paste it here.

Jimaras8

#556
Copied/pasted the line exactly as you wrote it spyder and it didn't work. now he floats completely inactive.

Edit: I don't know if it's any help to you spyder but so far the only line that has worked sufficiently in-game was the first one you gave me when only the necessary values:
"TActiveDefenseFFSelf(time=3, type='enemy', situation='not active_defense')

The only problme i had with this one was the frequency he used the AD. otherwise he was moving and using all his abilities. I don't know if this helps clear this whole situation up.

spydermann93

I'm wondering if it's because he is flying. I notice that whenever I have my characters use it (when controlled by me), they land before using the power.

My Spider-Man has Rope-Swinger, so he lands after a while, and it may have been coincidental. I'll have to play around with it some more.

Jimaras8

Yes there is something weird about it. When i play the character and every character with a FF AD they have to land to use it. Graviton as AI can use it in the air. It's weird.

spydermann93

#559
Ok, so I was fiddling around with it and I think I found the answer.

In the m25ai.py file, there is a function that handles how the AI uses the TActiveDefenseFFSelf() tactic:

def TActiveDefenseFFSelf(tactic_id, char, object, flt, user, pct=50, time=1, energy=None, mindist=0, maxdist=200, type='enemy', subtype='none', situation='none', role='none', priority=TACTIC_PRIORITY_MEDIUM):
if ffx.FFX_ObjectGetAttr(char,'ffactivedefenseMaxHP')==0:
return 0
target = Target_GetCurrentTarget(char,type,subtype)
defense_time = ffx.getByTemplate(char,FFX_FFACTIVEDEFENSE_CUSTOM,3)
power = ffx.getByTemplate(char,FFX_FFACTIVEDEFENSE_CUSTOM,2)
epCost = ffx.getByTemplate(char,FFX_FFACTIVEDEFENSE_CUSTOM,7)
if not AISupport_CheckConditions(char, target, Target_GetDistance(char,type), pct, priority, mindist, maxdist, subtype, situation, role, energy=epCost):
return 0
if ffx.FFX_ObjectGetAttr(char,'ffactivedefenseSelf',0)==1:
return 0
turnTo(char,target)
AISupport_DoFunction(char, 'ffx.OnffActiveDefense(%s,%s)'%(`char`,`char`), target, priority, time, desc='ff active defense')
AddRole(char,power)
AddRole(char,'active_defense')
ffx.FFX_ObjectSetAttr(char,'ffactivedefenseSelf',1)
m25event.SetTimer(defense_time,'AIActiveDefenseOff',char,power)
return 1


There is also a function that dictates how the AI handles the TActiveDefense() tactic:

def AIGenericActiveDefense(tactic_id, char, object, flt, user, power='', defense_time=20, pct=80, time=3, energy=0, mindist=0, maxdist=m25distance.DISTANCE_LONG, type=TARGET_ENEMY, subtype=None, situation=None, role=None, priority=TACTIC_PRIORITY_HIGH, desc='active defense'):
target = Target_GetCurrentTarget(char)
if not AISupport_CheckConditions(char,target,Target_GetDistance(char),pct,priority,mindist,maxdist,subtype,situation,role,energy):
return 0
AISupport_DoSelfPowerTimed(char, power, target, priority, time, desc)
AddRole(char,power)
AddRole(char,'active_defense')
m25event.SetTimer(defense_time,'AIActiveDefenseOff',char,power)
return 1


Notice that there is a difference in the parameters of the two functions. AIGenericActiveDefense() has a pct of 80 and a priority of HIGH while TActiveDefenseFFSelf() has a pct of 50 and a priority of MEDIUM. Well, I copied those parameters from TActiveDefense() and this is what I got:

def TActiveDefenseFFSelf(tactic_id, char, object, flt, user, pct=80, time=1, energy=None, mindist=0, maxdist=200, type='enemy', subtype='none', situation='none', role='none', priority=TACTIC_PRIORITY_HIGH):
if ffx.FFX_ObjectGetAttr(char,'ffactivedefenseMaxHP')==0:
return 0
target = Target_GetCurrentTarget(char,type,subtype)
defense_time = ffx.getByTemplate(char,FFX_FFACTIVEDEFENSE_CUSTOM,3)
power = ffx.getByTemplate(char,FFX_FFACTIVEDEFENSE_CUSTOM,2)
epCost = ffx.getByTemplate(char,FFX_FFACTIVEDEFENSE_CUSTOM,7)
if not AISupport_CheckConditions(char, target, Target_GetDistance(char,type), pct, priority, mindist, maxdist, subtype, situation, role, energy=epCost):
return 0
if ffx.FFX_ObjectGetAttr(char,'ffactivedefenseSelf',0)==1:
return 0
turnTo(char,target)
AISupport_DoFunction(char, 'ffx.OnffActiveDefense(%s,%s)'%(`char`,`char`), target, priority, time, desc='ff active defense')
AddRole(char,power)
AddRole(char,'active_defense')
ffx.FFX_ObjectSetAttr(char,'ffactivedefenseSelf',1)
m25event.SetTimer(defense_time,'AIActiveDefenseOff',char,power)
return 1


Once I got that written, I also went to my heroName.m25ai file and added this line:

"TActiveDefenseFFSelf(time=2.0,situation='not active_defense')",

It is very simple, but it's all that I need for right now.

I launched the game and tested it, and now the AI actively uses and reuses the FFActiveDefense! Hurray!

One thing to note is that the AI will wait, at a minimum, the amount of time that you specified in your FFX_FFACTIVEDEFENSE_CUSTOM section of the ffxcustom2.py file to use the FFActiveDefense again. I'm going to toy around with it some more to try and get the AI to reuse the FFActiveDefense as soon as its HP runs out, but I don't think that this function is updated every second like the functions in the ffx.py.

For those that want the AI to prioritize FFActiveDefense, here's the file: http://www.mediafire.com/file/em98ivdiulf53dd/m25ai.zip

Jimaras8

This looks like a lot of homework spyder. Sorry i wnet AIWOL everyone, my studies were left behind and i had to catch up. I have played in over a month so now that i have some free time i can test spyder's results. I have to tell you spyder this thing has been a pain, hasn't it  :D.


Anyway, i have a huge favor to ask. I have LP's excellent Baslisk skope but it does't have keyframes for ranged eye attacks. Basilisk's main power are his optic blasts so it's a little weird that he has animations that use his hands. is it possible for someone to add some eye animations like Gren's Superman has?

Cyber Burn

If you don't mind waiting a few days, I'll look into it for you (Unless someone beats me to it).

Jimaras8

I don't mind at all CB. The skope is superb, it just needs a couple more animations for the character to feel accurate.

Jimaras8

Spyder, i have one question with your method. Where are the individual m25ai for every character located? i thought the ais go straight to characters.dat once you add them.

spydermann93

Quote from: Jimaras8 on December 15, 2017, 07:18:58 PM
Spyder, i have one question with your method. Where are the individual m25ai for every character located? i thought the ais go straight to characters.dat once you add them.

Depends.

If it's a custom character, it goes to the same place as your hero files.

If it's a built-in character (or one that gets imported), you can find all of their AI data in the "modname/Missions/Scripts/m25aidata.py" file.

Jimaras8

I asked you because i went to my local folder and i found a mvgraviton.m25ai file. I guess it remained since the time he was a custom character before i added him to the dat. So if i get this straight since i haven't played with pys for over a month. If i just replace the m25.ai file in the scripts folder with the one you made and i just add the line you added in the character's ai file, i'm done?

spydermann93

Quote from: Jimaras8 on December 16, 2017, 10:38:28 AM
I asked you because i went to my local folder and i found a mvgraviton.m25ai file. I guess it remained since the time he was a custom character before i added him to the dat. So if i get this straight since i haven't played with pys for over a month. If i just replace the m25.ai file in the scripts folder with the one you made and i just add the line you added in the character's ai file, i'm done?

1) Yeah, it's just left-over. It is no longer used for Graviton, so you can remove it. You can now see Graviton has his own section in the m25aidata.py file. That's the section that you'll want to modify from now on (since he's built-in).

2) Yeah, you can replace it. Unless you've made your own changes to the file, it should bother anything. Just make sure that you make a backup of your current m25ai.py file, just in case.

3) Then yeah, you can add the line that I have to Graviton's section in the m25aidata.py file. He should be using his FFActiveDefenses if everything was modified correctly.

Jimaras8

Oh, so the leftovers for branded characters in the local folder are useless. Good to know. I assumed they were but i kept them just in case. I haven't changed anything in thee m25ai. The only script files i have tampered with are ffxmulti, ffxcustom2 and m25aidata. The rest are unchanged.

Jimaras8

Sop, i have a couple of Lp's skopes and i have noticed that when i convert the tga to dds in the skin folder the skin appears to glow in-game. I recall benton having a similar problem with Lp's Rogue mesh but he sorted it somehow. What can i do?

Cyber Burn

Can you take a screenshot of what the glow looks like? I don't remember this one.