Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Diamond Casino Heist
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA 6

      1. St Andrews Cathedral
    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    3. Gangs

    1. Announcements

    2. Support

    3. Suggestions

Sign in to follow this  
Light Syde Riandy

Critical Health Script

Recommended Posts

Light Syde Riandy

Okay, so I've been wanting to be able to realize this mod but I failed. This script is basically does the opposite of M U N D U's W.I.P script which means remove player's armor and makes his health into 1 HP.

 

 

{$CLEO .cs}
0226: [email protected] = actor $PLAYER_ACTOR health //Declare variable [email protected] and store the vlaue of OPCODE 0026 (Health)
04DD: [email protected] = actor $PLAYER_ACTOR armour //Declare variable [email protected] and store the vlaue of OPCODE 04DD (Armour)


wait 0
if
0AB0: key_pressed 188 //Make sure that "," is pressed
then
Jump @CRITICAL

:CRITICAL
[email protected] -= 50 //Add 100 to whatever is in variale [email protected]
0223: set_actor $PLAYER_ACTOR health_to [email protected] //set the player's health to what we have store in variable [email protected]
[email protected] -= 50 // Add 100 to whatever value is store in @2
035F: set_actor $PLAYER_ACTOR armour_to [email protected] //Set the player's armour level to whatever is store in [email protected]
end

 

 

I apologize for certain incorrect descriptions on the right side of some codes. And I don't know what is wrong with this script that makes my game immediately crash once I have loaded a saved game.

Edited by Light Syde Riandy

Share this post


Link to post
Share on other sites
kosticn101

Game crashes because you don't have 0A93: end_custom_thread at the end of your script.

 

 

Your script will execute once and then terminate. So it basically won't do anything.

To prevent that, you need to put your code in a infinite loop and then your code will be executed over and over again.

In a loop you should always check if player is defined (not wasted or busted) using 0256: player $PLAYER_CHAR defined.

Also, because you are using if..then, you don't need "Jump @CRITICAL :CRITICAL".

 

 

Player will probably lose all health immediately. Two options:

* change wait 0 to some greater value;

* use 0ADC: test_cheat "," instead of 0AB0: key_pressed 188 //key ",".

 

 

 

Working code

 

High level

 

 

{$CLEO .cs}0000: NOP //in order to prevent zero-offset bugwhile true  wait 0  if and    0256: player $PLAYER_CHAR defined    0AB0: key_pressed 188 //key ","  then    0226: [email protected] = actor $PLAYER_ACTOR health    04DD: [email protected] = actor $PLAYER_ACTOR armour    [email protected] -= 50    0223: set_actor $PLAYER_ACTOR health_to [email protected]    [email protected] -= 50    035F: set_actor $PLAYER_ACTOR armour_to [email protected]  endend0A93: end_custom_thread
Low level

 

{$CLEO .cs}0000: NOP //in order to prevent zero-offset bug:LOOPwait 0if and    0256: player $PLAYER_CHAR defined    0AB0: key_pressed 188 // key ","else_jump @LOOP0226: [email protected] = actor $PLAYER_ACTOR health04DD: [email protected] = actor $PLAYER_ACTOR [email protected] -= 500223: set_actor $PLAYER_ACTOR health_to [email protected]@ -= 50035F: set_actor $PLAYER_ACTOR armour_to [email protected] @LOOP0A93: end_custom_thread

 

 

"If"s and conditional opcodes

High Level Structures

Edited by kosticn101
  • Like 1

Share this post


Link to post
Share on other sites
skatefilter5

is that the increase health that's not limited to 200/253? can you go pass 253?

Share this post


Link to post
Share on other sites
deltaCJ

is that the increase health that's not limited to 200/253? can you go pass 253?

 

Yes, but it will not show on the HUD.

Share this post


Link to post
Share on other sites
Light Syde Riandy

Nvm.

Edited by Light Syde Riandy

Share this post


Link to post
Share on other sites
Light Syde Riandy

Thanks you, kosticn101! But the armor was not removed at all even if I separate the codes for both critical health and no armor into 2 different scripts and remove critical health from CLEO folder and replaced it with no armor afterward.

 

 

{$CLEO .cs}
0000: NOP //in order to prevent zero-offset bug

:LOOP
wait 0
if and
0256: player $PLAYER_CHAR defined
0AB0: key_pressed 188 // key ","
else_jump @LOOP
04DD: [email protected] = actor $PLAYER_ACTOR armour
[email protected] = 0
035F: set_actor $PLAYER_ACTOR armour_to [email protected]
jump @LOOP

0A93: end_custom_thread

 

 

BTW, I have completed the critical health one:

 

 

{$CLEO .cs}
0000: NOP //in order to prevent zero-offset bug

:LOOP
wait 0
if and
0256: player $PLAYER_CHAR defined
0AB0: key_pressed 191 // key "/"
else_jump @LOOP
0226: [email protected] = actor $PLAYER_ACTOR health
[email protected] = 1
0223: set_actor $PLAYER_ACTOR health_to [email protected]
jump @LOOP

0A93: end_custom_thread

 

Edited by Light Syde Riandy

Share this post


Link to post
Share on other sites
Springfield

@Light Syde Riandy - Actually, the opcode you're using for armour doesn't exactly adjust the armour. You edited the armour opcode text or i think the opcode text is not written correct in your sanny builder list.

035F: actor [email protected] armour += 100

This is the real opcode. This opcode just increase the armour (as you can see that "sum" sign before "equal").

Edited by Springfield
  • Like 1

Share this post


Link to post
Share on other sites
Light Syde Riandy

It afterward says, "in threads max variable is [email protected]", though.

Edited by Light Syde Riandy

Share this post


Link to post
Share on other sites
Springfield

Here take the working snippet:

{$CLEO .cs}0000: NOP0226: [email protected] = actor $PLAYER_ACTOR health04DD: [email protected] = actor $PLAYER_ACTOR armourWhile truewait 0if and   Player.Defined($PLAYER_CHAR)  0AB0:   key_pressed 188  then  [email protected] -= 100  [email protected] = 1  0223: set_actor $PLAYER_ACTOR health_to [email protected]  035F: actor $PLAYER_ACTOR armour += [email protected]  endend

Here is in High-Level Language

{$CLEO .cs}0000: NOP0226: [email protected] = actor $PLAYER_ACTOR health04DD: [email protected] = actor $PLAYER_ACTOR armour:Health_Armourwait 0if and   Player.Defined($PLAYER_CHAR)  0AB0:   key_pressed 188  jf @Health_Armour  [email protected] -= 100  [email protected] = 1  0223: set_actor $PLAYER_ACTOR health_to [email protected]  035F: actor $PLAYER_ACTOR armour += [email protected]_thread

Here is in Low-Level Language.

  • Like 1

Share this post


Link to post
Share on other sites
Light Syde Riandy

Still no luck, only health that was decreased.

Share this post


Link to post
Share on other sites
Springfield

You mean, the armour didn't worked? Tell me which CLEO version and which sanny builder version you're using?

Share this post


Link to post
Share on other sites
Light Syde Riandy

CLEO 4.1 and Sanny Builder 3.2.2.

Share this post


Link to post
Share on other sites
kosticn101

Yeah, Springfield is right.

 

You can correct your opcode description by going to your Sanny Builder installation folder, then to data\sa. Open opcodes.txt, press Ctrl F and search for 035F. Replace that line with line that Springfield gave to you and then save and exit.

 

EDIT: It looks like M U N D U has wrong opcode description :) If you have it too, you know how to correct it :D To search for opcodes open Sanny Builder, go to Tools > IDE Tools > Opcode Search.

 

When you are using that opcode you need to change [email protected] to something meaningul eg. $PLAYER_ACTOR.

 

 

04DD: [email protected] = actor $PLAYER_ACTOR armour

....

[email protected] -= 100

...

035F: actor $PLAYER_ACTOR armour += [email protected]

If player armour is eg. 100, [email protected] becomes 100, and then you do [email protected] -= 100 so [email protected] becomes 0. In the end you increase player's armor for 0 amount.

 

You just need to change [email protected] -= 100 to [email protected] *= -1 (opcode is 0012 if compiler asks for it). If player health is 100, [email protected] becomes -100 and then you increase armour for -100 (ie. you decrease it for 100).

Edited by kosticn101
  • Like 1

Share this post


Link to post
Share on other sites
Springfield

Kosticn101 description is correct but we can simply say that "sum and subtraction" is equal to "Subtraction" (as we learn these basics formula in maths). Now, that "sum" sign will be change into negative according to the formula.

 

No, there is no need to change text exactly. He got the wrong CLEO version. Uninstall CLEO 4.1 and try to install CLEO 4.3 which will give you some new opcodes and new opcodes description.

Edited by Springfield

Share this post


Link to post
Share on other sites
Light Syde Riandy

I've ever had a bad experience with CLEO 4.3 which crashes DYOM for no reason and to this day I still used U.S crack, BUT...

 

I'll try and see if CLEO 4.3 has become stable for use. If not, then screw no armor mod.

Edited by Light Syde Riandy

Share this post


Link to post
Share on other sites
kosticn101

@Light Syde Riandy

 

Have you tried modified version of code with Cleo 4.1?

 

 

{$CLEO .cs}0000: NOP0226: [email protected] = actor $PLAYER_ACTOR health04DD: [email protected] = actor $PLAYER_ACTOR armour:Health_Armourwait 0if and   Player.Defined($PLAYER_CHAR)  0AB0:   key_pressed 188  jf @Health_Armour  [email protected] *= -1  [email protected] = 1  0223: set_actor $PLAYER_ACTOR health_to [email protected]  035F: actor $PLAYER_ACTOR armour += [email protected]_thread
Edited by kosticn101
  • Like 2

Share this post


Link to post
Share on other sites
Light Syde Riandy

Works like charm! Thanks again, kosticn101! Now I can have mad fun with missions like "Black Project".

Edited by Light Syde Riandy

Share this post


Link to post
Share on other sites
kosticn101

Well it's Springfield's code, I just changed one line :)

Edited by kosticn101
  • Like 1

Share this post


Link to post
Share on other sites
Springfield

Good work man. You make the CLEO tricky by multiplying the current player health with -1. Good work.

Share this post


Link to post
Share on other sites
Light Syde Riandy

Although the script works for original game, I just can't seem to get it work for DYOM right after I have played a custom mission. I did PM Dutchy but she didn't answer.

 

Why this happens?

Share this post


Link to post
Share on other sites
deltaCJ

Because DYOM has different variables for the player in the scm file.

 

This could work with dyom but you're going have to change it to the player defined in the game file.

 

to find this go to the mpack folder and open up the scm. ( MAKE SURE TO BACK IT UP JUST TO BE SAFE)

Share this post


Link to post
Share on other sites
Light Syde Riandy

The scr one or what? Because I just can't seem open it.

Share this post


Link to post
Share on other sites
deltaCJ

the main.scm in the MPACK

Share this post


Link to post
Share on other sites
Light Syde Riandy

But I only found MPACK5 folder which has an .scm file named scr.

Share this post


Link to post
Share on other sites
deltaCJ

yes then

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.