How Do I Add a NEW Weapon?

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
prestidigitator
Mercenary
Mercenary
Posts: 123
Joined: Sat Apr 22, 2006 8:54 pm
Location: California, USA

How Do I Add a NEW Weapon?

Post by prestidigitator »

I am getting really, REALLY frustrated here. I want to simply add a new weapon to the game. I'm using 0.4.3. I have modified all the files that seem to be applicable, but when I go to try to buy the damn thing or edit my saved game to have one, it doesn't show up.

Here is what I have done:
  1. weapon_list.xml: Copied the entire <Beam name="LaserBeam' ...> node to the end of the file (just before the </WEAPONS> end tag), changed the name from "LaserBeam" to "MyLaserBeam", and modified the values to be what I wanted (I left the "mountsize" attribute as "light").
  2. master_part_list.csv: Copied the line starting with "laser_beam" to the end of the file and changed "laser_beam" to "my_laser_beam".
  3. units/units.csv: Copied the line starting with "laser_beam__upgrades" to the end of the file, changed "laser_beam__upgrades" to "my_laser_beam__upgrades", changed "./factions/upgrades/laser_beam" to "./factions/upgrades/my_laser_beam", changed the second "laser_beam" to "my_laser_beam", and finally changed the "LaserBeam" to "MyLaserBeam".
  4. units/factions/upgrades/ (EDIT: This step is unnecessary. The entire units/factions directory does not seem to be used by the game; it certainly isn't for upgrades.) : Copied the "laser_beam/laser_beam" file to "my_laser_beam/my_laser_beam" and changed the "weapon" attribute of the <mount> node from "LaserBeam" to "MyLaserBeam".
I've done searches for every single instance of the (case-insensitive) pattern "laser_?beam" in the whole vegastrike directory. I can't find any more possible places where it might need to be changed. I've restarted VS numerous times, jumped back and forth from another system, etc. The new weapon never shows up in the upgrades screen, and if I change all instances of "LaserBeam" in the serialized_xml of my saved game to "MyLaserBeam", the weapons disappear completely.

Help! There is no HowTo on adding upgrades (or weapons specifically). I've searched the forums. I've searched the wiki. No HowTos. No file format specifications. Nothing. :-(
Last edited by prestidigitator on Tue May 29, 2007 7:47 pm, edited 1 time in total.
prestidigitator
Mercenary
Mercenary
Posts: 123
Joined: Sat Apr 22, 2006 8:54 pm
Location: California, USA

Post by prestidigitator »

Right. Okay. NVM then. There's an ordering problem. I moved all the additions to immediately after those entries for the laser beam, and it worked.

So, I guess if you are trying to do this, consider my steps above to be a mini-HowTo, with the caveat that you should be careful about WHERE in the files you add things. Heh. :oops:
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

Thanks for documenting this process.

I added your post here if it's fine with you:
http://vegastrike.sourceforge.net/wiki/ ... ke_Weapons

Adding weapons used to be easier before we switched to the new CSV-based system... I believe many of the weapons there were autogenerated based on older data which is why no one had ever really documented the process.
prestidigitator
Mercenary
Mercenary
Posts: 123
Joined: Sat Apr 22, 2006 8:54 pm
Location: California, USA

Post by prestidigitator »

No problem, and I don't mind the transcription at all.

I'm now in the process of trying to figure out where the HECK the logic is for what ships can get what upgrades. Any guidance there would be appreciated. I've dug through the data files and python scripts enough to start thinking it might be in the source code itself, though that makes little sense for a game that is supposed to be so pluggable for mods and such. :?
prestidigitator
Mercenary
Mercenary
Posts: 123
Joined: Sat Apr 22, 2006 8:54 pm
Location: California, USA

Post by prestidigitator »

OH! Doh! I just realized that might be what the '.template' version of the ships is for. It holds all the upgrades possible on that type of ship. That right?
prestidigitator
Mercenary
Mercenary
Posts: 123
Joined: Sat Apr 22, 2006 8:54 pm
Location: California, USA

Post by prestidigitator »

Hmm. No. It can't be quite so simple as an inclusion, or the weapon I added couldn't be purchased for the llama, and I was able to do so. Unless the order in the CSV file matters even more than I thought.... :?
prestidigitator
Mercenary
Mercenary
Posts: 123
Joined: Sat Apr 22, 2006 8:54 pm
Location: California, USA

Post by prestidigitator »

Okay. I think I have it figured out. For weapons, what a ship can upgrade with is purely determined by the type of mounts it has (the "Mounts" field for the ship). For other upgrades, each single piece of equipment--or a composite upgrade which includes it (e.g. "add_general_upgrade")--has to be listed in the "Upgrades" field of every single model of ship that can get that upgrade. The upgrades that actually come with a model to start with are in fact in the "Cargo" field).

So if you add a weapon, setting the class (e.g. light, medium, heavy, special) should be enough. If you add a different kind of upgrade, you're going to have to go through every single ship in the game (or mod) and add it in if appropriate.
prestidigitator
Mercenary
Mercenary
Posts: 123
Joined: Sat Apr 22, 2006 8:54 pm
Location: California, USA

Post by prestidigitator »

prestidigitator wrote:For other upgrades, each single piece of equipment--or a composite upgrade which includes it (e.g. "add_general_upgrade")--has to be listed in the "Upgrades" field of every single model of ship that can get that upgrade. The upgrades that actually come with a model to start with are in fact in the "Cargo" field)...If you add a different kind of upgrade, you're going to have to go through every single ship in the game (or mod) and add it in if appropriate.
Except that the instant you sell an upgrade, everything seems to go to hell. I've made a custom shield and added it to the "Upgrades" field of "llama.begin" (actually I added it to all models of llama, just in case), and I can buy it right away in a new game, but the instant I sell the stock "shield_4", ALL shields (and several other upgrades, like reactors) turn red. It's not a money issue; I have enough to buy any of the things I am looking at. Restarting, saving and reloading, launching/docking, and jumping systems do not help. Oy!
Post Reply