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. Support

    3. Suggestions

Happy Holidays from the GTANet team!

Problem with the 'return' command in the 'mission passed' part of a Cleo mission (Cleo.cm)


DavidReyes2250
 Share

Recommended Posts

DavidReyes2250

Hello again, I have a problem with a Cleo mission.
It turns out that in the part where 'mission passed' is, from what I've seen, the 'return' command should be put at the end. The problem with this is that even if you put that command, the mission Cleo runs again, something like this:

:CUSTOM_MISSION_261
0394: play_music 2 
01E3: show_text_1number_styled GXT 'M_PASS' number 5000 time 5000 style 1  // MISSION PASSED!~n~~w~$~1~
Player.Money($PLAYER_CHAR) += 5000
07FB: set_interior 'CARLS' access 1  // The Johnson House
Actor.DestroyWithFade([email protected])
Model.Destroy(#MODEL)
065C: release_decision_maker [email protected] 
return

As I understand it, this command is put to end a Cleo mission, because so the missions of the main game script have this command at the end, for example:

:RIOT1_2997
$RIOT_TOTAL_PASSED_MISSIONS += 1 
0629: change_integer_stat 335 to 1 
0318: set_latest_mission_passed 'RIOT_1'  // Riot
01E3: show_text_1number_styled GXT 'M_PASSD' number 0 time 5000 style 1  // MISSION PASSED!
0394: play_music 1 
Player.ClearWantedLevel($PLAYER_CHAR)
Marker.Disable($622)
Marker.Disable($MARKER_SWEET_HOUSE)
Marker.CreateIconAndSphere($MARKER_SWEET_HOUSE, $ICON_SWEET, $X_SWEET_HOUSE, $Y_SWEET_HOUSE, $Z_SWEET_HOUSE)
030C: progress_made = 1 
return 

Am I missing something to put? Thanks

Link to comment
Share on other sites

Quote

As I understand it, this command is put to end a Cleo mission

 

that's not the reason, why you can find return inside the mission scripts

 

please post the whole script

 

 

Mission scripting in general means writing scripts to realize a feature.

It does not mean to write a mission script like these as you know from playing when CJ have to accomplish a mission
Such mission scripts are very complex and to difficult for Newbies.
It requires some background knowledge about method like R* did it

 

I recommand to learn first scripting by writing simple *.cs scripts
In that way can you also realize mission features.

 

The special "Mission"script have the advantage that it can handle much more content.
If you look in main.scm, you will see that these scripts are very huge.

At your state as beginner, you don't need such a capacity.

 

Nevertheless, i explain something to you

1. the mission scripts need to run in mission mode

    it rquires to enable the mission mode by $ONMISSION = 1

2. it needs first to allocate the mission mode pointer to the variable $ONMISSION

    therefore the main.scm must contain following code at the beginning (inside of main thread)

180: set_on_mission_flag_to $ONMISSION

 

 

3. R*'s mission scripts are based on subscripts (gosub/return)
    it requires how gosub works

 

 

 

 

 

gosub

The gosub command leads the reading process to an excluded subscript.
Excluded means the codes of the subscript are not inside the code order of our thread.

 

0050: gosub @MODLSUBROUTINE

 

The subscript must end with return

0051: return

 

and only a subscript  may end with return, otherwise game crashes

 

 

As soon as the subscript ends with 0051: return, then the regular thread continues with reading the codes after the 0050: gosub command

 

Example:

{$CLEO .cs}
:MODLSUB_1
03A4: name_thread 'MODLSUB'

:MODLSUB_2
0001: wait  0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @MODLSUB_2
00D6: if
00FF:   actor $PLAYER_ACTOR  1 (in-sphere)near_point_on_foot 2491.5  -1667.5  13.35 radius  1.0  1.0  1.0
004D: jump_if_false @MODLSUB_2
0050: gosub @MODLSUBROUTINE

:Loop_1
0001: wait  0 ms
00D6: if
8118:   NOT   actor 1@ dead
004D: jump_if_false @Cleanup_1
00D6: if
0104:   actor $PLAYER_ACTOR near_actor 1@ radius  80.0  80.0  10.0 sphere  0
004D: jump_if_false @Cleanup_1
0002: jump @Loop_1

:Cleanup_1
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
0002: jump @MODLSUB_2


:MODLSUBROUTINE
0005: 1@ = 2473.25
0005: 2@ = -1657.79
0005: 3@ = 13.4
0005: 4@ = 2501.12
0005: 5@ = -1676.5
0005: 6@ = 13.4
0208: 7@ = random_float_in_ranges 1@ 4@
0208: 8@ = random_float_in_ranges 2@ 5@
0208: 9@ = random_float_in_ranges 3@ 6@
0247: request_model #TRIBOSS
0247: request_model #AK47

:Load_MODLSUB_Check
0001: wait  0 ms
00D6: if  and
0248:   model #TRIBOSS available
0248:   model #AK47 available
004D: jump_if_false @Load_MODLSUB_Check

009A: 1@ = create_actor  24 #TRIBOSS at  7@ 8@ 9@
0173: set_actor 1@ z_angle_to  180.0
01B2: give_actor 1@ weapon  30 ammo  99999  // Load the weapon model before using this
02E2: set_actor 1@ weapon_accuracy_to  100
0223: set_actor 1@ health_to  1000
05E2: AS_actor 1@ kill_actor $PLAYER_ACTOR
0249: release_model #TRIBOSS
0051: return 

 

Script above spawns the actor Triboss with gun in Grovestreet at different random locations
The part with the coords generation and actor spawn is excluded in a subscript

 

 

R*'s Mission script skeletton by gosub scripting

 

{$CLEO .cm}
:TestMiss_1
03A4: name_thread "TESTM"  
0050: gosub @TestMiss_main_1
00D6: if  0
0112:   wasted_or_busted
004D: jump_if_false @TestMiss_end_1
0050: gosub @TestMiss_fail_1                    

:TestMiss_end_1
0050: gosub @TestMiss_clep_1
004E: end_thread

:TestMiss_main_1
0317: increment_mission_attempts//here starts the missionscript
0004: $ONMISSION =  1
054C: use_GXT_table 'MENU2P'
00BC: text_highpriority 'MENU_18'  5000 ms  1

:TestMiss_11
0001: wait 0 ms
if and
02D8:   actor $PLAYER_ACTOR currentweapon == 0
00E1:   key_pressed 0 17
004D: jump_if_false @TestMiss_11

:TestMiss_pass_1
00BA: text_styled 'M_PASS'  5000 ms  1
0051: return

:TestMiss_fail_1
00BA: text_styled 'M_FAIL'  5000 ms  1
0051: return

:TestMiss_clep_1
0004: $ONMISSION =  0
00D8: mission_cleanup
0051: return

 

 

The regular script contains 3 sub routines

 

:TestMiss_1
03A4: name_thread "TESTM"  
0050: gosub @TestMiss_main_1
00D6: if
0112:   wasted_or_busted
004D: jump_if_false @TestMiss_end_1
0050: gosub @TestMiss_fail_1                    

:TestMiss_end_1
0050: gosub @TestMiss_clep_1
004E: end_thread

 

 

gosub @TestMiss_main_1 leads to the main mission script

It should end with return as soon as the player has passed all conditons to can accomplish the mission

 

In case that player dies or get arrested, then the code of gtasa.exe cancel the main sub script as like a return would be executed

That's the special effect of the mission mode

 

So as next the check "if wasted_or_busted" selects the next sub routine

In case that player died or got arrested, then it goes to the fail sub script block (0050: gosub @TestMiss_fail)

 

As last it goes to the cleanup script block

0050: gosub @TestMiss_clep_1

 

and then 004E: end_thread, this terminates the mission script

 

 

 

 

 

Edited by ZAZ
  • Like 1
Link to comment
Share on other sites

DavidReyes2250
CLEO ACTIVATION
{$CLEO .cs}

script_name 'CUSTOM_MISSION' 

:CUSTOM_MISSION_19
wait 0 
if 
   Player.Defined($PLAYER_CHAR)
jf @CUSTOM_MISSION_19 
if 
  $ONMISSION == 0 
jf @CUSTOM_MISSION_19 
if and
00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2496.05 -1692.9301 1014.7422 radius 1.0 1.0 1.0 
   Actor.HasWeapon($PLAYER_ACTOR, 43)
jf @CUSTOM_MISSION_19 
$ONMISSION = 1 
load_and_launch_custom_mission "MISSION" 
jump @CUSTOM_MISSION_19 
{$CLEO .cm}

script_name 'MISSION' 
MISSION_55()
if 
wasted_or_busted 
jf @MISSION_46 
MISSION_322()

:MISSION_46
MISSION_342()
terminate_this_script 

:MISSION_55
increment_mission_attempts  
$ONMISSION = 1
Model.Load(#MODEL)
038B: load_requested_models 
060A: create_decision_maker_type 0 store_to [email protected] // decision\allowed\m_.ped files 
07FB: set_interior 'CARLS' access 0  // The Johnson House
jump @MISSION_93 

:MISSION_93
wait 0 
if 
00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2492.708 -1701.981 1014.753 radius 1.0 1.0 1.0 
jf @MISSION_93 
Actor.Create([email protected], 5, #MODEL, 2491.421, -1694.894, 1013.925)
Actor.Angle([email protected]) = 216.0104
Actor.SetImmunities([email protected], True, True, True, True, True)
Actor.Health([email protected]) = 1000000
Actor.LockInCurrentPosition([email protected], True)
060B: set_actor [email protected] decision_maker_to [email protected] 
0A09: set_actor [email protected] muted 1 // versionB 
0860: link_actor [email protected] to_interior 3 

:MISSION_234
wait 0 
if 
04C5:   actor [email protected] photographed 
jf @MISSION_234 
jump @MISSION_261 

:MISSION_261
0394: play_music 2 
01E3: show_text_1number_styled GXT 'M_PASS' number 5000 time 5000 style 1  // MISSION PASSED!~n~~w~$~1~
Player.Money($PLAYER_CHAR) += 5000
07FB: set_interior 'CARLS' access 1  // The Johnson House
Actor.DestroyWithFade([email protected])
Model.Destroy(#MODEL)
065C: release_decision_maker [email protected] 
return

:MISSION_322
00BA: show_text_styled GXT 'M_FAIL' time 5000 style 1  // ~r~MISSION FAILED!
return 

:MISSION_342
07FB: set_interior 'CARLS' access 1  // The Johnson House
Actor.DestroyInstantly([email protected])
Model.Destroy(#MODEL)
065C: release_decision_maker [email protected] 
$ONMISSION = 0 
mission_cleanup 
return

 

Edited by DavidReyes2250
Link to comment
Share on other sites

13 hours ago, DavidReyes2250 said:

Model.Load(#MODEL)
038B: load_requested_models 

Actor.Create([email protected], 5, #MODEL, 2491.421, -1694.894, 1013.925)
Actor.Angle([email protected]) = 216.0104
Actor.SetImmunities([email protected], True, True, True, True, True)
Actor.Health([email protected]) = 1000000
Actor.LockInCurrentPosition([email protected], True)
060B: set_actor [email protected] decision_maker_to [email protected] 
0A09: set_actor [email protected] muted 1 // versionB 
0860: link_actor [email protected] to_interior 3 

 

 

 

 

 

It needs to load a model instead #MODEL
Example:

Model.Load(#BFYBE)
Actor.Create(1@, 5, #BFYBE, 2491.3374, -1698.4397, 1014.74)
Model.Destroy(#BFYBE)

(unless you did install a ped with filename MODEL.dff)

 

But basically the script works fine

label() is the new expresion for 0050: gosub @label

 

When I photographed the actor, he disappeared, the mission was terminated
and the mission could be started again

The script construct is correct

 

some tiny improvements:
I modified the coords check to find the actor better
Especially the sphere parameter
00FE:   actor $PLAYER_ACTOR sphere 1 <--
then it shows the red spot

 

These cleanup codes usually have to be placed only in the cleanup block

 

Actor.DestroyInstantly([email protected])
Model.Destroy(#BFYBE)

065C: release_decision_maker [email protected]

 

it will be read at the end in any way
that's the reason to have a cleanup section

 

 

Test the overhauled script inside the spoiler

Spoiler
{$CLEO .cs}

script_name 'CUSTOM_MISSION' 

:CUSTOM_MISSION_19
wait 0 
if 
   Player.Defined($PLAYER_CHAR)
jf @CUSTOM_MISSION_19 
if 
  $ONMISSION == 0 
jf @CUSTOM_MISSION_19 
if and
00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 2496.05 -1692.9301 1014.7422 radius 3.0 3.0 1.0 
   Actor.HasWeapon($PLAYER_ACTOR, 43)
jf @CUSTOM_MISSION_19 
$ONMISSION = 1 
load_and_launch_custom_mission "MISSION" 
jump @CUSTOM_MISSION_19

 

{$CLEO .cm}

script_name 'MISSION' 
MISSION_55()
if 
wasted_or_busted 
jf @MISSION_46 
MISSION_322()

:MISSION_46
MISSION_342()
terminate_this_script 

:MISSION_55
increment_mission_attempts  
$ONMISSION = 1
Model.Load(#BFYBE)
038B: load_requested_models 
060A: create_decision_maker_type 0 store_to 0@ // decision\allowed\m_.ped files 
07FB: set_interior 'CARLS' access 0  // The Johnson House

:MISSION_93
wait 0 
if 
00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 2492.96 -1695.4 1014.75 radius 1.0 1.0 1.0 
jf @MISSION_93 
Actor.Create(1@, 5, #BFYBE, 2491.3374, -1698.4397, 1014.74)
Actor.Angle(1@) = 216.0104
Actor.SetImmunities(1@, True, True, True, True, True)
Actor.Health(1@) = 1000000
Actor.LockInCurrentPosition(1@, True)
060B: set_actor 1@ decision_maker_to 0@ 
0A09: set_actor 1@ muted 1 // versionB 
0860: link_actor 1@ to_interior 3 

:MISSION_234
wait 0 
if 
04C5:   actor 1@ photographed 
jf @MISSION_234 
0394: play_music 2 
01E3: show_text_1number_styled GXT 'M_PASS' number 5000 time 5000 style 1  // MISSION PASSED!~n~~w~$~1~
Player.Money($PLAYER_CHAR) += 5000
07FB: set_interior 'CARLS' access 1  // The Johnson House
return

:MISSION_322
00BA: show_text_styled GXT 'M_FAIL' time 5000 style 1  // ~r~MISSION FAILED!
return 

:MISSION_342
07FB: set_interior 'CARLS' access 1  // The Johnson House
Actor.DestroyInstantly(1@)
Model.Destroy(#BFYBE)
065C: release_decision_maker 0@ 
$ONMISSION = 0 
mission_cleanup 
return

 

 

 

 

 

 

If you still have the problem with this is that even if you put that command, the mission Cleo runs again

Then it must be, because of this missing code inside of main.scm

 

180: set_on_mission_flag_to $ONMISSION

 

What main.scm do you have running?

 

 

Edited by ZAZ
  • Like 1
Link to comment
Share on other sites

DavidReyes2250
16 hours ago, ZAZ said:

 

 

 

 

It needs to load a model instead #MODEL
Example:

Model.Load(#BFYBE)
Actor.Create(1@, 5, #BFYBE, 2491.3374, -1698.4397, 1014.74)
Model.Destroy(#BFYBE)

(unless you did install a ped with filename MODEL.dff)

 

But basically the script works fine

label() is the new expresion for 0050: gosub @label

 

When I photographed the actor, he disappeared, the mission was terminated
and the mission could be started again

The script construct is correct

 

some tiny improvements:
I modified the coords check to find the actor better
Especially the sphere parameter
00FE:   actor $PLAYER_ACTOR sphere 1 <--
then it shows the red spot

 

These cleanup codes usually have to be placed only in the cleanup block

 

Actor.DestroyInstantly([email protected])
Model.Destroy(#BFYBE)

065C: release_decision_maker [email protected]

 

it will be read at the end in any way
that's the reason to have a cleanup section

 

 

Test the overhauled script inside the spoiler

  Hide contents

{$CLEO .cs}

script_name 'CUSTOM_MISSION' 

:CUSTOM_MISSION_19
wait 0 
if 
   Player.Defined($PLAYER_CHAR)
jf @CUSTOM_MISSION_19 
if 
  $ONMISSION == 0 
jf @CUSTOM_MISSION_19 
if and
00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 2496.05 -1692.9301 1014.7422 radius 3.0 3.0 1.0 
   Actor.HasWeapon($PLAYER_ACTOR, 43)
jf @CUSTOM_MISSION_19 
$ONMISSION = 1 
load_and_launch_custom_mission "MISSION" 
jump @CUSTOM_MISSION_19

 


{$CLEO .cm}

script_name 'MISSION' 
MISSION_55()
if 
wasted_or_busted 
jf @MISSION_46 
MISSION_322()

:MISSION_46
MISSION_342()
terminate_this_script 

:MISSION_55
increment_mission_attempts  
$ONMISSION = 1
Model.Load(#BFYBE)
038B: load_requested_models 
060A: create_decision_maker_type 0 store_to 0@ // decision\allowed\m_.ped files 
07FB: set_interior 'CARLS' access 0  // The Johnson House

:MISSION_93
wait 0 
if 
00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 2492.96 -1695.4 1014.75 radius 1.0 1.0 1.0 
jf @MISSION_93 
Actor.Create(1@, 5, #BFYBE, 2491.3374, -1698.4397, 1014.74)
Actor.Angle(1@) = 216.0104
Actor.SetImmunities(1@, True, True, True, True, True)
Actor.Health(1@) = 1000000
Actor.LockInCurrentPosition(1@, True)
060B: set_actor 1@ decision_maker_to 0@ 
0A09: set_actor 1@ muted 1 // versionB 
0860: link_actor 1@ to_interior 3 

:MISSION_234
wait 0 
if 
04C5:   actor 1@ photographed 
jf @MISSION_234 
0394: play_music 2 
01E3: show_text_1number_styled GXT 'M_PASS' number 5000 time 5000 style 1  // MISSION PASSED!~n~~w~$~1~
Player.Money($PLAYER_CHAR) += 5000
07FB: set_interior 'CARLS' access 1  // The Johnson House
return

:MISSION_322
00BA: show_text_styled GXT 'M_FAIL' time 5000 style 1  // ~r~MISSION FAILED!
return 

:MISSION_342
07FB: set_interior 'CARLS' access 1  // The Johnson House
Actor.DestroyInstantly(1@)
Model.Destroy(#BFYBE)
065C: release_decision_maker 0@ 
$ONMISSION = 0 
mission_cleanup 
return

 

 

 

 

 

 

If you still have the problem with this is that even if you put that command, the mission Cleo runs again

Then it must be, because of this missing code inside of main.scm

 

180: set_on_mission_flag_to $ONMISSION

 

What main.scm do you have running?

 

 

I have the original main.scm, from 04/21/2005. But speaking of that, I have placed my custom mission in the main.scm correctly and it works fine, but my problem remains in which my mission can be done again, and besides, also the $ ONMISSION variable is still present , because I tried, for example, to play arcade machines (after having done my mission) and I get the message "You look a bit bussy, why don't you come back later", meaning that the variable $ ONMISSION is still activated so to speak: /

Link to comment
Share on other sites

51 minutes ago, DavidReyes2250 said:

"You look a bit bussy, why don't you come back later"

I'm from Europe, you from Mexico, 8 hours difference, it's 1:30h am

 

 

51 minutes ago, DavidReyes2250 said:

but my problem remains in which my mission can be done again,

 

yes, it can be done again

 

your first usage was "the mission Cleo runs again"

I understand it in that way that the mission script repeats without entering the spot of mission starter script

 

I go sleep now 😴, have fun

 

 

Edited by ZAZ
  • KEKW 1
Link to comment
Share on other sites

DavidReyes2250

ok, hopefully you can solve my problem because I couldn't find any solution on the internet, good night

41 minutes ago, ZAZ said:

I'm from Europe, you from Mexico, 8 hours difference, it's 1:30h am

 

 

 

yes, it can be done again

 

your first usage was "the mission Cleo runs again"

I understand it in that way that the mission script repeats without entering the spot of mission starter script

 

I go sleep now 😴, have fun

 

 

Ok, hopefully you can solve my problem because I couldn't find any solution on the internet, good night 😀

Link to comment
Share on other sites

Good morning

You want to terminate the starter thread by mission complete
 In main.scm is it very simple, there're conditional checks for Global Variables
 You know these $SWEET_TOTAL_PASSED_MISSIONS, $RYDER_TOTAL_PASSED_MISSIONS, $MISSION_LOWRIDER_PASSED, ect.

Spoiler
:SWEET_11
0001: wait $DEFAULT_WAIT_TIME ms 
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 9 
004D: jump_if_false @SWEET_36 
004E: end_thread 

:SWEET_36
00D6: if 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false @SWEET_807 
00D6: if 
0038:   $ONMISSION == 0 
004D: jump_if_false @SWEET_807 
00D6: if 
00FF:   actor $PLAYER_ACTOR sphere 0 in_sphere $X_SWEET_HOUSE $Y_SWEET_HOUSE $Z_SWEET_HOUSE radius 1.2 1.2 2.0 on_foot 
004D: jump_if_false @SWEET_684 
00D6: if 
03EE:   player $PLAYER_CHAR controllable 
004D: jump_if_false @SWEET_684 
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 0 
004D: jump_if_false @SWEET_180 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'SWEET_1' time 1000 style 2  // Tagging up Turf
0050: gosub @PSAVE1_1320 
0417: start_mission 13  // Tagging Up Turf

:SWEET_180
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 1 
004D: jump_if_false @SWEET_232 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'SWEET1B' time 1000 style 2  // Cleaning the Hood
0050: gosub @PSAVE1_1320 
0417: start_mission 14  // Cleaning The Hood

:SWEET_232 
... 
.. 
.

 

 

 and $SWEET_TOTAL_PASSED_MISSIONS += 1
 inside the mission complete section of the mission script

:CRASH4_6337
0008: $SWEET_TOTAL_PASSED_MISSIONS += 1 
0318: set_latest_mission_passed 'CRASH_2'  // Doberman
030C: progress_made += 1 
01E3: show_text_1number_styled GXT 'M_PASSR' number 40 time 5000 style 1  // MISSION PASSED!~n~~w~RESPECT +
0998: add_respect 40 
0110: clear_player $PLAYER_CHAR wanted_level 
0394: play_music 1 
... 
.. 
.

 

In cleo we should not use these globals, because they can cause bugs and crashes

In Cleo we have global CLEO variable
 
0AB3: var 0 = 10
0AB3: var 0 = [email protected]
0AB4: [email protected] = var 0
 
var 0 will be saved immediately in memory and as well in cleo_save as soon as you make save game
 
var 0 up to var 999 can be used
 
 
Adding a check inside the starter thread

{$CLEO .cs}

script_name 'CUSTOM_MISSION' 
0AB3: var 621 = 0
0A95: enable_thread_saving

:CUSTOM_MISSION_19
wait 0 
if 
   Player.Defined($PLAYER_CHAR)
jf @CUSTOM_MISSION_19
0AB4: 2@ = var 621
if 
    2@ == 0 
jf @CUSTOM_MISSION_21  
if 
  $ONMISSION == 0 
jf @CUSTOM_MISSION_19 
if and
00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 2496.05 -1692.9301 1014.7422 radius 3.0 3.0 1.0 
   Actor.HasWeapon($PLAYER_ACTOR, 43)
jf @CUSTOM_MISSION_19 
$ONMISSION = 1 
load_and_launch_custom_mission "missionmission" 
jump @CUSTOM_MISSION_19

:CUSTOM_MISSION_21
0A93: end_custom_thread

 

 

Change value of global CLEO variable inside the mission complete section of the mission script

:MISSION_234
wait 0 
if 
04C5:   actor 1@ photographed 
jf @MISSION_234 
0394: play_music 2 
01E3: show_text_1number_styled GXT 'M_PASS' number 5000 time 5000 style 1  // MISSION PASSED!~n~~w~$~1~
Player.Money($PLAYER_CHAR) += 5000
07FB: set_interior 'CARLS' access 1  // The Johnson House
0AB3: var 621 = 1
return

 

 

 

 

Another way: terminate the starter thread by 0ABA: end_custom_thread_named 'myscrip'
 
This requires to use an accurate thread name
That means in the first place: max. 7 charackter are allowed for thread name
script_name 'CUSTOM_MISSION' <-- don't work
script_name 'CUSTMIS' <-- accurate thread name

Furthermore think about a good name, because users can have thousands of scripts with any thread name
Such a script_name 'MQSTYX'  have better chances to be unique

:MISSION_234
wait 0 
if 
04C5:   actor 1@ photographed 
jf @MISSION_234 
0394: play_music 2 
01E3: show_text_1number_styled GXT 'M_PASS' number 5000 time 5000 style 1  // MISSION PASSED!~n~~w~$~1~
Player.Money($PLAYER_CHAR) += 5000
07FB: set_interior 'CARLS' access 1  // The Johnson House
0ABA: end_custom_thread_named 'MQSTYX'
return

 

  • Like 1
Link to comment
Share on other sites

DavidReyes2250
11 hours ago, ZAZ said:

Good morning

You want to terminate the starter thread by mission complete
 In main.scm is it very simple, there're conditional checks for Global Variables
 You know these $SWEET_TOTAL_PASSED_MISSIONS, $RYDER_TOTAL_PASSED_MISSIONS, $MISSION_LOWRIDER_PASSED, ect.

  Reveal hidden contents

:SWEET_11
0001: wait $DEFAULT_WAIT_TIME ms 
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 9 
004D: jump_if_false @SWEET_36 
004E: end_thread 

:SWEET_36
00D6: if 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false @SWEET_807 
00D6: if 
0038:   $ONMISSION == 0 
004D: jump_if_false @SWEET_807 
00D6: if 
00FF:   actor $PLAYER_ACTOR sphere 0 in_sphere $X_SWEET_HOUSE $Y_SWEET_HOUSE $Z_SWEET_HOUSE radius 1.2 1.2 2.0 on_foot 
004D: jump_if_false @SWEET_684 
00D6: if 
03EE:   player $PLAYER_CHAR controllable 
004D: jump_if_false @SWEET_684 
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 0 
004D: jump_if_false @SWEET_180 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'SWEET_1' time 1000 style 2  // Tagging up Turf
0050: gosub @PSAVE1_1320 
0417: start_mission 13  // Tagging Up Turf

:SWEET_180
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 1 
004D: jump_if_false @SWEET_232 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'SWEET1B' time 1000 style 2  // Cleaning the Hood
0050: gosub @PSAVE1_1320 
0417: start_mission 14  // Cleaning The Hood

:SWEET_232 
... 
.. 
.

 

 

 and $SWEET_TOTAL_PASSED_MISSIONS += 1
 inside the mission complete section of the mission script

:CRASH4_6337
0008: $SWEET_TOTAL_PASSED_MISSIONS += 1 
0318: set_latest_mission_passed 'CRASH_2'  // Doberman
030C: progress_made += 1 
01E3: show_text_1number_styled GXT 'M_PASSR' number 40 time 5000 style 1  // MISSION PASSED!~n~~w~RESPECT +
0998: add_respect 40 
0110: clear_player $PLAYER_CHAR wanted_level 
0394: play_music 1 
... 
.. 
.

 

In cleo we should not use these globals, because they can cause bugs and crashes

In Cleo we have global CLEO variable
 
0AB3: var 0 = 10
0AB3: var 0 = [email protected]
0AB4: [email protected] = var 0
 
var 0 will be saved immediately in memory and as well in cleo_save as soon as you make save game
 
var 0 up to var 999 can be used
 
 
Adding a check inside the starter thread

{$CLEO .cs}

script_name 'CUSTOM_MISSION' 
0AB3: var 621 = 0
0A95: enable_thread_saving

:CUSTOM_MISSION_19
wait 0 
if 
   Player.Defined($PLAYER_CHAR)
jf @CUSTOM_MISSION_19
0AB4: 2@ = var 621
if 
    2@ == 0 
jf @CUSTOM_MISSION_21  
if 
  $ONMISSION == 0 
jf @CUSTOM_MISSION_19 
if and
00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 2496.05 -1692.9301 1014.7422 radius 3.0 3.0 1.0 
   Actor.HasWeapon($PLAYER_ACTOR, 43)
jf @CUSTOM_MISSION_19 
$ONMISSION = 1 
load_and_launch_custom_mission "missionmission" 
jump @CUSTOM_MISSION_19

:CUSTOM_MISSION_21
0A93: end_custom_thread

 

 

Change value of global CLEO variable inside the mission complete section of the mission script

:MISSION_234
wait 0 
if 
04C5:   actor 1@ photographed 
jf @MISSION_234 
0394: play_music 2 
01E3: show_text_1number_styled GXT 'M_PASS' number 5000 time 5000 style 1  // MISSION PASSED!~n~~w~$~1~
Player.Money($PLAYER_CHAR) += 5000
07FB: set_interior 'CARLS' access 1  // The Johnson House
0AB3: var 621 = 1
return

 

 

 

 

Another way: terminate the starter thread by 0ABA: end_custom_thread_named 'myscrip'
 
This requires to use an accurate thread name
That means in the first place: max. 7 charackter are allowed for thread name
script_name 'CUSTOM_MISSION' <-- don't work
script_name 'CUSTMIS' <-- accurate thread name

Furthermore think about a good name, because users can have thousands of scripts with any thread name
Such a script_name 'MQSTYX'  have better chances to be unique

:MISSION_234
wait 0 
if 
04C5:   actor 1@ photographed 
jf @MISSION_234 
0394: play_music 2 
01E3: show_text_1number_styled GXT 'M_PASS' number 5000 time 5000 style 1  // MISSION PASSED!~n~~w~$~1~
Player.Money($PLAYER_CHAR) += 5000
07FB: set_interior 'CARLS' access 1  // The Johnson House
0ABA: end_custom_thread_named 'MQSTYX'
return

 

Thanks, I was able to solve my problem, although it was in a slightly different way, but your solution can still serve me :)

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.