Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

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

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

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

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

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    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. Design Your Own Mission
      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
    1. Announcements

    2. Forum Support

    3. Suggestions

Code executing after certain mission is passed


BigHomie
 Share

Recommended Posts

Hello everybody,

I'd like my code to only execute after Sweet's mission "Cleaning the Hood" is passed.

Any help is appreciated.

With best regards,

Big Homie

Link to comment
Share on other sites

Taken from the main.scm:

:SWEET1B_15979$Sweet_Total_Passed_Missions += 10318: set_latest_mission_passed 'SWEET1B'  // Cleaning the Hood01E3: show_text_1number_styled GXT 'M_PASSR' number 3 time 5000 style 1  // MISSION PASSED!~n~~w~RESPECT +0998: add_respect 3076C: set_zone 'GAN1' gang 1 density_to 40076C: set_zone 'GAN2' gang 1 density_to 40Player.ClearWantedLevel($PLAYER_CHAR)0394: play_music 1030C: progress_made = 1return

0318: set_latest_mission_passed 'SWEET1B'  // Cleaning the Hood

So we need conditional check for that opcode:

{$CLEO}0000:REPEAT    wait 250UNTIL 0256:   player $PLAYER_CHAR definedWHILE TRUE    wait 0       0A8D: [email protected] = read_memory 0x5D1B81 size 4 virtual_protect 0    //  pointer to a latest mission passed    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0    [email protected] += 4    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0    0AD3: [email protected] = format "%s" [email protected]    IF 05AE:   [email protected] == 'SWEET1B'  // Cleaning the Hood    THEN        // Cleaning the Hood mission completed       ENDEND
Link to comment
Share on other sites

Shi**, I'd thought it was as simple as to just check if the variable is greater than or equal to a certain value. Well, thanks anyway, gonna give it a try tomorrow.

Link to comment
Share on other sites

So if I wanted the code to execute always, also after passing more of Sweets's missions it would be more appropriate to make it >1? How would it look in a code that checks the variable to be greater than 1?

Link to comment
Share on other sites

There is no need to make an ASI, or advanced code for this...

 

Dutchy made a nice tutorial on her "Mission Scripting for Dummies" page

 

It's called a sniffer thread...

 

 

Lemme explain:

 

 

 

you make your mission

:MIS1_startmission content hereplease don't actually copy thisthis is just demonstration.:MIS1_ENDyou take the variable that will activate the mission$MISSION_TRIGGER += 1return(DONT f*ckING COPY THIS)

Okay, done

 

mission adds 1 to variable, good

 

now hopefully you have :INTL mission like in original SA where it sets a whole bunch of variables (usually mission 0 and mission 1)

 

Go to your main thread, and add on:

start_mission 0 //define the mission first:INTLwait 0$MISSION_TRIGGER = 0

now for the sniffer thread:

in the main make a thread called whatever (is going to be called sniffer in this case)

we will check if the variable meets the requirements and if the player is in the sphere we want him to be in

:SNIFFERwait 0ifplayer.defined($PLAYER_CHAR)jf @SNIFFERif$ONMISSION == 0jf @SNIFFERif//player in sphere opcode herejf @SNIFFERif$MISSION_TRIGGER == 0jf @SNIFFER_MISSION2$ONMISSION = 1start_mission (NUMBER HERE)jump @SNIFFER_MISSION2:SNIFFER_MISSION2if$MISSION_TRIGGER == 1jf @NEXT_SNIFFERTHREAD$ONMISSION = 1start_mission (NUMBER_HERE)jump @NEXT_SNIFFERTHREADEDIT: Forgot to put in $ONMISSION = 1 when the trigger equals somethingI think you can do that when you go into the mission but just to be sure...(This you can copy and replace all the labels and variables and sh*tmake sure to replace the variables with the ones you made in the INTL your game will crashif you don't.)

And that's it.

 

 

Also you only have to do the start_mission thing once if its only going to happen one time.

 

And if you want I can tell you how you can destroy the marker after your mission is done.

Edited by deltaCJ
Link to comment
Share on other sites

I didn't mean to write a new mission, I just want the crack den you take out to be available for purchase. So all I need is to check if the player has gotten past "Cleaning the Hood"

Link to comment
Share on other sites

So I thought this code would create an available asset pickup in front of the Crack Den after Cleaning the Hood.

{$CLEO .cs}03A4: name_thread "Script":L1if0256: player $PLAYER_CHAR defined004D: jump_if_false @L1:L2 if and $Sweet_Total_Passed_Missions>1$ONMISSION==00518: [email protected] = create_available_asset_pickup 'PROP_3' at 2169.5193 -1674.5095 15.0859 price $501620A93: end_custom_thread

Well, I was wrong, nothing happend after finishing the mission. What would I have to do to make the asset pickup to appear.

Link to comment
Share on other sites

It is better to make it in the main.scm

 

 

and you would do it just like the sniffer

 

(The Buying Properties thing is a mission too ya know,)

Link to comment
Share on other sites

So is there no way to make an asset in a Cleo Script? I remember it being featured in some Cleo mods that didn't touch main

Link to comment
Share on other sites

Ps: is it possible to bind an asset pickup's availabilty to a certain condition (e.g passing Cleaning the Hood?)

Link to comment
Share on other sites

 

 

{$CLEO .cs}0000:const    PlayerMoney = player.Money($PLAYER_CHAR)    den_pickup = [email protected] true    wait 1000    if        $SWEET_TOTAL_PASSED_MISSIONS > 1        then        0A95: enable_thread_saving        0518: den_pickup = create_available_asset_pickup 'PROP_3' at 2169.5193 -1674.5095 15.0859 price 50        break    endendwhile true    wait 500    if        0214:   pickup den_pickup picked_up        then        PlayerMoney += 50        break    endend0A93: end_custom_thread

 

 

funniest-dog-ever-lol.jpg

Link to comment
Share on other sites

Sorry for being an absolute noob, but could you elaborate the code a vit further?

Link to comment
Share on other sites

So I understand it for the most part, but what purpose does the part adding to the player's money serve?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

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