• Welcome to Freedom Reborn Archive.
 

Using FFX in my mod.

Started by Urthman, March 01, 2007, 12:48:57 PM

Previous topic - Next topic

Urthman

I've modified my ffx.py quite a lot for use in the Secret Defenders mod.   Currently, the mod is just reading the file from the main Data/Missions/Scripts/ folder.

How do I set things up to have it reading from the Defenders/Missions/Scripts folder?  Do I make a file called ffxS.py or what?

If I have some custom AI for the mod, which m25 files do I need to have in my Defenders/Missions/Scripts folder, and how do I make sure the mod is reading them from there instead of from the main scripts directory?

The mod reads ffxextrasS.py from the Defenders/Missions/Scripts folder just fine, but didn't seem to be reading ffxmultiS.py.  Testing determined it was still reading ffxmulti.py from the Data/Missions/Scripts folder.  So I've been using that during development, but I need to know how to make it read that one from the Defenders folder too.

M25

I'm really rusty, but this is what I recall.

If you modified ffx.py, then you'll have to do a bit of work.  Create a copy of it in your mod's mission/scripts directory called ffxS.py.  You'll then need to include a version of cshelper.py in your mod directory, probably called cshelperS.py  that imports ffxS.py instead of ffx.py

And of course, your mission.py files will have to import cshelperS.py instead of cshelper.py.


The copy of ffxmulti.py in your mod directory must be called ffxmultiS.py (with the S being in uppercase)

Likewise, for you AI to be read from the mod directory, the ai file has to be called m25newaidata2S.py


Urthman

Quote from: M25 on March 02, 2007, 02:35:33 PM
I'm really rusty, but this is what I recall.

If you modified ffx.py, then you'll have to do a bit of work.  Create a copy of it in your mod's mission/scripts directory called ffxS.py.  You'll then need to include a version of cshelper.py in your mod directory, probably called cshelperS.py  that imports ffxS.py instead of ffx.py

And of course, your mission.py files will have to import cshelperS.py instead of cshelper.py.


The copy of ffxmulti.py in your mod directory must be called ffxmultiS.py (with the S being in uppercase)

Likewise, for you AI to be read from the mod directory, the ai file has to be called m25newaidata2S.py

Thanks so much, M25.  So (as best you remember) I need to specifically call cshelperS.py from my missions and ffxS.py from cshelperS.py.  But all the rest (like ffxmultiS.py) will get read automatically if they exist in the mod's folder?  Or do I need to call them specifically somewhere as well?

What about files like ffxextras.py?  It has a section:

from cshelper import *
from js import *
import ffx

Do I change all of those to cshelperS and ffxS?

wickerman

From Dr Mike's site:


Quote
Script Files
Script library files (such as cshelper.py, which contains a lot of useful functions plus the cutscene engine) are stored in the folder Data/Missions/Scripts. In your mod, library files (such as strangers.py) that contain non-mission-specific code can be stored in /Missions/Scripts and used from Irrational Patch V1.1 onwards. However, this primary/secondary data path system does NOT work in the same way as for script files as it does with meshes: the script engine will read from the Data folder first and from your mod folder second, i.e. only if it can't find the named file in the main data folder.

The original FFX dealt with this by having a secondary set of all script files suffixed with S, e.g. ffxS.py and cshelperS.py.

I've managed to work around this now, and each mod requires only a few custom script files:

    * ffxcustomS.py - stores all customisation and carrier attack data, obviously need to be mod specific
    * ffxIDS.py - stores character identification arrays. These are automatically generated by running the control centre.
    * ffxpuppetsS.py - stores data for use with the Puppet Master attribute. This has been made mod-specific since a mod may contain special animated object meshes and wish to use them with the generic attribute (ie the Strangers does).
    * ffxextrasS.py - contains mod-specific lists of voice ID's and built in characters.
    * ffxmultiS.py - contains list of combination attributes.
    * ffxtransmutesS.py - contains the list of transmutable objects and the commands and rules for the TRANSMUTATOR attribute.

The installation of Freedom Force X provides a folder called 'mod'. - Copy the contents of this into your mod directory to get a blank ffxcustomsS.py and ffxpuppetsS.py. Then run the Control Centre over your mod to generate the other required files.

If you've previously set up your mod to work with FFX (as opposed to FFX-Squared) then you'll need to turn all the cshelperS.py references back to plain old cshelper.
Sorry about the runaround, but its much easier and less buggy for me to maintain one true version of the ffx.py file (now over 6000 lines of code!).

Running Control Centre with mods
See that DropList control that says "Data" when you start up FFXEdit?
The Control Centre will automatically detect mods in your FF directory and allow you to select them from this list. Changing the mod selected in here causes the Control Centre to seamlessly re-scan the newly selected data/mod directory for characters, powers, FX etc. - so use the control centre as you do for the main Freedom Force X-Squared and customise your characters in here - builtins if you're a modder or customs if you're playing a custom-friendly mod campaign.

The Control Centre can now be used to add special attacks to builtin characters, customise their attributes and choose which optional rules apply in your campaign, just like it does for the main campaign.
FFX Extras
Voice IDs are generally the same across mods. The lists in ffxextras.py describe which voice ID's are female, robotic, animal or alien, basically for use with the PHEREMONES power. You may wish to make some modifications in some cases.

Example The ME voice pack (Mentor) is classified as 'alien' in the default installation. In a DC mod this may still work, as the voice would probably be assigned to Jonn Jonnz, but if it were also to be used for Dr Fate, then it may be desirable to remove it and treat it as the default male gender, and allow Jonn to be seduced by the likes of, say, Circe like any other guy.
In a Marvel mod, if the ME voice is to be used primarily by Dr. Strange, then its definitely male.
In the Strangers, the main user of the Mentor voicepack is Adam Zorn, so its classified in the Robots list. The MB voice pack is also there (used by ManBot in the main campaign) since this has actually been replaced in Strangers to sound like Microwave but with clunky footsteps for the heavier robots (eg Hunks and Eightballs).
Any custom voice packs that go with a mod should be added to the appropriate list if they're not used by male characters.

The 'builtinHeroes' list should contain a list of all builtin heroes that can be present right at the start of a mission. (Doesn't count temporary forms and mimic forms.)

builtinMimics should contain all builtin characters that possess the mimic attribute.
If you want to go to the trouble of duplicating Devil Doll's special MIMIC ability place the special mimic first in the list and modify the mimicPrefix variable to something appropriate. That way, the system will look for a valid template called + to morph into before just copying the target.
Example Setting mimicPrefix to 'rogue_' and builtinMimics to 'rogue' and 'themimic' like so:

builtinMimics=['rogue','themimic']

mimicPrefix='rogue_'

Means that when 'themimic' uses his MIMIC attribute he just becomes a copy of the target. When rogue does, the system first checks for a special case, eg. on mimicking a target with template 'colossus' it would look for the existence of a 'rogue_colossus' template first, and only if that doesn't exist will it do the default morph into a straight copy of 'colossus'. It is up to the modder to put together a suitable 'rogue_colossus' with both characters powers and metal skin etc. for the full effect.

DAT Files
The attributes and states in FFX typically require special FX, powers and objects or characters to work correctly, so you'll need to merge your DAT files with those from FFEdit. The following files need to be merged:

    * objects.dat
    * characters.dat
    * fx.dat
    * res.dat
    * sounds.dat
    * powers.dat
    * attributes.dat

For each one, click the "Merge DAT" button on the front pane of FFEdit. Then, select the file in your mod directory, and then the one from the main Data directory. After a few seconds you'll get a message saying that the merge was successful. Repeat for each file listed above.

After doing this and running the mod you may notice a couple of oddities. First off, running a new campaign will play MinuteMan's origin - you'll need to reset his cutscene path tot he blank one in FFEdit after merging with the FFX data files.
Secondly, characters with attributes that alter their strength such as ABSORBER or NOCTURNAL will have little stars and bugle noises around them - delete the FX 'minuteman_patriotcharge' to get rid of this side effect.
StringTables
You could merge these, but best to tackle it at the source.
Open up Data/Lang/English/strings.txt. All the new entries are listed at the top of the file in ordered sections (unlike Irrational's entires :) ), followed by the missing string entries that got added in Patch V1.2, ending with

SKIRMISH_GAMETYPE_RT_THUG_01, (beat the clock) clock the crooks!

Copy all these into your own string table somewhere. At the foot of the FFX string table is the changes required to make all offensive state change powers read "OVERCOME!" and all beneficial powewrs read "BOOSTED!". Copy this section too if you like.
Recompile your language files with FFEdit and you're done.
Attributes
The new attributes can be assigned to any character, hero, villain or whatever. The good news for heroes is that Freedom Force X correctly determines which attributes have been bought, so if you design a built-in hero who can buy TELEKINESIS through training, they don't get the TK powers in game until they've spent the points.
Of course, some powers won't really do much for villains since their AI won't activate them (such as TELEKINESIS), but you can work out which ones for yourself. Passive abilities such as DISPERSED STRUCTURE, OVERHEATED or PHEREMONES will work just fine though.
And at some point, I intend to write a set of pluggable AI routines for Freedom Force X to enable villains to use all the attributes.

Mission Code Requirements
To activate the Freedom Force X code, all you need to do is make sure you call setMission() in your OnPostInit() function for each mission. Additionally, use the cshelper.sun() command at all times instead of the Mission_SetSunlight() command- this is necessary for NOCTURNAL, SOLAR POWERED and WEATHER CONTROL to work correctly. And remember to put the -log flag in your shortcut, as described on the install page. Follow these steps, and Freedom Force X-Squared should live in harmony with your mod.
Checklist

    * Copy the 'mod' folder scripts into your mod's folder
    * Merge Dat files
    * Update and recompile your string table
    * Run FFX Control Centre on your mod folder and Save to create the remaining files
    * Check all missions reference cshelper instead of cshelperS if you previously had the mod going with FFX
    * Check all mission code for setMission() and change all Mission_SetSunlight()'s to sun()'s. (The argumnents are the same).
    * Tidy up voiceID's

Emphasis mine...  the cshelperS file is no longer required.

wickerman

Also,  if you are using M25's Ai extensions,   from m25 import * is the ONLY thing you should be calling from your mission script.  It automatically calls cshelper.   If you call it twice, the Ai extension will NOT work properly.

Urthman

But, as I read that wickerman, it seems to be that this is the setup if you want to run a mod using the ffx.py code in the default Data/Missions/Scripts folder.

But I've customized my ffx.py file and so need to run an ffxS.py file from my Defenders/Missions/Scripts folder.  (Either that or get anyone who wants to play it to temporarily swap my Scripts folder into their main Data folder, the way you have to do with the Great Hunt).

If I understood scripting, I think the "right" way to do it would have been to leave ffx.py alone and create a Defenders.py that modifies it or something.  But hopefully I can get it to work the "old" way.

wickerman

That being the case, I believe you are right....

Let me look into it and get back to ya :)

Epimethee

> Emphasis mine...  the cshelperS file is no longer required.

Only for FFX 3, sorry.