Reminder: Internet Explorer 6 or below are NOT supported.





There are currently 55 users playing Freelancer on
42 servers. | March. 29, 2023 |
The Starport Forum Index
>
The Shipyard
>
Speciality Modding
>
Programatically working out how many weapons/turrets a ship has
Browsing this Thread:
1 Anonymous Users
Programatically working out how many weapons/turrets a ship has |
||||
---|---|---|---|---|
![]() Joined:
2016/3/29 21:54 From England
Group:
Registered Users Trusted Speciality Developers
Posts:
45
![]() |
Hey guys. Inside of FLHook we have the following definition for the ship entry.
Code:
I see there was something identified to do with hptypes but it's a mysterious unknown. I was wondering if anyone had any idea how I could work out the amount of guns / turrets a ship had.
Posted on: 2020/3/4 19:21
|
|||
Way too ambitious for his own good. | ||||
|
Re: Programatically working out how many weapons/turrets a ship has |
||||
---|---|---|---|---|
Just can't stay away
![]() ![]() Joined:
2008/5/9 17:27 Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
246
![]() |
You could use
Code: CEquip *equip = cship->equip_manager.Traverse(tr); and Code: EquipDesc ed; Cheers Crazy
Posted on: 2020/3/4 21:55
|
|||
|
Re: Programatically working out how many weapons/turrets a ship has |
||||
---|---|---|---|---|
![]() Joined:
2016/3/29 21:54 From England
Group:
Registered Users Trusted Speciality Developers
Posts:
45
![]() |
Very cool, but I don't have access to CShip. The thing I am hooking gives me a Archetype::Ship* object instead. Is it possible to get the CShip value from that at all?
Posted on: 2020/3/4 23:03
|
|||
Way too ambitious for his own good. | ||||
|
Re: Programatically working out how many weapons/turrets a ship has |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2021
![]() |
The unknown is a vector consisting of HpAttachmentType and a vector of CacheString. You could process the vector directly, or use
get_legal_hps with each type. You'd then have to look at each CacheString and count the unique ones (or maybe you could get away with the one with maximum length).
Posted on: 2020/3/5 2:37
|
|||
|
Re: Programatically working out how many weapons/turrets a ship has |
||||
---|---|---|---|---|
![]() Joined:
2016/3/29 21:54 From England
Group:
Registered Users Trusted Speciality Developers
Posts:
45
![]() |
Interesting. We don't have a definition for HpAttachmentType (just a blank enum), so I'll probably run some checks later on to log all the possible values for it.
Which unknown do you mean? iDunno12[19] or iDunno6[4] or idunno[20]
Posted on: 2020/3/5 10:27
|
|||
Way too ambitious for his own good. | ||||
|
Re: Programatically working out how many weapons/turrets a ship has |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2021
![]() |
iDunno6. Here's HpAttachmentType in FriendlyFire's GitHub.
Posted on: 2020/3/5 13:22
|
|||
|
Re: Programatically working out how many weapons/turrets a ship has |
||||
---|---|---|---|---|
![]() Joined:
2016/3/29 21:54 From England
Group:
Registered Users Trusted Speciality Developers
Posts:
45
![]() |
All the work has been done for me. Fantastic. Thank you all!
Posted on: 2020/3/5 14:29
|
|||
Way too ambitious for his own good. | ||||
|