WareTemplate and its shadowy master

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Sorenson
Posts: 340
Joined: Thu, 9. Apr 09, 00:43
x3tc

WareTemplate and its shadowy master

Post by Sorenson » Thu, 13. May 10, 04:45

For the purpose of breaking complexbuilders free of the shackles of crystal-based energy cell production, I've been messing around trying to get them to run power plants to self-sufficiently. Simple matter of editing WareTemplate, right? Yes and no - while accordint to the encyclopedia the plants (and several other test stations done for the hell of it) are resource-free, while the NPC stations go along just fine with it, the same isn't said for player-owned stuff, which're just as annoyingly reliant on the relatively scarce sources of silicon that haven't already been tapped.

Further testing has brought to light a few key pieces of information:

A) The game isn't going down the list, reading that there's no resource whatsoever, and checking in a previous version of the WareTemplate file to get the correct data: even if you delete all the obsolete WareTemplates in the catalogue and update the latest one with the changes said changes will still be reversed back to the standard setup.

B) Even if you delete all of the resource data from a station and all other stations similar to it, the game will still restore the original and exact resource settings.

C) Whatever is affecting WareTemplate's actual translation to in-game stuff isn't overwriting the changes completily, but only seems to take effect when no resources are assigned to the station and when a station belongs to a player, specifically when the station is built by the player, be it normally or through the FCC - if one takes control of a station such as through the cheat scripts it maintains its resource-free nature.

Based on this, we can assume that in addition to WareTemplate that there's some kind of a meta-template file somewhere, one that not only possesses the stock data for all stations in the game but which then exports this data to any player-created station that raises a red flag for whatever reason (lacking primary resources, for example). If we can find this file, we can edit it and finally allow stations to be bent to our will as we so please, or barring that at least find some of the triggers that activates the metatemplate and disable them or find a workaround (an edit to the build station script that builds the station initially as Friendly Race-owned but then changes ownership to the player, for example).

Any ideas, observations?
X3TC Naval Shuffle: My ships are fast; my shields are strong; and my guns are very, very large.

mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren » Thu, 13. May 10, 08:18

Sorenson

I could be completly wrong here, but if i remember correctly, i've read somewere that there are 2 station ware templates, or something to that effect. One is used for NPC station building and the other is used for Player station building and the change is triggered by the station owner setting when it is built.

I've got 2 versions of a script i wrote for when i want player owned stations with NPC specs, 1 creates the station as player owned and then changes the products and resources to suit and the other creates the station for the original station owner race and then changes the ownership over to the player. I don't dabble in the 't' files as i have no idea what i'm doing so i do it with a script.

MarCon

Sorenson
Posts: 340
Joined: Thu, 9. Apr 09, 00:43
x3tc

Post by Sorenson » Thu, 13. May 10, 10:20

Are you sure it's a \t file? I'm looking through it here and don't see a thing that looks like it'd interact with player station loadouts, just a crapton of dialogue, even going beyond the initial 5 or so catalogues the game shipped out with at launch.
X3TC Naval Shuffle: My ships are fast; my shields are strong; and my guns are very, very large.

User avatar
Locksley
Posts: 371
Joined: Fri, 18. Mar 05, 16:26
x3tc

Post by Locksley » Thu, 13. May 10, 10:35

I've only found Ware files in the Types directory - I think Mark. just mixed them up.

Cheers!
Projects:
Onhold..... time time....

mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren » Thu, 13. May 10, 11:01

mark_a_condren wrote:I don't dabble in the 't' files as i have no idea what i'm doing so i do it with a script.
Locksley wrote:I've only found Ware files in the Types directory - I think Mark. just mixed them up.
Sorenson

Sorry, seems i can't even get the damn name right.

I've just been looking around to see if i could find were i read it, but no luck so far.

MarCon

Sorenson
Posts: 340
Joined: Thu, 9. Apr 09, 00:43
x3tc

Post by Sorenson » Thu, 13. May 10, 11:13

Can't be \type stuff, though - WareTemplate is anywhere from 190 to 380 kb unpacked and only a few of the \type files meet the low end of that, and none get anywhere close to the high end, and none of those particular files seem to have any data regarding either stations or wares (it's like body parts and crap).

Doing a dump of 1 thruogh 5 of non-model/sound/texture files and sifting around, I don't seem to see anything appropriate for handling player station loadouts; \types doesn't have anything useful, \maps only has WareTemplate and the X-universe maps for stations and debris and the main menu 'verse. X3galedit.obj in the \l directory looks like it might be interesting but wasn't decompressed and the extension is used for modelling and the like so I can't investigate, \l\true has nothing of use, \f is the same, and the only \director file of sizeable proportions that ain't a mission/plot outline is dirobjdb, which while having a listing of all in-game objects and a crapton of annotation and description tags lacks any other kind of substance, so that's out.

Dang thing's gotta' be around here, though. Come hell or high water I'm breaking the shackles of Big Energy.
X3TC Naval Shuffle: My ships are fast; my shields are strong; and my guns are very, very large.

User avatar
Ketraar
EGOSOFT
EGOSOFT
Posts: 11825
Joined: Fri, 21. May 04, 17:15
x4

Post by Ketraar » Thu, 13. May 10, 11:53

WareTemplate will ONLY affect new spawned stations that are NOT already in the map. So if a station is set in the x3universe including resources info, that will override anything you have in the WaresTempate.

This can be fixed by deleting all resources info in map file. Done that for ND and working.

MFG

Ketraar
Image

Sorenson
Posts: 340
Joined: Thu, 9. Apr 09, 00:43
x3tc

Post by Sorenson » Thu, 13. May 10, 23:46

I considered that as well, but a zip through the X-universe map file shows all my test stations as being stock, no listed specific requirements or anything, and as noted the problem's not the NPC stations at all but player stations which're being influenced by some third-party to revert back to vanilla setups. That's the jerk of a file I need to find and beat the crap out of.
X3TC Naval Shuffle: My ships are fast; my shields are strong; and my guns are very, very large.

Bobguy
Posts: 8
Joined: Sat, 3. May 08, 13:05
x3tc

Post by Bobguy » Fri, 14. May 10, 15:25

As far as I can tell, player-built solar power plants are not affected at all by the WareTemplate file. I couldn't even find an entry for them, all of the solar power plants in that file list crystals as a secondary resource, not as a primary one. I suspect that the crystal requirement is hard-coded somehow.
Still, I've managed to put together a workaround for this using MD code and a tiny bit of scripting. Something similar should work with other factory types as well. Here are the download links:

http://www.filefront.com/16456357/Cryst ... -v2.1.zip/
http://www.filefront.com/16456605/Perma ... r_v2.1.zip

To activate it, change your pilot name to "removecrystals" and wait for the tutorial text to show up saying it's active, then change your name back to what it was. It'll remove the crystal requirements from all of the solar power plants it can see when you activate it and also whenever you build a station. To deactivate it, do the same as before, but change your pilot name to "addcrystals".

I haven't had a chance to do any real testing, so use it at your own risk.

EDIT: Changed links to v2 and now works with complexes.
EDIT: New versions.
Last edited by Bobguy on Sun, 16. May 10, 05:48, edited 3 times in total.

User avatar
F.A.B.
Posts: 767
Joined: Fri, 27. Feb 09, 18:47

Post by F.A.B. » Fri, 14. May 10, 23:04

hi sorenson,

i had the same problem too and i think the file you're looking for is hardcoded and therefor can't be found in tc's .cat's.
but maybe i can help you anyway - from what i've figured out the waretemplate just effects npc stations placed by GOD (those defined in the universe.xml) and new created stations.
so, unless i'm very much mistaken, you can trick the system by creating a new powerplant. i believe this is how i got my fusion beam canon forge to work; not 100% sure anymore.

hope that helps!
best,
F.A.B.

Sorenson
Posts: 340
Joined: Thu, 9. Apr 09, 00:43
x3tc

Post by Sorenson » Sat, 15. May 10, 00:39

Hardcoded? Aw, man, you'd think with the enormous legacy of modding that the X series has carried since the days of The Threat that Egosoft would've tried to make stuff as open as possible. I guess its up to scripting and other shenanigans to try and defeat the energy crisis - maybe I can cannibalize the Nividium Processing Plant script to make something feasable since I've still got leeway to mess around with it.
Bobguy wrote:As far as I can tell, player-built solar power plants are not affected at all by the WareTemplate file. I couldn't even find an entry for them, all of the solar power plants in that file list crystals as a secondary resource, not as a primary one. I suspect that the crystal requirement is hard-coded somehow.
Still, I've managed to put together a workaround for this using MD code and a tiny bit of scripting. Something similar should work with other factory types as well.
Cool, just gimmie an hour or three to rip 'er guts out and see what makes 'er tick. Not too hot about the name change activation, but if it can kill the crystal requirement on player stations after construction that'd be perfect.

EDIT: OK, after messing around with it for a bit this is almost EXACTLY what I was hoping for: the "almost" is the aforementioned naming condition, which I'm going to see if I can replace with something more universal (maybe player ship exists?") so it's off to the director programming thread I go. If I can get this running hitchless, can you gimmie your blessing to bundle this into the Shuffle?

EDIT: One thing I've noticed about this script, though, is that there isn't any sustainability in it - it works its magic just fine on stations that're already built and the one that comes after activation, but after that the stations still require crystals and to fix them you have to add them back to ALL of your stations and restart the script. I'm going to start looking into other name-based scripts like this and see if I can something that'll make the director basically run around to the beginning of its file and keep reading through it over and over so that stuff's sustained.
X3TC Naval Shuffle: My ships are fast; my shields are strong; and my guns are very, very large.

corbinbird
Posts: 49
Joined: Tue, 2. May 06, 18:58
x3tc

The script should work...

Post by corbinbird » Sat, 15. May 10, 22:13

It's very easy to get the SE to get rid of crystal req. I don't have the script handy, but remember most of it.

for all stations in galaxy use a looping find. (under Universe and Galaxy Properties)

target/find the station
turn off : factory production task. i.e set to [FALSE]
remove resource from factory or dock : Crystal
turn on : factory production task. i.e. set to [TRUE]

for docks/shipyards use : station trade and production task

corbinbird

Sorenson
Posts: 340
Joined: Thu, 9. Apr 09, 00:43
x3tc

Post by Sorenson » Sat, 15. May 10, 23:50

Tried it, but apparently SPPs are stupid special cases: removing the crystal resource directly via script (in this case a butchered Nividium Processing Plant) causes its production rate to nosedive to 2x size. I'm guessing that's why there isn't a plethora of straightforward crystal-free SPP scripts, you have to monkey around using the director and other stuff and attack it indirectly.

I wonder if this applies to mines, though: if I can't have crystal-free SPPs, energy-free mines would be a good substitute considering those're the next-hardest link in the chain to sustain due to Silicon being so scarce.

EDIT: Heh! Mines apparently ARE fine with it, no production dropoff like with SPPs. Gotta' test Silicon now, but I'm not betting on any trouble from that.
X3TC Naval Shuffle: My ships are fast; my shields are strong; and my guns are very, very large.

Bobguy
Posts: 8
Joined: Sat, 3. May 08, 13:05
x3tc

Post by Bobguy » Sun, 16. May 10, 03:38

Sorenson wrote:One thing I've noticed about this script, though, is that there isn't any sustainability in it - it works its magic just fine on stations that're already built and the one that comes after activation, but after that the stations still require crystals and to fix them you have to add them back to ALL of your stations and restart the script.
Sorry about that, I forgot to set the cue to run more than once after the script is active. I have uploaded a new version above that fixes this. The new version will also properly affect solar power plants that are in complexes.
Sorenson wrote:I'm guessing that's why there isn't a plethora of straightforward crystal-free SPP scripts, you have to monkey around using the director and other stuff and attack it indirectly.
The script editor is actually the only way to safely remove crystals from solar power plants. The method used by this script is exactly as corbinbird described it. I've added an MD backend purely because it can be made to act immediately after a station is built fairly easily.

Unfortunately, the most straightforward way to control the execution of MD cues that I have found is by making them act on pilot name changes, similar to Ketraar's various MD scripts, such as Marking Unknown Sectors. I've left the name change requirement in the new version because it only needs to be done once and then you can change it right back and also because I think it'll probably save trouble in the long run.
That said, here's a link to a permanent version of the script that starts without a pilot name change and has no uninstall cue:
http://www.filefront.com/16456605/Perma ... r_v2.1.zip
You can install it by replacing the Crystal Remover XML file with the one in the link.

EDIT: New version.
Last edited by Bobguy on Sun, 16. May 10, 05:47, edited 2 times in total.

Sorenson
Posts: 340
Joined: Thu, 9. Apr 09, 00:43
x3tc

Post by Sorenson » Sun, 16. May 10, 05:01

Cool. Though as it turns out, after finding that I couldn't attack the SPPs directly I just decided to skip the whole EC issue in the first place and cobbled together a few scripts to just remove that resource from factories outright. [ external image ] This is a wee bit better for folks who wanna' observe the whole green energy thing, though (not to mention avoiding any potential ramifications of an EC-less X-verse economy, not that I honestly expect much trouble) so I guess I'll chuck the scripts up in the library and use your setup instead. Can I have your permission to use this in the Shuffle, or is this more a personal-use-but-no-redistribution thing?
X3TC Naval Shuffle: My ships are fast; my shields are strong; and my guns are very, very large.

Bobguy
Posts: 8
Joined: Sat, 3. May 08, 13:05
x3tc

Post by Bobguy » Sun, 16. May 10, 05:21

I must've missed that you wanted to use this in a mod. Anyway, you can use/reuse/modify/whatever this as you like, as long as I'm credited for it.
I've also uploaded a new version to fix a small potential bug with removing crystals from factories that aren't solar power plants.

Sorenson
Posts: 340
Joined: Thu, 9. Apr 09, 00:43
x3tc

Post by Sorenson » Sun, 16. May 10, 06:10

Cool, thanks again.
X3TC Naval Shuffle: My ships are fast; my shields are strong; and my guns are very, very large.

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”