Creating added (modded) weapons from player built station (X3TC)...?
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
- DarrenTomlyn
- Posts: 205
- Joined: Sun, 17. Oct 04, 19:06
Creating added (modded) weapons from player built station (X3TC)...?
So I've almost got X3TC how I want it, (it's taken YEARS!), but I've run into a problem.
So I've got all the ships, added weapons and shields into the game I want - (altered the WareTemplate.xml file for NPC stations) - and most/all? stations now produce more than one weapon/shield - (as many as five products at some stations (complexes)).
I get the feeling that player owned stations are only designed to sell one product and this causes it to pick one (at random?) from the list available for the station (from the WareTemplate.xml file?)
Is there any way round this apart from using the cheats to add the rest of the weapons as products to such a station?
So I've got all the ships, added weapons and shields into the game I want - (altered the WareTemplate.xml file for NPC stations) - and most/all? stations now produce more than one weapon/shield - (as many as five products at some stations (complexes)).
I get the feeling that player owned stations are only designed to sell one product and this causes it to pick one (at random?) from the list available for the station (from the WareTemplate.xml file?)
Is there any way round this apart from using the cheats to add the rest of the weapons as products to such a station?
- DrBullwinkle
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44
Re: Creating added (modded) weapons from player built station (X3TC)...?
That is the way to do it. Use a script to add additional products to a station.DarrenTomlyn wrote:Is there any way round this apart from using the cheats to add the rest of the weapons as products to such a station?
- (Or just build complexes like everyone else. )
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
- DarrenTomlyn
- Posts: 205
- Joined: Sun, 17. Oct 04, 19:06
Re: Creating added (modded) weapons from player built station (X3TC)...?
(Complexes are not applicable when the whole point is about adding extra weapons to stations that do not normally stock them - if the station does not come equipped to make/sell them when constructed, they do not exist at all (and so have to be added via cheats):p )DrBullwinkle wrote:That is the way to do it. Use a script to add additional products to a station.DarrenTomlyn wrote:Is there any way round this apart from using the cheats to add the rest of the weapons as products to such a station?
- (Or just build complexes like everyone else. )
I'm just wondering if there's another way of doing it?
(I've added extra medium, large and extra large weapons to balance out the entire selection between races, using the weapon-slots available, (as they should be used, IMO) - the ships I've added use them, and I've altered the in-game ships to use them, too. The medium weapons also give my added gunship-class some more applicable weapons (that can be useful (though watch the energy usage!) for advanced fighters, (M4+) and give additional options for heavy/very-heavy fighters (M3/M3+)).
Each races IRE and PAC forges carry the added medium versions of these weapons. The CIG forges carry their large weapons and flak array and the PPC forges carry their XL weapons (including beams) and cluster-flak array, when not produced elsewhere. (I Moved the flak weapons to the general CIG/PPC slots.)
Also added 3MJ, (for M5+) 10MJ, (M4+) 75MJ, (M3+/TM/large TS's (Med Trans)), 600MJ, (frigates) - (I call the in-game frigates, 'cruisers' instead) - (and am planning to add 5GJ), shields. I'm assuming any shield factories I build will suffer from the same problem.
(My ships get far more expensive than vanilla, and so having more ship classes is not a problem. E.g. 200Mil+ for a vanilla destroyer - though I'm also tinkering with weapon/shield prices too, trying to get the right balance between getting expensive but not too hard/impossible to buy/build when needed.))
Would it be possible to create a script, somehow, that would enable my player-built stations to automatically stock the right products when built?
- DrBullwinkle
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44
Re: Creating added (modded) weapons from player built station (X3TC)...?
Yes, that is the only way to do it that I am aware of.DarrenTomlyn wrote:Would it be possible to create a script, somehow, that would enable my player-built stations to automatically stock the right products when built?
The Cheat Package can do it for you. Just add product to station. (And maybe stock the station.)
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
- DarrenTomlyn
- Posts: 205
- Joined: Sun, 17. Oct 04, 19:06
Re: Creating added (modded) weapons from player built station (X3TC)...?
Stock the station? But that would be cheating! (TBH, the only cheat I bother with is adding NavSats to each sector I explore - (I do have 479 of them - (it doesn't like the last one anymore, for some reason, though I haven't changed it in anyway since it was working :-/ )))DrBullwinkle wrote:Yes, that is the only way to do it that I am aware of.DarrenTomlyn wrote:Would it be possible to create a script, somehow, that would enable my player-built stations to automatically stock the right products when built?
The Cheat Package can do it for you. Just add product to station. (And maybe stock the station.)
It still sounds too manual for me - but you don't think there's some way of making the building side know to automatically link the station with the right products, like WareTemplate does for NPC stations? E.g a script to run at startup that would do it automatically, (for player-owned stations)?
How to other mods do it? (I assume they do, considering how many weapons they add in?)
... there are several problems with those complex fabs, e.g. Heavy Shield Production Complex
... if you connect it to a complex hub, it wont produce its own products, instead it will produce only the first type of product it sells
e.g. your Heavy Shield Production Complex sells 1GJ & 2GJ shields:
if you connect this station to a complex hub, it wont produce 2GJ shield more, it will only produce 1GJ shields
to add automatically wares to a station built by the player, you can add an event via mission director:
create a .xml-file, paste the following code into the file:
now paste this file (you can name it to "whatever.xml") in your "director" folder (create it if it doesnt exist)
what this md file does is to call a script (named "Event.PlayerBuiltStation") every time you build a station by TL
to handle this new event, create a script like that:
... if you connect it to a complex hub, it wont produce its own products, instead it will produce only the first type of product it sells
e.g. your Heavy Shield Production Complex sells 1GJ & 2GJ shields:
if you connect this station to a complex hub, it wont produce 2GJ shield more, it will only produce 1GJ shields
to add automatically wares to a station built by the player, you can add an event via mission director:
create a .xml-file, paste the following code into the file:
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet href="director.xsl" type="text/xsl" ?>
<director name="template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="director.xsd">
<cues>
<cue name="PLAYER_BUILT_STATION_EVENT" instantiate="static" version="1">
<condition>
<check_all>
<player_built_station/>
</check_all>
</condition>
<action>
<do_all>
<do_if value="{object.exists@{event.object}}" exact="1">
<run_script task="1" script="Event.PlayerBuiltStation">
<scriptargs>
<scriptvalue datatype="station" datavalue="{event.object}"/>
</scriptargs>
</run_script>
</do_if>
</do_all>
</action>
</cue>
</cues>
</director>
what this md file does is to call a script (named "Event.PlayerBuiltStation") every time you build a station by TL
to handle this new event, create a script like that:
Code: Select all
Script Event.PlayerBuiltStation
Version: 0
for Script Engine Version: 45
Description
... new event for station building
Arguments
1: Event.Object , Var/Station , 'station built by player'
Source Text
001
002 skip if $Event.Object -> exists
003 |return null
004
005 $Station.Type = $Event.Object -> get ware type code of object
006
007 if $Station.Type == Argon Heavy shield Production Complex
008 |$Event.Object ->factory production task: on=[FALSE]
009 |gosub Remove.All.Resources
010 |gosub Remove.All.Products
011 |$Event.Object ->add primary resource to factory: Energy Cells
012 |$Event.Object ->add primary resource to factory: Silicon Wafers
013 |$Event.Object ->add primary resource to factory: Meatsteak Cahoonas
014 |$Event.Object ->add product to factory or dock: 1GJ Shield
015 |$Event.Object ->add product to factory or dock: 2GJ Shield
016 |$Event.Object ->factory production task: on=[TRUE]
017 end
018
019 return null
020
021
022 Remove.All.Products:
023
024 $Array.Products = $Event.Object -> get products
025 skip if is datatype[ $Array.Products ] == DATATYPE_ARRAY
026 |endsub
027
028 $Index = size of array $Array.Products
029 while $Index > 0
030 |dec $Index =
031 |$Ware = $Array.Products[$Index]
032 |$Event.Object ->remove product from factory or dock: $Ware
033 end
034
035 endsub
036
037
038 Remove.All.Resources:
039
040 $Array.Resources = $Event.Object -> get tradeable ware array from station
041 skip if is datatype[ $Array.Resources ] == DATATYPE_ARRAY
042 |endsub
043
044 $Index = size of array $Array.Resources
045 while $Index > 0
046 |dec $Index =
047 |$Ware = $Array.Resources[$Index]
048 |$Event.Object ->remove primary resource from factory: $Ware
049 end
050
051 endsub
052
053
054 return null
055
To err is human. To really foul things up you need a computer.
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.
Mission Director Beispiele
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.
Mission Director Beispiele
- DarrenTomlyn
- Posts: 205
- Joined: Sun, 17. Oct 04, 19:06
Cool. Thanks - just what I was looking for...
I'm not even dealing with complexes, just individual stations - (none of the shipyards sell complexes - just the hubs to create them from individual stations) - and its the stations (e.g. PPC/CIG factories etc.) that have problems with multiple products.
It's going to take some doing, and a while to set up all the different factories, though... I guess I've got my work cut out for me, now...
Ta.
EDIT: I assume the director script be automatically run as soon as the game is started?
I'm not even dealing with complexes, just individual stations - (none of the shipyards sell complexes - just the hubs to create them from individual stations) - and its the stations (e.g. PPC/CIG factories etc.) that have problems with multiple products.
It's going to take some doing, and a while to set up all the different factories, though... I guess I've got my work cut out for me, now...
Ta.
EDIT: I assume the director script be automatically run as soon as the game is started?