Outpost Universe Forums

Projects & Development => Outpost 2 Programming & Development => Topic started by: Sirbomber on April 04, 2011, 11:01:47 PM

Title: Unit Offsets
Post by: Sirbomber on April 04, 2011, 11:01:47 PM
I was reading through the Internal Data documents (here (http://forum.outpostuniverse.net/index.php?showtopic=3650)), specifically the notes on the UnitTypeInfo data structure.  I was hoping to change unit stats several times on-the-fly for something I've had in mind for awhile.  Unfortunately, I hit a roadblock:

Quote
Unit stats can be found at the following addresses:

Address  Unit Type
-------  ---------
551370     Common ore smelter
[end of file]

This would have been very useful, if I had been interested in playing with the Common Ore Smelter.  But I don't.  So if anyone could help me calculate the rest of the offsets, or just give me a list if it's kicking around somewhere, I'd really appreciate it.
Title: Unit Offsets
Post by: BlackBox on April 04, 2011, 11:47:43 PM
Well, a table of pointers to unit info objects is located at 0x4E1348. It's indexed by map_id so you could do something like:

Code: [Select]
int **unitInfoArray = (int**)0x4e1348;

int *cargoTruckUnitInfo = unitInfoArray[mapCargoTruck];
for example to store the pointer to the cargo truck unit info in cargoTruckUnitInfo. I think if you look at the HFL source code there is some stuff in UnitInfo.cpp that might be helpful (and that class may be a cleaner way of getting at the data anyway, it has a bunch of premade functions so you could do UnitInfo truck(mapCargoTruck); and then access it with some functions on the class, or you could just grab its internalPtr that gets set up... which reminds me, I would like to finish HFL someday perhaps.
Title: Unit Offsets
Post by: Sirbomber on April 05, 2011, 09:07:22 AM
Ah, HFL can do that?  Well, I kinda wanna play around with this myself, but if I keep running into trouble I'll just use HFL.  Anyways, thanks.