Locking / Unlocking ships in PR1.2 (if offtopic please move)

Need help testing contributed art or code or having trouble getting your newest additions into game compatible format? Confused by changes to data formats? Reading through source and wondering what the developers were thinking when they wrote something? Need "how-to" style guidance for messing with VS internals? This is probably the right forum.
Post Reply
Dilloh
Elite Hunter
Elite Hunter
Posts: 1149
Joined: Mon Aug 14, 2006 3:56 pm
Location: Black Forest, Germany

Locking / Unlocking ships in PR1.2 (if offtopic please move)

Post by Dilloh »

Hello,

this is most likely off-topic, but I don't know where else to go since I haven't found anything in the search function, VS wiki or in the PR forum.

I'm currently trying to implement a new ship into PR, see here:
http://vegastrike.sourceforge.net/forum ... php?t=4684

The ship is a Demon variant and runs fine but I just have three problems:
1.) It won't appear in the Ship Dealer's list to buy
2.) I've got a feedback that the original Demon is no longer available
3.) I'd further like to know where you define that a ship/upgrade appears in a campaign at a later point, e.g. like the Drayman which can be bought after the Oxford missions.

So far I understand that EVERYTHING needs an entry in units.csv. Only items which are available from the beginning are in the master part list. I wonder if it is because it is a Demon model which is a campaign-related ship itself. I have no idea so far. I've also made entries in factions.py and added my new ship into the flightgroups, without success in making it buyable.

I've browsed nearly all py files, csvs and xmls, but I can't find anything. I'd be thankful for any kind of hint.

Regards,

Dilloh

P.S.: The ship comes with a new gun which is ment to be not buyable, so I placed it into the alien category which appears on no base. The ship itself is placed into /Hunter/Light, but doesn't appear. It is a ship with milspec items.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Post by klauss »

I seem to recall the existence of two .csv files... units.csv and unitsRF.csv, like at some point python code or something similar loads unitsRF.csv, overriding what's in units.csv - you might try to search for that.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Dilloh
Elite Hunter
Elite Hunter
Posts: 1149
Joined: Mon Aug 14, 2006 3:56 pm
Location: Black Forest, Germany

Post by Dilloh »

I already looked it up. It indeed shows all missing units like Talon, etc. Still I can't find the python script which says "Talon now available". units180.csv doesn't contain any info about that, and I've browsed nearly all py files so far in search for it. Anybody else got a hint, also concerning my other questions?
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Post by klauss »

Got the answer.
Apparently you add entries to "mission data" fields named:
  • master_part_list_content
  • master_part_list_category
  • master_part_list_volume
  • master_part_list_price
  • master_part_list_mass
  • master_part_list_description
(as if they were master_part_list.csv columns).
Then I'm not sure whether you have to call something named UpdateMasterPartsList() or if it happens automatically. I guess you can try.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Dilloh
Elite Hunter
Elite Hunter
Posts: 1149
Joined: Mon Aug 14, 2006 3:56 pm
Location: Black Forest, Germany

Post by Dilloh »

Sorry klauss, but I don't understand (I'm a bit slow sometimes) - where is this "mission data" field? Is it an entry in campaign.py? At least I never saw that one...
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Post by klauss »

Mission data is thing you put into the savegame with a built-in module: the Director module:

Code: Select all

import Director
...
Director.pushSaveString("master_part_list_content","Ship description")
Director.pushSaveString("master_part_list_category",<Category>)
etc...
An easier way to do that would be (but that would have to be added)...

Code: Select all

import Director
Director.importMasterPartsList("master_parts_list.RF.csv")
I'll see if I add that...
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Dilloh
Elite Hunter
Elite Hunter
Posts: 1149
Joined: Mon Aug 14, 2006 3:56 pm
Location: Black Forest, Germany

Post by Dilloh »

Okay thanx, I still can't imagine how exactly it will work but I'll give it a try.
Melonhead
Bounty Hunter
Bounty Hunter
Posts: 131
Joined: Fri Sep 08, 2006 1:33 am
Location: Hampton, VA USA

Post by Melonhead »

Okay, later posts elsewhere suggest Dilloh has figured this out and is coding PR campaigns. Details, please!
Dilloh
Elite Hunter
Elite Hunter
Posts: 1149
Joined: Mon Aug 14, 2006 3:56 pm
Location: Black Forest, Germany

Post by Dilloh »

The solution is relative easy, though an other than klauss has showed me.

Look up faction_ships.py, there is a technology list containing the missing ships and parts of the mpl. You can put in anything you like there, even give it an own technology key, as long as you remove those parts from the mpl.

Code: Select all

earnable_upgrades= {
	"confed":[["broadsword","starships/Deprecated",1250000,40,800,"The Broadsword is a commonly encountered Confederation fighter. It is equipped with a deadly array of blasters and several HS and FF missiles, which pose a severe threat to any enemy that ventures to cross its path. The Broadsword's main weaknesses lie in its slow speed, low maneuverability and limited acceleration powers.  If you are flying a very maneuverable ship in an encounter with this vessel, the odds are definitely in your favor. A side attack on the weaker port and starboard armor is advisable."],
		["stiletto","starships/Confed/Milspec",2000000,80,1600,"The stiletto is the fastest ship in the Confederation fleet. WIth an afterburner velocity of 1400 kps and excellent maneuverability, it can evade even the swifted Kilrathi fighters. The stiletto's weakness lies in the extremely flimsy armor and relatively light weapons loadout.  If you encounter an experienced pilot in a Stiletto, however, you should prepare for a grueling combat because his high maneuverability lets him get uncomfortably close."],
		["paradigm","starships/Deprecated",8700000,2150,43000,"The Paradigm is one of the Confederations most advanced destroyers. Featuring almost impregnable armor and shields, it more than compensates for a lack of speed and maneuverability.  The paradigm also has a deadly array of weapons at its disposal making an attack of any sort extremely dangerous.  It carries an astonishing variety of blasters, ranging frmo meson blasters to ionic pulse cannons.  Multiple missiles can deter even the most aggressive Kilrathi aces."],
		["broadsword.blank","starships/Confed/Heavy",780000,40,1000,"The Broadsword is a commonly encountered Confederation fighter. It is equipped with a deadly array of blasters and several HS and FF missiles, which pose a sever threat to any enemy that ventures to cross its path. The Broadsword's main weaknesses lie in its slow speed, low maneuverability and limited acceleration powers.  If you are flying a very maneuverable ship in an encounter with this vessel, the odds are definitely in your favor. A side attack on the weaker port and starboard armor is advisable."],
		["stiletto.blank","starships/Confed/Light",280000,80,1600,"The stiletto is the fastest ship in the Confederation fleet. WIth an afterburner velocity of 1400 kps and excellent maneuverability, it can evade even the swifted Kilrathi fighters. The stiletto's weakness lies in the extremely flimsy armor and relatively light weapons loadout.  If you encounter an experienced pilot in a Stiletto, however, you should prepare for a grueling combat because his high maneuverability lets him get uncomfortably close."]],
	"militia":[["gladius","starships/Deprecated",450000,40,800,"The Gladius combines good velocity and acceleration with an effective and varied array of weapons. Its torpedos make it an effective fighter for combat against capital ships. With its fairly strong blaster loadout and HS missiles, the Gladius is a versatile dogfighting spacecraft.  Due to its maneuverability, it is hard to target one accurately, but just a few target hits can down a Gladius because of its weak shields."],
		["gladius.blank","starships/Confed/Medium",80000,40,1000,"The Gladius combines good velocity and acceleration with an effective and varied array of weapons. Its torpedos make it an effective fighter for combat against capital ships. With its fairly strong blaster loadout and HS missiles, the Gladius is a versatile dogfighting spacecraft.  Due to its maneuverability, it is hard to target one accurately, but just a few target hits can down a Gladius because of its weak shields."]],
	"kilrathi":[["dralthi.blank","starships/Kilrathi/Light",450000,132,2700,"The only starship to be present in most every era of the Human-Kilrathi war."],
		["gothri.blank","starships/Kilrathi/Heavy",600000,197,4000,"The Kilrathi Gothri can pose a very real threat to any ship in the Gemini Sector.  With its impressive acceleration, it can reach high velocities. When you are facing a Gorthri in combat, you should concentrate on its weak armor.  A few well placed concentrated bursts of gunfire can severely damage this fighter.  However, it is not that easy to close on it.  The Gothri is very maneuverable and can easily down you first with its array of blasters."],
		["salthi.blank","starships/Kilrathi/Heavy",300000,216,4400,"Unknown describes just about every aspect of this fighter that people simply do not see on the front."]],
	"hunter":[["demon.blank","starships/Hunter/Light",125000,40,1000,"The Demon combines high velocities and powerful acceleration powers with a wide array of deadly weapons.  Its torpedo loadout can even take out capital ships like the Kamekh or Paradigm with relative ease.  If you are forced to fight the Demon in a close dogfight, try to make a side attack on that location's weak armor."],
		["demon","starships/Deprecated",185000,40,1000,"The Demon combines high velocities and powerful acceleration powers with a wide array of deadly weapons.  Its torpedo loadout can even take out capital ships like the Kamekh or Paradigm with relative ease.  If you are forced to fight the Demon in a close dogfight, try to make a side attack on that location's weak armor."],
		["centurion","starships/Deprecated",400000,40,1000,"This is the workhorse of the mercenary community. The centurion is a heavy fighter with the ability to do almost any gun-for-hire work. The limited cargo hold can contain more than an overnight bag, but not by much.  This is a ship for those pilots who love to fly, but it won't make you a living on the trade circuit."],
		["orion","starships/Deprecated",180000,40,1000,"The orion is perhapos the safest of all vehicles.  It can carry the most armor and shields of all ships in the Gemini sector (at the expense of its maneuverability). This is a sturdy ship, designed to last."]],
	"pirates":[["talon","starships/Deprecated",70000,38,800,"The Talon is probably the ship you will encounter most often in Gemini. Flown by numerous different factions it may appear in slightly different designs but its weapon loadouts and dynamics remain the same.  You should take extreme care to keep the Talon away from your rear, since it is equipped with numerous HS missiles. If you are an accomplished pilot, you should be able to take out a Talon with relative ease, especially if you are flying a Stiletto or Centurion, since its armor is extremely weak. Try to avoid its particle cannon, since a hit can inflict sizable damage."],
		#["talon","The retros, being by their nature not given to grand industrialization, rely on a small number of hidden facilities and sympathetic manufacturing plants to supply them with ships. The Talon bears the distinction of being the only class of spacecraft officially sanctioned by the reverend Sverde, who, when presented with its initial designs 45 years ago, said that prayer had revealed to her that that this was to be the 'shepherds crook' by which man's sins would be constrained. Inexpensive, even at the time of its introduction, the Talon remains a utilitarian craft well suited to the production schedules of backwater worlds."],
		["talon.blank","starships/Pirate/Light",40000,40,1000,"The Talon is probably the ship you will encounter most often in Gemini. Flown by numerous different factions it may appear in slightly different designs but its weapon loadouts and dynamics remain the same.  You should take extreme care to keep the Talon away from your rear, since it is equipped with numerous HS missiles. If you are an accomplished pilot, you should be able to take out a Talon with relative ease, especially if you are flying a Stiletto or Centurion, since its armor is extremely weak. Try to avoid its particle cannon, since a hit can inflict sizable damage."]],
	"merchant":[["drayman.blank","starships/Merchant/Light_Capship",1200000,1000000,40000000,"Lumbering doesn't begin to describe the speed at which Drayman cargo vessels deliver massive quantities of cargo to their destination. If it wasn't for the thick armor this starship has, most would succumb to their enemies before limited help arrived."],
		["galaxy","starships/Deprecated",270000,20000,570000,"A versatile merchant's vessel, the Galaxy is perfect for those with an entrepreneurial spirit.  She is by no means a military vessel, but a Galaxy can usually protect herself and the large amount of cargo she's able to carry."],
		["drayman","starships/Deprecated",1500000,1000000,40000000,"Lumbering doesn't begin to describe the speed at which Drayman cargo vessels deliver massive quantities of cargo to their destination. If it wasn't for the thick armor this starship has, most would succumb to their enemies before limited help arrived."]],
	"troy":[["tarsusMk2.blank","starships/Merchant/Light",40000,150,1500,"The unexpected success of the Galaxy as a merchanter gunship turned the Guild's attention to developing lower cost version. Their efforts to turn the venerable Tarsus into an cheap, adequate gunship produced the Tarsus Mk2 - a variant with a belly gun turret, higher shield and faster speed to keep pace with Galaxies in a merchant convoy."],
		["afterburner","upgrades/Engines/Engine_Enhancements_Medium",9000,0.01,1,"@upgrades/afterburner.png@Afterburners more than double your speed and can mean the difference between life and death in asteroid fields and combat. As they are relatively inexpensive, I highly recommend buying afterburners, especially if you are flying older ships."],
		["jump_drive","upgrades/Miscellaneous",30000,0.01,1,"@upgrades/jumpdrive.png@This is undoubtedly one of your most important and expensive purchases. Unfortunately one manufacturer essentially has a monopoly on jump drives (A common problem with many frontier products).  The jump drive is your ticket to interspacial systems."]],
	"orionvar":[["orionMk2.blank","starships/Merchant/Heavy",100000,200,3700,"The Orion Mk2 was the product of the Merchant Guild's efforts to produce a tough trading vessel that could go where the TarsusMk2 could not.  Taking the Hunter Orion,  guild ship engineers reconfigured the ship to have more missile launchers and a top turret.  Though slower than the hunter version this variant has more cargo space and is rumored to have a faster jump than normal."],
		["orionMk3.blank","starships/Merchant/Heavy",150000,350,3700,"The Orion Mk3 has a dual role of being  a convoy gunship on dangerous runs.  Carrying triple missile launchers and having two weapon turrets, the Mk3 is a dangerous adversary even for very skilled enemy pilots."],
		["orionMk4.blank","starships/Hunter/Heavy",200000,200,3700,"The OrionMk4 is an upgraded version of the Hunter Orion featuring two weapon turrets."]],
	"galavar":[["galaxygs.blank","starships/Hunter/Heavy",250000,350,7500,"An unusual derivative of the Galaxy requested by hunters for use as a heavy assault ship. More turrets, more missiles, more speed, more power, and better shields. Better pack light though, as it has little room for cargo."],
		["galaxyhk.blank","starships/Merchant/Medium",200000,315,7500,"The Galaxy HK is the Merchant guild's answer to the ever more dangerous job of a gunship escort for trade convoys.  It is the fastest merchant ship in existence and the most heavily armed, at the cost of having half the cargo space of the stock Galaxy."]],
	"fireblade":[["fireblade","starships/Hunter/Light",500000,30,1000,"Bold enough to distract the enemy. Fast enough to retreat when the odds are bad. Expect nothing else than hit and run from this ship. Use the cloak wisely as it will only work for large distances and make you vulnerable for a long time while you cloak or decloak."]],
	"hornetcvl":[["hornetCVL.blank","starships/Militia/Light",40000,100,1000,"The Hornet CVL is a civilian version of the famous Confed Hornet interceptor.  Though of lower speed, it has heavier shields and armament as well as upgraded avionics. It was released in 2669 as a support to privateer merchant escort missions."]],
	"dmcvl":[["draymanCVL.blank","starships/Militia/Light_Capship",4000000,15000,110000,"Based on the Drayman heavy Merchant vessel, the Drayman Light Carrier was created to provide a carrier for militia forces to effectivly counter the rising threat from the retros. With four heavy turrets, seven medium turrets, twin missile launchers, and a small wing of fighters, the militia as well as their allies finally have the strikeing power to effectivly police the quadrant."]],
	"tech":[["mult_shield_regenerator","upgrades/Shield_Systems/Heavy",170000,0.01,1,"@upgrades/shield_regenerator.png@Increases the recharge rate of shields."],
		["gun_cooler","upgrades/Reactors/Heavy",300000,0.01,1,"@upgrades/gun_cooler.png@A more powerful radiator unit for the mount decreases the refire delay."],
		["mult_speed_enhancer","upgrades/Engines/Engine_Enhancements_Heavy",240000,0.01,1,"@upgrades/speedenhancer.png@By improving the tolerances on a vessel's passive particle shielding and autocompensating software, higher speeds can be safely reached before the shields must be expanded and thereby thinned."],
		["fusion_gun","upgrades/Weapons/Mounted_Guns_Heavy",100000,0.01,1,"@upgrades/fusion.png@"],
		["medium_turret_fusion","upgrades/Weapons/Turrets",217500,0.1,1,"@upgrades/turret_medium.png@Equipped with two fusion cannons and a tractor beam.  It turns, it shoots, it slices. No, it does not dice, but it does come with a free fuzzy pair."],
		["medium_turret_rear_fusion","upgrades/Weapons/Turrets",217500,0.1,1,"@upgrades/turret_rear.png@Equipped with two fusion cannons and a tractor beam.  It turns, it shoots, it slices. No, it does not dice, but it does come with a free fuzzy pair. Perfect for the back of your ship."],
		["salthi.blank","starships/Kilrathi/Heavy",300000,216,4400,"Unknown describes just about every aspect of this fighter that people simply do not see on the front."],
		["reactor_level_4","upgrades/Reactors/Heavy",100000,0.01,1,"@upgrades/engine4.png@Standard heavy reactor (level 4)."],
		["reactor_level_5_galaxy","upgrades/Reactors/Heavy",150000,0.01,1,"@upgrades/engine5.png@Heavy reactor modified to fit within the limited constraints of the galaxy (level 5)."],
		["reactor_level_6","upgrades/Reactors/Heavy",250000,0.01,1,"@upgrades/engine6.png@Standard heavy reactor (level 5)."],
		["reactor_level_7","upgrades/Reactors/Heavy",350000,0.01,1,"@upgrades/engine7.png@Standard heavy reactor (level 5)."],
		["shield_4_Level4","upgrades/Shield_Systems/Heavy",100000,0.01,1,"@upgrades/shields.png@A combination of magnetic and gravitic protective shields. 4 emitter model."],
		["shield_4_Level5_galaxy","upgrades/Shield_Systems/Heavy",150000,0.01,1,"@upgrades/shields.png@A combination of magnetic and gravitic protective shields, specifically tailored to the galaxy class vessel's limited upgrade slots and power feeds. 4 emitter model."],
		["shield_4_Level6","upgrades/Shield_Systems/Heavy",180000,0.01,1,"@upgrades/shields.png@A combination of magnetic and gravitic protective shields. 4 emitter model."],
		["shield_4_Level7","upgrades/Shield_Systems/Heavy",200000,0.01,1,"@upgrades/shields.png@A combination of magnetic and gravitic protective shields. 4 emitter model."],
		["isometal","upgrades/Armor/Confed_Milspec",6000,0.01,1,"@upgrades/isometal.png@Making the armor structure very regular, the armor is made much stronger."],
		["add_small_cargo_volume","upgrades/Miscellaneous",18000,8,4,"@upgrades/cargo_expansion.png@A smaller cargo expansion can fit on most starships, yet causes a reduction in the effectiveness of the intertial compensators. With one of these, don't plan on accelerating quickly to get out a fight."],
		["isometal_hull","upgrades/Hull/Confed_Milspec",12000,10,0,"@upgrades/isometal.png@Making the hull structure very regular, this hull coating is made much stronger."]],
	"shield2":[["shield_2_Level1","upgrades/Shield_Systems/Light",9000,0.01,1,"@upgrades/shields.png@A combination of magnetic and gravitic protective shields. 2 emitter model."],
		["shield_2_Level2","upgrades/Shield_Systems/Medium",25000,0.01,1,"@upgrades/shields.png@A combination of magnetic and gravitic protective shields. 2 emitter model."],
		["shield_2_Level3","upgrades/Shield_Systems/Medium",40000,0.01,1,"@upgrades/shields.png@A combination of magnetic and gravitic protective shields. 2 emitter model."],
		["shield_2_Level5","upgrades/Shield_Systems/Heavy",140000,0.01,1,"@upgrades/shields.png@A combination of magnetic and gravitic protective shields. 2 emitter model."]],
	
	"shield2_tech":[["shield_2_Level4","upgrades/Shield_Systems/Heavy",90000,0.01,1,"@upgrades/shields.png@A combination of magnetic and gravitic protective shields. 2 emitter model."],
		["shield_2_Level6","upgrades/Shield_Systems/Heavy",180000,0.01,1,"@upgrades/shields.png@A combination of magnetic and gravitic protective shields. 2 emitter model."],
		["shield_2_Level7","upgrades/Shield_Systems/Heavy",200000,0.01,1,"@upgrades/shields.png@A combination of magnetic and gravitic protective shields. 2 emitter model."]]}
Here is the part in my current faction_ships.py, already fitted with some newly locked ships.
Melonhead
Bounty Hunter
Bounty Hunter
Posts: 131
Joined: Fri Sep 08, 2006 1:33 am
Location: Hampton, VA USA

Post by Melonhead »

Okay, but how do you unlock the ship? Copy it back to master_parts_list.csv, or is there a different trigger that says to look in faction_ships?
Dilloh
Elite Hunter
Elite Hunter
Posts: 1149
Joined: Mon Aug 14, 2006 3:56 pm
Location: Black Forest, Germany

Post by Dilloh »

Ships or stuff are/is being unlocked within the progress of a campaign. In the lines I posted you e.g. see a confed-line:

Code: Select all

"confed":[["broadsword",
etc.

Now in campaigns.py, after destroying the drone, you have:

Code: Select all

TrueSubnode(AddCredits(30000,AddTechnology("confed"))),
That's how it works. You can do this with any sort of ship, item, maybe even cargo? (I thought that's what you're in for :wink: )
targ collective
Bounty Hunter
Bounty Hunter
Posts: 237
Joined: Fri Mar 30, 2007 2:57 pm

Post by targ collective »

Well, the Fusion Heavy Turrets don't yet appear in master_part_list, and there's no point having Paradigm armour before you can buy the paradigm. I'm counting on you to join the dots for me there, Dilloh, I'm allergic to Python.
Dilloh
Elite Hunter
Elite Hunter
Posts: 1149
Joined: Mon Aug 14, 2006 3:56 pm
Location: Black Forest, Germany

Post by Dilloh »

If you mean that all upgrades should appear in the reasonable time, don't worry... I'm sure I'll find a way for that.

For allergics, I suggest antibiotica.
Post Reply