IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Please post mod releases in the Mod Showroom

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 [SA] Max armour

 Yey :D
 
oksa8  
Posted: Thursday, Jun 14 2012, 09:08
Quote Post


Just call me Oksu
Group Icon
Group: Members
Joined: Sep 30, 2010

sf.gif

Member Award




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... tounge2.gif

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:

user posted image user posted image

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
Users WebsitePM
  Top
 

 
Ashwin the new boy  
Posted: Thursday, Jun 14 2012, 10:16
Quote Post


I am The Most Confused Person
Group Icon
Group: Members
Joined: Nov 14, 2010

ia.gif

XXXXX



QUOTE
EDIT #2: How I can check the amount of air player has while in water?

By reading the Memory Address icon14.gif
Users WebsitePM
  Top
 

 
oksa8  
Posted: Thursday, Jun 14 2012, 10:21
Quote Post


Just call me Oksu
Group Icon
Group: Members
Joined: Sep 30, 2010

sf.gif

Member Award




QUOTE (Ashwin the new boy @ Thursday, Jun 14 2012, 13:16)
QUOTE
EDIT #2: How I can check the amount of air player has while in water?

By reading the Memory Address icon14.gif

Yeah, just like max health. But what address?
Users WebsitePM
  Top
 

 
Ashwin the new boy  
Posted: Thursday, Jun 14 2012, 10:58
Quote Post


I am The Most Confused Person
Group Icon
Group: Members
Joined: Nov 14, 2010

ia.gif

XXXXX



Did you check it here ??
Sa Memory Address
& if it is not there
Go find it yourself, it won't take too much time
*it should be a Float value

Actually i have Uninstalled SA because i am running LOW in HD space,
otherwise i love to find Memory Address
Users WebsitePM
  Top
 

 
Wesser  
Posted: Thursday, Jun 14 2012, 14:42
Quote Post


The complexity simplifier, the efficiency optimizer
Group Icon
Group: Members
Joined: Aug 19, 2006

eu.gif

Member Award




Fast reply.

The math behind the aim you're willing to reach is very simple (parenthesis are unnecessary):
CODE
filling_area_size = (horizontal_or_vertical_size / max_value) * current_value

Obtaining the max lung capacity is a bit odd. Here is the trick.
PMMSNPlayStation Network
  Top
 

 
oksa8  
Posted: Thursday, Jun 14 2012, 18:44
Quote Post


Just call me Oksu
Group Icon
Group: Members
Joined: Sep 30, 2010

sf.gif

Member Award




@Wesser

Thanks! That'll help me a lot! smile.gif

And, just FYI, the calculation I use is pretty much the same you posted, and the problem was because max-armor and armor are both integer values instead of floats... biggrin.gif

This post has been edited by oksa8 on Thursday, Jun 14 2012, 18:47
Users WebsitePM
  Top
 

 
Wesser  
Posted: Friday, Jun 15 2012, 15:25
Quote Post


The complexity simplifier, the efficiency optimizer
Group Icon
Group: Members
Joined: Aug 19, 2006

eu.gif

Member Award




QUOTE (oksa8 @ Thursday, Jun 14 2012, 19:44)
The calculation I used is pretty much the same you posted.

It was a bit wrong, though. tounge.gif
PMMSNPlayStation Network
  Top
 

 
The Viper Team  
Posted: Sunday, Jun 17 2012, 00:00
Quote Post


Player Hater
Group Icon
Group: BUSTED!
Joined: Jun 16, 2012

XXXXX



@oksa8 great work on it biggrin.gif
PM
  Top
 

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG