Qhimm.com Forums
Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: ARMs on 2007-06-14 08:42:43
-
How you do cacualate and seperate Encounter probablilty and Encounter ID?
the first 6 bits represent probabilty while the last 10 bits represent the Battle/Encounter ID.
What i'm asking for is maybe a formula of some sort? I'm puzzled as to what these bytes mean 8A 18.
God I hope someone understands what i'm trying to say.
-
The Wiki page (http://wiki.qhimm.com/FF7/Field/Encounter) explains this.
-
Yeah thats what i'm talking about but i what i want is some way to translate the Byts in the field file somet hing i can understand and convert it back so i can put it in the filed file.
-
Well, there's pseudocode on the page under "Encounter Structure" to do this but I'm guessing from what you wrote you aren't familiar with byte representations, so here's a quick explanation.
Convert the hex representation of the two bytes you see into binary form, as follows:
8: 1000
A: 1010
1: 0001
8: 1000
Then simply divide up the 8A18 along the 6/10 bits line, like so: 1000 10 || 10 0001 1000. The first portion is your probability, the second your encounter ID.
Probability 100010 in decimal is: 2+32=34
Encounter ID 1000011000 in decimal is: 8+16+512=536.
If you then want to make changes, you do so in binary form to these two values. Let's say you want to change the probability and encounter ID to... say, 15 and 328, respectively.
Probability 15 in binary is: 001111
Encounter ID 329 in binary is: 0101001001
Put these together with the probability first, encounter second, and you get: 0011 1101 0100 1001. These are your two new bytes - in binary form. To put them back in the file with a hex editor you just need to convert them back to hexadecimal form.
0011: 3
1101: D
0100: 4
1001: 9
Which gives you 3D49, your final value.
Note: I've seen unusual effects in trying to switch out probabilities, so if you can, leave them as they are. In fact, if you're only after switching the battle IDs, just use Meteor (http://wiki.qhimm.com/FF7/Technical/Customising) instead as it provides a GUI for encounter IDs (not probabilities, as yet). If you do mess something up, ID or probablities, you will probably just get a pyramid battle.
-
Thanks yet again synergy blade. You always explains things in a way that i can understand.
PS. I would use Meteor but its for the PC version.