Adding arbitrary new gun classes
-
Hi folks,
I’ve been working with Laz to try and create a plugin that adds arbitrary gun/turret classes to ships and equipment, we were able to get one class working through coincidence (hp_type of 67) but have hit a bit of a roadblock.
I know something similar has been done before using Adoxa’s engclass plugin. I’ve attached Laz’s cliff notes that explain our specific problem below, as he’s not able to currently post to TSP! Does anyone have any pointers for us?
- engclass allows shows how to add classes to internal equipment
- The original intention was to modify this plugin to extend the amount of classes for other equipment types (weapons, turrets, shields)
- During the inventory/dealer hooks get_hp_type is called which is modified by engclass to return the new number.
- The issue exists that in normal usage get_hp_type for, say, weapons, returns the number 4. I have looked extensively into how it works, but cannot decipher why it returns the number 4, or what the implications of this are.
- There are clearly other parts of the code that are used to calculate whether guns are mountable what class they actually are, but I have been unable to locate or figure out what needs to be changed to make this work.
- If get_hp_type is modified to return the new number, then it will crash when the base game goes to call it on the weapon during opening the equipment dealer. - The equipment index, ids bindings, level index, mount description index, and mount list were all updated dynamically, so the issue doesn’t exist there.
- We wrote assembly at offset 0x9659E to allow us to correctly read new gun hardpoint values. We effectively checked if the string was in our list of custom new class names, otherwise let the original code handle it.
-
There’s another way to achieve what you’re doing using all the standard stuff already present, with minimal coding.
You can simply assign a weapon class to a certain ship type. For example,
Class 1 = Light fighter
Class 2 = Medium Fighter
Class 3 = VHFAnd so on. That way you end up with 10 different weapon classes for ten different types of ship. Only coding you have to do is change the weapon class description in the dll’s.
One way to do it anyway. Unless you’re trying to do something different and i completely misunderstood
-
Thanks for the pointers, but we’re trying to do something entirely different! The way weapon classes are set up in the mod we’re working on unfortunately requires more than the 20 or so that Freelancer provides.
The idea here would be to allow users of the plugin to arbitrarily add another set of class 1-10 hard-points, so you’d have [c]hp_gun_special_1-10[/c], [c]hp_turret_special_1-10[/c], and then your own [c]hp_gun_new_1-10[/c], all named and defined appropriately via an ini file!