Jump to content

2Missions in a script


Recommended Posts

Hi, I made 2 missions and i want them to start after eachother, i mean if you stand in the spheare that the first mission begins and that if you pass that mission that the second spheare comes and that you can start mission 2 if you stand in it.

can someone help me!!

 

<SORRY FOR THE BAD ENGLISH I AM DUTCH>

Link to comment
https://gtaforums.com/topic/265499-2missions-in-a-script/
Share on other sites

If you actually made missions, then this should be a piece of cake, what's the problem? There's a multitude of ways to do this. Did you actually attempt it?

You should already have a completed code thread that checks if the player is in the sphere, then if so, start_mission the first mission.

Again, from here there are a lot of ways to do it. Here's a good one I thought up.

 

1)a. You can have 2 threads which are exactly the same except the mission they start (:startmission1,:startmission2)- after the start_mission opcode, cleanup (delete sphere, etc) and then end_thread. In the end of the 1st mission itself, if the mission is passed - create_thread the :startmission2 label, if it isn't passed then just start the :startmission1 label again.

 

1)b. A good expansion of the previous approach. While we sadly don't have anything like functions like in programming languages, the create_thread opcode can convienently take [infinite!] parameters - and those are passed to the thread as local variables. So if you do create_thread Label $player_actor 5.0 100 for example, in the thread Label, @0 will be initialized to $player_actor, @1 will be intialized to the value of 5.0, and @2 will be initialized to 100.

As you [should of] already figured out, we can use this to our advantage and have only 1 actual code thread instead of 2 that are almost duplicates. Pass the mission ID to the :startmission1 label as a create_thread parameter, then use that variable (@0) in the start_mission opcode. Then pass the 2nd mission's ID from the mission if the mission is passed, etc.

 

Note, that you can really use 1 single thread for ALL your future missions, too!

...But- not all the missions will start at the same coordinates- Just pass the wanted coordinates in the create_thread opcode as well! smile.gif

Edited by Bigun
Link to comment
https://gtaforums.com/topic/265499-2missions-in-a-script/#findComment-4019685
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
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

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