Crack Into Lower Costs for Powers script and more...

Started by blackjacket, December 09, 2009, 03:30:38 AM

Previous topic - Next topic

blackjacket

Hello, this is my first post.  I decided to share some of the work I've done behind doors with some coding and also see if there's any ideas for other scripts i'd like to develop.

Now I'm not sure if anyone's come out with a way to use extra cost types like minor or trace, but I've got a way to do it.  From what I've found, there're 6 levels of cost built in to FFVTR and you can designate a power to have one of those 6 costs.  I think these six costs work a little different than FF because they go from highest to lowest, high, medium, low, than 3 lower than low costs.  I haven't discovered any other cost levels, but then I never tried hard enough to find them.  Anyway, the first thing I do is make a power or two built-in, let's say.. "WLV Bloodlust" and "WLV Certain Death" for Wolverine.  I then create an attribute that will be called to run the cost script, let's call it "wolver".  In ffx.py or an external .py that's called by ffx.py (i use external script sinc ei have a ton of scripts), I would put in this script:

def wolver(char,update=0):
   if update==0:
      bloodlust = datfiles.Campaign_ReadPowers()['WLV Bloodlust']
      bloodlust['EPCost']=1
      certaindeath = datfiles.Campaign_ReadPowers()['WLV Certain Death']
      certaindeath['EPCost']=3
      datfiles.Campaign_RewritePowers(ChangePowers=[bloodlust,certaindeath])
      loadPowers()

Next, I created a character that's a clone of "-----------" called "costtiggot" which will carry all each cost attribute by possessing a multi attribute called "costattrib" (e.g. ['costattrib','wolver','captvi', etc, etc],).  Finally, I run a rumble room session with "costtiggot" character to load the powers and change the power.dat file.  This is important to keep in mind, THIS SCRIPT WILL CHANGE THE POWERS.DAT FILE!! so keep a backup of your powers.dat file if you're antsy.  You may have to restart the rumble room for the costs to take effect if you're playing rumble room, but once you've done it once you won't have to do it again in any game session, whether it's rumble room or campaign.  However, any time you quit the game and start up again, you will need to run costtiggot.

blackjacket

Now, I've got some other ideas and have been looking for more effective execution of these ideas.  The first would be a power/attribute progression script for given characters during campaign.  Let's use black knight iii as an example.  What I want him to do, is as he gains more cp that's unused, his special attribute labeled "blackknightiii" will grant him new attributes that pertain to him.  So first I'll make an attribute called "blackknightiii" that black knight iii (campaign version) will possess.  Then I make a script for this attribute which will call the update script for progression:

def blackknightiii(char,update=0,remove=0):
   if update==0:
      FFX_ObjectSetAttr(char,'upgrade',0)
      RegTimer('updateblackknightiii',1,0,char)

Then i make the update script in ffx.py or an outside script that's called from the previous script which will give black knight iii new attributes with more cp amd loop the update:

def updateblackknightiii(event):
   char=event.object
   update=0
   blackknightiii = GetCharacterData(char)
   upgraded=FFX_ObjectGetAttr(char,'upgrade')
   if blackknightiii['CP']>=600:
      if upgraded<1:
         initcoordinator(char,update)
         FFX_ObjectSetAttr(char,'upgrade',1)
   if blackknightiii['CP']>=850:
      if upgraded<2:
         inittelepathy(char,update)
         FFX_ObjectSetAttr(char,'upgrade',2)
   if blackknightiii['CP']>=1850:
      if upgraded<3:
         initffactivedefense10(char,update)
         FFX_ObjectSetAttr(char,'upgrade',3)
   if blackknightiii['CP']>=2850:
      if upgraded<4:
         initffqimmortal(char,update)
         FFX_ObjectSetAttr(char,'upgrade',4)
   RegTimer('updateblackknightiii',0.1,0,char)

So as you can see, when black knight iii has 600 unused cp, he gets the coordinator attribute.  When he get's 850 cp, he gets the telepathy attribute (i use it for his detect magic power).  And so on and so forth.  Now, this script is unperfected.  So far the attributes load when a new map loads. So, the attributes won't kick in immediately.

Now I was wondering if anyone had input on how to make a menu come up for the player to choose which attributes to buy with cp.  I'm thinking perhaps a multi-attribute could be created as an array as new attributes are purchased.  The intention would be to buy more than 5 attributes over the course of a character's career. So i guess i'm asking how to pull up a menu and create arrays during game.  Thanks for any input.

blackjacket

Once again, I was looking to see if anyone had any ideas on how to implement certain effects.

The first would be for a character with a melee with 3 contacts.  Is there any way to assign different damage types for each contact.  E.g.   pierce damage for 2 claw slashes and crush damage for a final kick in one animation.

Second would be diving/charging attacks, like wolverine's drill claw.  I was thinking using something along the lines of living laser, using the mesh of wolverine himself as the projectile.. any ideas would be appreciated.

I've noticed that with even multiple leave_hands in an animation, that an area will only happen once in the attack..any way around that?

Finally, i've been trying to find a workaround for ffvtr's problem for the speeding bullet/sprint animation only being "run".

Any ideas would be great. Thanks

yell0w_lantern

#3
I understand only a very tiny part of what you are saying.

One of the other code-savvy guys (Epimethee?) had a little bit about the energy system. He said there was stil the old system buried in FFv3R although the actual costs had changed so that low, medium and high were 33, 66 and 100, respectively.

Trace
Minor
Very Low
Low
Medium
High
Extreme

Hmm, was there a 'Very High' in FF1? I don't remember.
Yellow Lantern smash!

blackjacket

Yep, i've got that.  The first post i put describes how to use the old system in ffvtr.  But it requires making 'built-in' powers and then calling a script to alter those powers in the powers.dat.

Thanks for the reply.

DrMike2000

Thanks, Yellow Lantern, for drawing my attention to this.

Blackjacket - this is way cool!
I managed to restore a bit of original FF's old glory by hacking everyone's energypoints to 105 instead of 100 - that allowed you to attempt to overcharage powers some more. But this is great.

I'm puzzled a bit though.
You're finding powers and assigning them EPcost values from the lookup table that arent accessible via the ingame character creation UI, I get that. Now, I would have thought that rewriting the powers.dat wouldn't have any effect until you reloaded the game. But you're saying that doing so (by activating costtiggot) makes the change take immediately and then it gets reverted when you restart the game? Obviously something's happening a bit differently to what I thought. I'm not disputing what you saw, just surprised. I havent really messed around with FFvTTR that much.
Stranger Than Fiction:
The Strangers, Tales of the Navigator and Freedom Force X
www.fundamentzero.com

blackjacket

Hey DrMike,

It doesn't revert back, it just doesn't remember that a power was trace or minor, in fact it will save a power as 'low' or 'none' in the dat file.. so for instance if you make a power trace in game through costtiggot and then quit followed by opening ffedit, you'll see the power that you changed to trace will be 'none'. that's why you have to run costtiggot any time you start up again.

DrMike2000

Quote from: blackjacket on December 09, 2009, 03:57:25 AM
Once again, I was looking to see if anyone had any ideas on how to implement certain effects.

The first would be for a character with a melee with 3 contacts.  Is there any way to assign different damage types for each contact.  E.g.   pierce damage for 2 claw slashes and crush damage for a final kick in one animation.

Second would be diving/charging attacks, like wolverine's drill claw.  I was thinking using something along the lines of living laser, using the mesh of wolverine himself as the projectile.. any ideas would be appreciated.

I've noticed that with even multiple leave_hands in an animation, that an area will only happen once in the attack..any way around that?

Finally, i've been trying to find a workaround for ffvtr's problem for the speeding bullet/sprint animation only being "run".

Any ideas would be great. Thanks

The 3 contacts with different attack types... ooh tricky. You could possibly simulate this via scripting but it wouldn't be pretty. You can register a callback for when a melee attack hits. Look at the carrier stuf in FFX for how to do this. So maybe if the callback went:

def onClawHit(event):
    recentCount=Mission_GetAttr('recentHits')
    if recentCount==1: #this is the second hit!
        Trigger_Damage(event.string,10)
    Mission_SetAttr('recentHits',recentCount+1)
    regTimer('clearRecentHits',3)
   
def clearRecentHits(event):
   Mission_SetAttr('recentHits',0)

So the second hit will do something special here, and 3 seconds after the first contact hits, the whole system resets. Theres room for error, but its a start.

You can get an area to trigger multiple times by coding too. I made a bunch of characters wioth strobe attacks, whee they trigger emapthy or some other script readable state, and that then causes a bunch of timed explosions to occur around them.

Heres some sample code:


def displacetostrobe(event):
   char=event.object
   counter=ffx.FFX_ObjectGetAttr(char,'strobe',0)+4
   ffx.RegTimer('DoStrobe',3,counter,char)

def DoStrobe(event):
   counter=event.user-1
   char=event.object
   Trigger_Explosion(char,'sarsvati_strobe_ex') #this is the power that fires off
   if counter>0:
       ffx.RegTimer('DoStrobe',3,counter,char)


Ive got a 3 second gap between explosion, reduicng this a lot would give you a quicker fire effect.

For the wolvie lunge, speeding bullet sounds like your best bet. How to make it work with a different animation,. I have no idea. I doubt it can be done.
You could try a physics based solution? Where you use Trigger_Force? Triggering a power in mid air causes the character to immediately reghain their footing, so throw Wolvie at the target and the trigger a melee attack when he gets close enough? If nothing else, it would be fun to play around with.
The worse bit would be the flailing back animation playing as he leaps.

Maybe even grab the ffx superleap trick - trigger a sprint 100 units above the target and they leap to the target. Hey, that would work.

Hope this all helps, and good luck!
Stranger Than Fiction:
The Strangers, Tales of the Navigator and Freedom Force X
www.fundamentzero.com

blackjacket

Thanks a bunch, i'll check into what to come up with.  I was looking at the fastball special and saw the trigger force and was thinkin about utilizing that.  As for the melee contacts, that's great, so many things can be done and it looks possible.  So thanks again.

Hey as for the speeding bullet ani... is there anyway when speeding bullet is triggered, to change temporarily a name of another anim to 'run' until the power is complete...so kind of a workaround to that whole problem...

stumpy

#9
Interesting discussion. I like your notion of progressive attributes that build up as CP accumulate. For the most part, FFX tries to accommodate that with the UPGRADABLE attribute, which works pretty well (especially with the combo attributes tailored to different versions of the character) and allows the player to decide if he wants to spend the CP to upgrade the attributes or to buy powers, etc. (My favorite aspect of UPGRADABLE is that it lets you upgrade to characters with different ability stats as he upgrades.)  But the approach you mention could add a new twist in that the character can get the automatic bump from the unspent CP and then drop down again the next time he spends CP in the regular way back at the base.

BTW, there shouldn't be too much trouble getting the attribute customizations to work using the FFX Control Centre by defining a customization array that is essentially a list of the CP levels and the attributes they correspond to. E.g. add something like the following to ffxcustom.py or (more likely) ffxcustom2.py
FFX_DYNAMICATTRIBS = [
['default', 500, 'invulnerable', 750, 'invulnerable0', 1500, 'invulnerable2', 2500, 'invulnerable22a34'],
['darkknight', 600, 'coordinator', 850, 'telepathy', 1850, 'ffactivedefense10', 2850, 'ffqimmortal'],
]

Then you can do a lookup in that customization array in your attribute code. If you peek at the other FFX customizations in ffxcustom.py and other files (ffxattribs.py and ffxdefault.py), you'll see how things are set up.

The EP cost business is something we have seen before. Take a look at this thread, for an earlier outline on doing it. Changing a power's  EP cost via datfiles call should be permanent, taking effect as soon as a mission is reloaded or when loadPowers() is called (that latter use is what inspired me to write the power rewriting code in the first place) and then lasting until an edit to the power is made using FFEdit (for built-ins). Note that the in-game interface will only show the EP cost levels that FFvT3R allows (same with FFEdit), but they won't actually change unless an edit is made to the power. So, a character with Trace or Minor EP Cost might show up as None in the game, but he would still use the 5 or 10 EP when he used the power during play.

A long time ago, I tried using a similar trick to give a fire-and-ice character a multi-contact melee power that switched damage types after each contact and then a Chaos character (like DrMike's) where the damage type for her multiple projectile power was more or less random. My recollection is that it was doable, but the results were a little sporadic because of either flakiness in how the game engine handles the on-hit sinks or because of computational overhead (trying to handle the callback and do the DAT rewrite and reload in the time in between contacts). It was pretty easy to get the power to change (FX, damage type, intensity, whatever) between attacks (e.g. a Chaos Beam), but doing within one multi-contact attack was an issue. Maybe it would work better now, with PCs being faster. Unfortunately, the approach doesn't really help HERO file characters, unless the AI is playing them.
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg

blackjacket

Hey stumpy,

I see you were ahead of me on that.  Never noticed that post from Feb.  I'm actually surprised that info hadn't been rerouted to the scripting section.  I did pretty much exactly what you did.  So you get creds on that.  Oh hey..what's the "forceread" do?

As for the progression, my intention with my campaign characters is also to use the upgradeable attribute in conjunction for different forms. So for example  I have James Buchanan Barnes and his upgradeable forms starting from Bucky to Winter Soldier to Captain America VI.  Each form however also has it's own progression in abilities and attributes...however I want to make progression of the forms more interactive and seem more built-in.

btw, I just tried the campaign_rewritepowers to see if i could change the animation on the sprint powers......didn't work...but there's gotta be a way...

blackjacket

#11
I think I got it...I just theorized an interactive leveling 'menu'.  Every character in a campaign can have a command added to them..similar in nature to the 'start ai' command.  This command would be called "Upgrade" or "levelup".  By using this command, a character would have several new commands added that each correspond to an upgrade.  By using the new command, the character will set a persistent variable that indicates they have this upgrade and with that, the script for the upgrade would initialize. So an example would be, lets say..Hercules..

Hercules starts the campaign with 'Upgrade' as a command.  When used a script adds five new commands:
Heavy Lifter (150);  Wrestler (100); Super-Leaper (400); and More Upgrades (which leads to a list of more of his upgrades); Cancel Upgrade
By picking Wrestler,  Hercules would lose 100 CP and switch on a campaign persistent variable stating he has the wrestler attribute and the attribute would initialise.  By picking a choice, obviously the upgrade commands would drop... Now this would only work with scripted attributes..non-scripted would have to be bought via the base menu as well as powers.  However, I have been toying with power boost swaps (E.G. Displace Image swapped by Path of Destruction for juggernaut only on Juggernaut's use of a certain power called "path of destruction")..so the upgrade menu could be used to boost these powers in duration and attribute boost... Now that I've theorized it I just have to try doing it... any thoughts on a better way to do this would be cool... plus I'm not exactly sure how to create a campaign persistent variable or extinguish cp from a character... Any thoughts would be appreciated..kudos.

blackjacket

Got a fully functional upgrade during campaign script.  All the kinks have been worked out as far as I can tell.  Now any character could be given a template in ffxcustom2.py detailing what scripted attributes they can buy and at what cost.  The script creates a command called upgrade for that character.  When selected a few options come up:  up to three attributes listed as choices to buy, 'more', and 'cancel'.  By selecting one of the attributes..the script will check if the character has sufficient 'net xp'.  If not then it will not be bought.  If so, the attribute would be initiated and also appended to a separate file (simulating a persistent variable).  As for 'net xp'...There is no solid way to remove xp in a campaign. So, I created a variable that would check the separate file for already bought attributes.  This variable goes up in value by the cost of the attribute as listed in the characters template in ffxcustom2.py.  Net xp is the difference between this variable called 'usedxp' and the characters actual campaign xp.  The next option is 'more':  if a character has more then 3 buyable upgrades, more will bring the next list of 3 upgrades and so on and so forth.  Cancel removes the commands and goes back to the upgrade command being shown.  Now the only flaw so far is that xp is not immediately recognized when gained.  This is because the chardata check is based ona  previous saved game if im not mistaken.  So an individual would have to save in order to have an accurate xp reading.  So now I ask if anyone is even interested in the code and how to implement it?

stumpy

Sorry I've only been able to skim these threads lately. It sounds like a cool idea you have running here.

As for chardata's notion of XP, FFvT3R autosaves a game at least once between the time a character is upgraded at a base and the time a playable mission initiates, so it's XP report should be at least that good. Unless the character gains XP mid-mission that you would want to have impact the use of this feature, I think you are okay using chardata.

BTW, you could also put an XP check in your upgradecommands() code that looks at the character's XP and only gives him custom actions for the upgrades he has enough XP to use.
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg