Bytecodes to fix random potential values in Elona Shooter
I'm having some trouble fixing some values which are random in the game Elona Shooter (SWF Link & Game Link).
I found the relevent code in sothink, in generatePlayer() (swf/Action/shootem_fla/MainTimeline)
player.potentialAim[param1] = Math.random() / 1.25 + 0.1;Which I'd like to change to
player.potentialTeam[param1] = Math.random() / 1.25 + 0.1;
player.potentialAim[param1] = 0.8;I'm really not sure if I'm doing this right, but here's what I tried:
player.potentialTeam[param1] = 0.8;
Replace the bytecode for 'player.potentialAim[param1] = Math.random() / 1.25 + 0.1;'
60 d2 26 66 9f 29 d1 60 95 27 46 a1 27 00 2f 21 a3 2f 20 a0 61 d5 26
//60 d2 26 with one to set it to 0.8 instead of performing the random calculation
_as3_getlex player
//66 9f 29
_as3_getproperty potentialAim
//d1
_as3_getlocal <1>
//60 95 27
_as3_getlex Math
//46 a1 27 00
_as3_callproperty random(param count:0)
//2f 21
_as3_pushdouble 1.25
//a3
_as3_divide
//2f 20
_as3_pushdouble 0.1
//a0
_as3_add
//61 d5 26
_as3_setproperty {}
60 d2 26 66 9f 29 d1 2f 24 61 d5 26 02 02 02 02 02 02 02 02 02 02 02
//60 d2 26 and also do the same with the potentialTeam one.
_as3_getlex player
//66 9f 29
_as3_getproperty potentialAim
//d1
_as3_getlocal <1>
//2f 24
_as3_pushdouble 0.8
//61 d5 26
_as3_setproperty {}
// 02 02... to make up the extra bytes
60 d2 26 66 a0 29 d1 60 95 27 46 a1 27 00 2f 21 a3 2f 20 a0 61 d5 26To test, start a new game, finish the first battle, fix the AP value to something big (it's 4 bytes, value*8+6), then refresh the recruit in the barracks & see if the wage varies like it did before the hack.
->
60 d2 26 66 a0 29 d1 2f 24 61 d5 26 02 02 02 02 02 02 02 02 02 02 02
These potentialxxxx values aren't displayed anywhere that I know of, so I'm not sure, but I don't think this worked as I'd intended because the wages for new characters still vary a lot, and I expected that if the potential stats were fixed then the wage would be too since it's derived from the potentialxxxx values. (code in spoiler below)
public function wage(param1:int)
{
var _loc_2:* = undefined;
_loc_2 = player.lv[param1] * 6 + 50 - true_if(player.pic[param1] == 50) * 50;
if (_loc_2 < 0)
{
_loc_2 = 0;
}
_loc_2 = _loc_2 * (75 + player.potentialAim[param1] * player.potentialTeam[param1] * 100) / 100;
_loc_2 = _loc_2 * 100 / (100 + PARTY.ACCOUNTANT + IF(medal[_medalRagnarok]) * 3);
if (param1 == _pc)
{
_loc_2 = 0;
}
return int(_loc_2);
}// end function
This is my first attempt at bytecode hacking and I really don't know what I'm doing, so I was hoping someone who does could take a quick look at this and let me know if there's something obvious that I've done wrong, or why this doesn't seem to work.
PS I looked at the sticky tutorials and faqs on this site and also at the bytecode hacking tutorial vids which helped a lot. There is a problem with decompiling this swf with flasm though so that method isn't going to work I don't think. The output doesn't contain any source code, which is probably due to 'unknown tag' showing up I guess. Also, when I try to export to fla with sothink it crashes.
I also searched the the site for potentialAim etc and didn't find anything. There's another thread with some hacks for Elona Shooter, but it didn't include anything about changing the potentialxxx stats.
Windows XP
firefox 3.6.13
Flash plugin 10.1.102.64
sothink 5.2 build 521
Flasm 1.62