So, me again...
This time, I got a small problem with armor. Or mostly creating armor-bar.
So, here's the part of the script:
| CODE |
:NONAME_251 04DD: 3@ = actor $PLAYER_ACTOR armour 0945: get_player $PLAYER_CHAR max_armour_to 1@ 0017: 1@ /= 88.0 0073: 3@ /= 1@ // (float) 3@ = Player armor-box size 0945: get_player $PLAYER_CHAR max_armour_to 1@ 0017: 1@ /= 88.0 04DD: 2@ = actor $PLAYER_ACTOR armour 0073: 2@ /= 1@ // (float) 0017: 2@ /= 2.0 000B: 2@ += 536.0 038E: draw_box_position 580.0 390.0 size 94.0 14.0 RGBA 0 0 0 255 038E: draw_box_position 580.0 390.0 size 88.0 8.0 RGBA 95 95 95 255 038E: draw_box_position 2@ 390.0 size 3@ 8.0 RGBA 220 220 220 255 jump @NONAME_252 |
I use same method for health bar, I first get max hp and current hp, divide max hp by the length of bar (88.0), then divide current hp with the result. It works great for hp, the bar stays the same size all the time, but modifies itself to work when max hp is increased. But, using same method for armor doesn't seem to work. The armor-bar is too long when starting new game and too short when loading a game with "Vigilante"-mission completed, indicating that opcode 0945 might give wrong value.
So, any suggestions? If it matters, I read the max hp from memory, as there isn't opcodes for checking it.
Health-bar code:
| CODE |
:NONAME_250 0A96: 0@ = actor $PLAYER_ACTOR struct 0@ += 0x544 0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0 0017: 1@ /= 88.0 0226: 3@ = actor $PLAYER_ACTOR health 008F: 3@ = integer 3@ to_float 0073: 3@ /= 1@ // (float) 3@ = Player health-box size 0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0 0017: 1@ /= 88.0 0226: 2@ = actor $PLAYER_ACTOR health 008F: 2@ = integer 2@ to_float 0073: 2@ /= 1@ // (float) 0017: 2@ /= 2.0 000B: 2@ += 536.0 038E: draw_box_position 580.0 410.0 size 94.0 14.0 RGBA 0 0 0 255 038E: draw_box_position 580.0 410.0 size 88.0 8.0 RGBA 73 7 8 255 038E: draw_box_position 2@ 410.0 size 3@ 8.0 RGBA 168 16 19 255 jump @NONAME_251 |
There might be some un-needed stuff, like reading the memory twice while it's not even needed...

EDIT: Pics from the problem, first pic is from new game with HESOYAM-cheat, second one from loaded game with Vigilante completed and full armor with HESOYAM:

And by the way, if you wonder why I'm on a NRG-500, it's because the script is only enabled when on a vehicle. It doesn't affect the armor-problem at all, I guarantee it.
EDIT #2: How I can check the amount of air player has while in water?
This post has been edited by oksa8 on Thursday, Jun 14 2012, 09:20