Freelancer Community Network
Reminder: Internet Explorer 6 or below are NOT supported.
HomeHome
ForumForum
WikiWiki
DownloadsDownloads
ForgeForge
Multiplayer Connection Tutorial
Collapse/Expand Random Image
Collapse/Expand Login
Username:

Password:

Remember me



Lost Password?

Register now!
Collapse/Expand Chat
Collapse/Expand Who's Online
92 user(s) are online (82 user(s) are browsing Forum)

Members: 0
Guests: 92

more...
Collapse/Expand Donations
Monthly costs: -30€
Income (ads): +5€
Donations (last month): +0€

Current balance: 55€
(last updated 04/2021)

Please make a donation if you want to help keeping The-Starport online:

Thanks!
Collapse/Expand Links
Collapse/Expand Advertisement
There are currently 39 users playing Freelancer on 42 servers.
September. 21, 2023

Browsing this Thread:   1 Anonymous Users



 Bottom   Previous Topic   Next Topic  Register To Post



Adding arbitrary new gun classes
Quite a regular
Joined:
2008/2/14 21:37
From İstanbul, Turkey
Group:
Registered Users
Wiki editors
$$$ Supporters $$$
Posts: 176
Offline
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?

Quote:

- 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.

Posted on: 5/14 11:51
Top
Re: Adding arbitrary new gun classes
Just can't stay away
Joined:
2012/5/22 20:21
Group:
Registered Users
Posts: 254
Offline
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 = VHF

And 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

Posted on: 5/14 13:47
Top
Re: Adding arbitrary new gun classes
Quite a regular
Joined:
2008/2/14 21:37
From İstanbul, Turkey
Group:
Registered Users
Wiki editors
$$$ Supporters $$$
Posts: 176
Offline
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 hp_gun_special_1-10, hp_turret_special_1-10, and then your own hp_gun_new_1-10, all named and defined appropriately via an ini file!

Posted on: 5/14 14:45
Top