Home » SIRTECH CLASSICS » Jagged Alliance: Unfinished Business » Tools and Guides Repository (Archive) » Moving mining income/ mining sectors (hacking and scripting)
Moving mining income/ mining sectors (hacking and scripting)[message #188873]
||Mon, 16 June 2008 21:56 |
||Here's some info on how to manually move the sectors where mining income is generated
earlier versions of ja2 could simply use ja2SME to achieve this, later versions that have sourcecode changes that ja2 SME does no longer support so far require manual editing.
ja2 vengeance up to date is the only public example (amongst the mods i played) that actually features mining income in different sectors than vanilla ja2, that's why i figure this information might be helpful.
of course people having saved all the contents of the old LOTB site may know these things, but i guess there are many people that don't have these contents anymore
getting started, we require a hex editor, i used the HHD hexeditor myself, but i guess it doesn't matter what kind of hexeditor you use.
then you use the search function of the hexeditor to search for this table:
04 00 04 00 07 00 0d 00 04 00 02 00 0e 00 09 00 03 00 08 00 08 00 06 00 02 00 02 00 0c 00 03 00 08 00 04 00 00 00 00 00 e8 03 00 00 dc 05 00 00 dc 05 00 00 f4 01 00 00 d0 07 00 00
the above table containts both all the sectors where there are any mines, the info to which town these mines are related and how much money the mines generate (okay, the last part is oversimplified, there are massive modifiers to the income so the table just gives a rough overview of what the "basic" income is for each mine)
if you happen to find this table any familiar, well, it's from SME_MINE.DAT, one of the files that comes with ja2 SME where you can look this up in case.
let's explain the above table a bit:
the table has to parts, the first part, here,
04 00 04 00 07 00 0d 00 04 00 02 00 0e 00 09 00 03 00 08 00 08 00 06 00 02 00 02 00 0c 00 03 00 08 00 04 00
holds the info of where mines are and what town they relate to:
let's look at the first couple of bytes: San Mona Mine is represented by the first 6 bytes (i count the double 00 as well here... 3 bytes and 3 times 00)
first byte, 04 means sector # from the left, 4
second byte, 04 means row letter. 4 in the alphabet is D ---> Row D
thrird byte, 07 means town ID. (San mona.) To look up town id's, cities.xml in 1.13 tabledata comes very handy.
i know the fact the san mona mine has the first two info bytes the same number doesn't help much, but if we look at the second Mine, drassen, then we see it confirmed:
0d 00 04 00 02 00
d is hexadecimal for 13, which gives us sector # 13 (there a simple online tools that help converting the dez/ hex values)
04 again is row number 4, 4 in alphabet again is D
02 means town ID 2 is Drassen
Now in order to change the location of a mine, it is as simple as changing the above values. However, some notes:
Head miners: While theoretically every npc in the game can activate mining income, it may be more to the modmakers wishes to actually use the head miner slots from vanilla ja2
lucky for us, the game tries to assign them to one mine of that list above automatically! That means after we changed the location of the mining income, we only need to place all possible miners in the map file of the sector where we have our new source of income (don't forget to put a "stay in sector" in shedules) and the game will do the rest for us. Yes it is rather easy and convenient.
no need for any changes in the prof.dat
Town requirements: in order to have a mine deliver income, it must be tied to a town. That town must "use loyalty" like Omerta, drassen, cambria do but not like San mona, estoni tixa or orta do. Of course in 1.13 you can change this in cities.xml, also you can use other than the default towns, yes it works for towns amended to cities.xml just as well if these cities use loyalty.
San Mona Mine:
San mona mine obviously requires an additional head miner. Refer to my information about npc scripting to find out how to activate a mine (npc action 172)
What happens if that mine runs out, i can't say. Maybe it can't run out at all, but if you're afraid it can, try using an EPC slot as head miner so he has a 48x43 face for any pop-up talks.
the second part, here
00 00 00 00 e8 03 00 00 dc 05 00 00 dc 05 00 00 f4 01 00 00 d0 07 00 00
holds the base amount of cash each mine generates
the table has the same indexes as the other one above, so the first mine is san mona, the second is drassen etc. that's also why the table starts with so many empty bytes because san mona has no income
just change the 00 00 bytes in italics for mining income in the san mona mine.
short list of indexes and (default) values:
1. san mona income 0
2. Drassen income 1000
3. Alma income 1500
4. Cambria income 1500
5. Chitzena income 500
6. Grumm income 2000
upon saving any changes to the exe, the alterations will take effect, there will be no need for restarting the game.
be aware that once you change any of these values, you'll have to search the exe for the table with changed values. Best is to note the offsets for the exe's you work with down somewhere to find it faster after you made any changes.
the above changes only affect the mining income and the head miner's distribution. it doesn't affect the place where the entrance to mines has to be, where hardcoded counter attacks happen and it most probably doesn't affect the place where monsters are spawned for the sci-fi quests.
To be on the save side however, you can use Chitzena or San mona mines for the moving as they don't have the monster quest on them so there won't be any incompatibilities.
credits go to Azrael's Ja2 SME tool which is basicly where we have all of this from.
if you find any mistakes or have better/ more information, let me know so i can fix the actual posting, thanks.
Re: Moving mining income/ mining sectors (hacking and scripting)[message #188874]
||Mon, 16 June 2008 21:57 |
||of course, all of the above is only necessary as long as no externalisation of that rather short and simple table is made.
Current Time: Sun Apr 11 06:59:57 EEST 2021
Total time taken to generate the page: 0.00861 seconds