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. Los Santos Summer Special
      2. The Diamond Casino Heist
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. 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. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA VI

      1. St. Andrews Cathedral
    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. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

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

      1. Guides & Strategies
      2. 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. 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
    3. Gangs

    1. Announcements

    2. Support

    3. Suggestions

Sign in to follow this  
dertyjerzian

okie dokie...

Recommended Posts

dertyjerzian

Ok, I've been pointed to the coding bible etc etc tutorial out the yin yo and so on and so on...

 

I figure just jump in and post whenever I'm stuck, what will be the game plan from now on. Gain a coder or shut one off, my brethren decide tounge.gif lol

 

 

:MAIN_4610001: wait 0 ms 0002: jump @MAIN_461 :MAIN_4720001: wait 2500 ms 0002: jump @MAIN_472 

 

 

Above, you can see Steve-M's final loop in his stripped script which I have stretched into two threads.

 

I don't know what to do next. At all. I have taken ownership of the thread main_461, what can I now do with it? The diea is basically to lay in a mission-start marker, spawn some NPCs some place near it, and have to kill them. Simple as that. But not simple for me!

 

I have been here 3 years or so and every time I'm active I try to learn coding. Nothing helps that is available for reference, I am going to need a couple of friends for this task wink.gif Thanks in advance.

 

 

Share this post


Link to post
Share on other sites
PLPynton

for your service sir.

i have some spear time this week and waste it for screw around forum helping people (i think so). i can help you with my experiences. what kind of learning procedure do you prefer? where are the weak spots so we can master them?

 

Edit: sometimes (i noticed myself too) i have some diferend approach to coding, mind that please.

Edited by PLPynton

Share this post


Link to post
Share on other sites
dertyjerzian

That is most excellent, PL. Awesome indeed.

 

It's only the lack of hands on true step-sy-step (hand-holding tounge.gif) tutorials that I think sways would-be coding contributors (such like myself) from going further than reading some stuff and getting lost tounge.gif

 

The ionformation is there, and I'm sure most people who care to read and understand it can, but some of us just need that extra hands-on.

 

Like, I read about UVW Unwrapping in max for weeks until someone finally showed me a tutorial that started from scratch and ended with a txtured house, I was on my way from there biggrin.gif

 

SCM is, though well documented, not very well tought to people who are brand new to coding workflows confused.gif

Share this post


Link to post
Share on other sites
PLPynton

ok, then you can PM me with ANY kind of issue concerning scripted coding and i will be answering you with my best knowledge.

Share this post


Link to post
Share on other sites
dertyjerzian

Would certainly PM with you, addyou to any messanger, invite you to the Myriad room wink.gif

 

Would help everyone if you helped in this topic though, PL wink.gif I know a few who would benefit, seriously. Only the community can prosper with that, and thats not bad at all wink.gif

 

Basically, I want to script first a marker that starts mission and a pick up that ends it. I think that should be simple enough for a beginner, and simple aenough to teach, right?

 

Then after comes the fun, the reason for the pick up.., the person to kill carrying it... biggrin.gif

Share this post


Link to post
Share on other sites
PLPynton

before i post any code i need to know what compiler are you using? on what level of details shall i describe - general algorith or pure code? it is clear that you will learn better reading just something like that instead of ready code:

 

task- mission with its marker that appears when some conditions are meet. mission to kill an actor, it creates a pickup, that ends the mission when picked up.

 

THREAD:

if

"show mission marker" conditions are meet [previous missions passed, player is not playing another mission...]

then

show marker

if

player "attempts to start mission" conditions are meet [right position, right time, enough resources...]

then

start mission

go back to beginning of thread or check for alternative mission

 

MISSION:

it has been written a lot about how to create missions but the major schema (copy of rockstars schema) is not the only solution and not actualy the best possible. but we stick to it for now

 

 

:MISSION_10050: gosub £MISSION_LOOP00D6: if  0 0112:   wasted_or_busted004D: jump_if_false £MISSION_20050: gosub £MISSION_FAILED:MISSION_20050: gosub £CLEAR_ALL_STUFF"004E: end_thread:MISSION_LOOP...all what happens in that mission until it ends (all possible scenarios)so we create actor, give him task, arsenal, vehicle whatsoeverthen we check if he or player is the first one who dies, if he then we create pickup and end mission when pickup picked up.if player dies we just return, if he escaped or whatsoever we display MISSION FAILED and returnall the possible interuprions are needed to be considered so we react when player wisit different interior and so on...0051: return;when mission ended - passed/failed/cancelled:MISSION_FAILED00BA: print_styled_GXT_reference 'M_FAIL' timelimit  5000 font  1 ; ~r~MISSION FAILED!0051: return:CLEAR_ALL_STUFFclear, delete and stuff0051: return

 

 

should i describe more detailed or you get the idea. if yes then we can focus on control thread and the mission itself.

Edited by PLPynton

Share this post


Link to post
Share on other sites
dertyjerzian

No real clue tounge.gif I have assumptions from what you've said, but I doubt I am correct. What about the thread in my first post. Say I wanted to follow your example above, and emulate those codes, what would be the first few lines to add as a skeletal mission?

 

I do understand threads at this point, and also opcodes. I know the pieces to the puzzle, I just don't know where they fit. The edges are out of focus. I think you will be the coder that actually gets some knowledge across to me though, PL, thats awesome.

Share this post


Link to post
Share on other sites
PLPynton

that should be somewhere at the beginning of section MAIN

 

0004: $ON_MISSION =  0 0004: $MARKER_ACTIVE =  0 0004: $MISSION_MARKER_ICON =  160005: $MISSION_MARKER_X =  2250.00005: $MISSION_MARKER_Y =  -1260.00005: $MISSION_MARKER_Z =  23.0

 

that also must be in MAIN

 

004F: create_thread ££EXMIS 

 

that is the general idea for such a thread (without disabling markers for now):

 

:EXMIS03A4: name_thread 'EXMIS' :EXMIS_10001: wait  250 ms00D6: if  0 0256:   is_player_playing $PLAYER_CHAR004D: jump_if_false ££EXMIS_100D6: if  0 0038:   $ON_MISSION ==  0                   004D: jump_if_false ££EXMIS_1;first mission marker show conditions00D6: if  0 0038:   $MARKER_ACTIVE ==  0                004D: jump_if_false ££EXMIS_1002A7: create_icon_marker_and_sphere_at_3D_coord $MISSION_MARKER_X $MISSION_MARKER_Y $MISSION_MARKER_Z  radar_icon $MISSION_MARKER_ICON handle_as $MISSION_MARKER0004: $MARKER_ACTIVE =  1:EXMIS_10;next mission markers show conditions here0002: jump ££EXMIS_20;second part where the missions are started:EXMIS_20;first mission start conditions00D6: if  100FF:   is_actor $PLAYER_ACTOR near_3D_coord $MISSION_MARKER_X $MISSION_MARKER_Y $MISSION_MARKER_Z within_3D_radius  2.0  2.0  2.0 flag  0 and_onfoot 03EE:   is_player $PLAYER_CHAR controllable004D: jump_if_false ££EXMIS_250004: $ON_MISSION =  1 0417: start_mission  X:EXMIS_25;next missions start conditions here0002: jump ££EXMIS_1

 

i am using unified opcodes database so you have to re-write these to fit to your sascm.ini. all the effects like fade, text better put to mission to spare some space in main section of the script.

Edited by PLPynton

Share this post


Link to post
Share on other sites
dertyjerzian

f*ckin go nuts.

 

This is pretty much confusing me.

 

I guess this is what demarest meant when he said not having a standard would f*ck sh*t up?

Share this post


Link to post
Share on other sites
PLPynton

wait, i will prepare compiled one to download. i need few hours however.

Share this post


Link to post
Share on other sites
dertyjerzian

at which time, I can decompile with my sanny and maybe then post the code and you can help make sense of it <3 I bet you are getting annoyed tounge.gif thank you very much PL <3

Share this post


Link to post
Share on other sites
PLPynton

ok, post the codes first if it is not really long, otherwise link it.

annoying? you have to be kidding me, no? do not worry i am patient. i can get annoyed only if you quit in middle of it.

Share this post


Link to post
Share on other sites
dertyjerzian

fair enough, that'll work wink.gif

 

 

// This file was decompiled using sascm.ini published by GtaForums.com on 25.11.05DEFINE OBJECTS 1DEFINE OBJECT SANNY BUILDER v. 2.99e  DEFINE MISSIONS 0DEFINE EXTERNAL_SCRIPTS 0 // Use -1 in order not to compile AAA scriptDEFINE UNKNOWN_EMPTY_SEGMENT 0DEFINE UNKNOWN_THREADS_MEMORY 0{$VERSION 3.1.0000}//-------------MAIN---------------03A4: name_thread 'MAIN' 016A: fade 0 0 ms 042C: set_total_missions_to 0 030D: set_total_mission_points_to 0 01F0: set_max_wanted_level_to 6 0111: set_wasted_busted_check_to 0 00C0: set_current_time 20 0 0005: $7 = 85.0 // floating-point values 0005: $6 = -65.0 // floating-point values 0005: $5 = 15.0 // floating-point values 04E4: unknown_refresh_game_renderer_at $7 $6 03CB: set_camera $7 $6 $5 062A: change_stat 165 to 999.0 // float 062A: change_stat 23 to 999.0 // float 062A: change_stat 21 to 0.0 // float 062A: change_stat 163 to 999.0 // float 062A: change_stat 160 to 999.0 // float 062A: change_stat 229 to 999.0 // float 062A: change_stat 223 to 999.0 // float 062A: change_stat 230 to 999.0 // float 0629: change_stat 181 to 4 // integer 0629: change_stat 68 to 0 // integer 0053: $PLAYER_CHAR = create_player #NULL at $7 $6 $5 07AF: $PLAYER_GROUP = player $PLAYER_CHAR group 01F5: $PLAYER_ACTOR = create_emulated_actor_from_player $PLAYER_CHAR 0373: set_camera_directly_behind_player 0173: set_actor $PLAYER_ACTOR z_angle_to 262.0 01B6: set_weather 1 087B: set_player $PLAYER_CHAR clothes "BBALLJACKRSTAR" "BBJACK" body_part 0 087B: set_player $PLAYER_CHAR clothes "JEANSDENIM" "JEANS" body_part 2 087B: set_player $PLAYER_CHAR clothes "SNEAKERBINCBLK" "SNEAKER" body_part 3 087B: set_player $PLAYER_CHAR clothes "PLAYER_FACE" "HEAD" body_part 1 070D: build_player $PLAYER_CHAR 04BB: select_interior 0 // select render area 01B4: set_player $PLAYER_CHAR frozen_state 1 01B7: release_weather 016C: restart_if_wasted at $7 $6 $5 angle 0.0 unknown 0 0247: request_model #BULLET :MAIN_3830001: wait 0 ms 00D6: if 0248:   model #BULLET available 004D: jump_if_false @MAIN_383 00A5: $4 = create_car #BULLET at $7 $6 $5 0229: set_car $4 color_to 126 24 036A: put_actor $PLAYER_ACTOR in_car $4 016A: fade 1 1000 ms 0001: wait 100 ms 03E6: remove_text_box 0001: wait 0 ms 0002: jump @MAIN_461 :MAIN_4610001: wait 0 ms 0002: jump @MAIN_472 :MAIN_4720001: wait 2500 ms 0002: jump @MAIN_472 

 

 

You can see my last two labels areas are just the same as steve-m's loop, but I stretched it to a new loop to use the other spot. I did good?

 

note ini version at the top8

Share this post


Link to post
Share on other sites
PLPynton

the MAIN is a primary thread that can be used for other things but does not need to be. you can create other threads with (example for thread EXMIS described before):

 

 

004F: create_thread ££EXMIS

 

 

put that within MAIN but before

 

:MAIN_383

 

in your case, generally so it does not loop and create more than 1 thread (we need 1)

 

 

Share this post


Link to post
Share on other sites
dertyjerzian

 

// This file was decompiled using sascm.ini published by GtaForums.com on 25.11.05DEFINE OBJECTS 1DEFINE OBJECT SANNY BUILDER v. 2.99e  DEFINE MISSIONS 0DEFINE EXTERNAL_SCRIPTS 0 // Use -1 in order not to compile AAA scriptDEFINE UNKNOWN_EMPTY_SEGMENT 0DEFINE UNKNOWN_THREADS_MEMORY 0{$VERSION 3.1.0000}//-------------MAIN---------------03A4: name_thread 'MAIN'016A: fade 0 0 ms042C: set_total_missions_to 0030D: set_total_mission_points_to 001F0: set_max_wanted_level_to 60111: set_wasted_busted_check_to 000C0: set_current_time 20 00005: $7 = 85.0 // floating-point values0005: $6 = -65.0 // floating-point values0005: $5 = 15.0 // floating-point values04E4: unknown_refresh_game_renderer_at $7 $603CB: set_camera $7 $6 $5062A: change_stat 165 to 999.0 // float062A: change_stat 23 to 999.0 // float062A: change_stat 21 to 0.0 // float062A: change_stat 163 to 999.0 // float062A: change_stat 160 to 999.0 // float062A: change_stat 229 to 999.0 // float062A: change_stat 223 to 999.0 // float062A: change_stat 230 to 999.0 // float0629: change_stat 181 to 4 // integer0629: change_stat 68 to 0 // integer0053: $PLAYER_CHAR = create_player #NULL at $7 $6 $507AF: $PLAYER_GROUP = player $PLAYER_CHAR group01F5: $PLAYER_ACTOR = create_emulated_actor_from_player $PLAYER_CHAR0373: set_camera_directly_behind_player0173: set_actor $PLAYER_ACTOR z_angle_to 262.001B6: set_weather 1087B: set_player $PLAYER_CHAR clothes "BBALLJACKRSTAR" "BBJACK" body_part 0087B: set_player $PLAYER_CHAR clothes "JEANSDENIM" "JEANS" body_part 2087B: set_player $PLAYER_CHAR clothes "SNEAKERBINCBLK" "SNEAKER" body_part 3087B: set_player $PLAYER_CHAR clothes "PLAYER_FACE" "HEAD" body_part 1070D: build_player $PLAYER_CHAR04BB: select_interior 0 // select render area01B4: set_player $PLAYER_CHAR frozen_state 101B7: release_weather016C: restart_if_wasted at $7 $6 $5 angle 0.0 unknown 00247: request_model #BULLET004F: create_thread ££EXMIS:MAIN_3830001: wait 0 ms00D6: if0248:   model #BULLET available004D: jump_if_false @MAIN_38300A5: $4 = create_car #BULLET at $7 $6 $50229: set_car $4 color_to 126 24036A: put_actor $PLAYER_ACTOR in_car $4016A: fade 1 1000 ms0001: wait 100 ms03E6: remove_text_box0001: wait 0 ms0002: jump @MAIN_461:MAIN_4610001: wait 0 ms0002: jump @MAIN_472:MAIN_4720001: wait 2500 ms0002: jump @MAIN_472 

 

 

Ok, so there is my code with the create_thread added. This is where I will put all create threads to learn your more efficient coding style? This tells main to look for that thread first (if other creates are added after)?

Share this post


Link to post
Share on other sites
PLPynton

the MAIN is a thread itself, the most efficient will be to avoid creating additional threads, but that is not the way we should learn. we will create one thread, make it work. then we will create more threads. finally we will combine more threads into one.

this line

 

004F: create_thread @EXMIS

 

tells that a new thread is created and a code of this thread begins from label

:EXMIS

 

now after

 

:MAIN_4720001: wait 2500 ms0002: jump @MAIN_472

 

you start to write your thread that should begin with:

 

:EXMIS03A4: name_thread 'EXMIS':EXMIS_START0001: wait  250 ms

 

we leave for now completely the MAIN thread and we focus on thread EXMIS.

we need our thread to run all the time, not only once. so as you already know we will loop it to go back to label

:EXMIS_START

 

virtually our thread EXMIS looks for now like:

 

:EXMIS03A4: name_thread 'EXMIS':EXMIS_START0001: wait  250 ms...our further code goes here...0002: jump @EXMIS_START

 

Edited by PLPynton

Share this post


Link to post
Share on other sites
pinky

This is a great topic guys, it is pretty much explaining a lot of info I was beginning to need myself.

Keep it up.

Share this post


Link to post
Share on other sites
dertyjerzian

Hey pinky biggrin.gif Cool man, I hope lots of folks can learn here biggrin.gif Don't think there is many topics like this, at least not in the first two pages, that's for sure tounge.gif

 

@ PL:

 

Ok, so I didnt copy nd paste, I wrote to help remember and then typed it into notepad (I excluded early parts of code to keep smaller and easily readable/followable for everyone)

 

 

0247: request_model #BULLET004F: create_thread ££EXMIS:MAIN_3830001: wait 0 ms00D6: if0248:   model #BULLET available004D: jump_if_false @MAIN_38300A5: $4 = create_car #BULLET at $7 $6 $50229: set_car $4 color_to 126 24036A: put_actor $PLAYER_ACTOR in_car $4016A: fade 1 1000 ms0001: wait 100 ms03E6: remove_text_box0001: wait 0 ms0002: jump @MAIN_461:MAIN_4610001: wait 0 ms0002: jump @MAIN_472:MAIN_4720001: wait 2500 ms0002: jump @MAIN_472:EXMIS03A4: name_thread 'EXMIS':EXMIS START0001 wait 250 ms~OUR CODES HERE~0002: jump @EXMIS_START

 

 

I don't have questions at this very second, I think I should keep my mouth shut for the moment and follow the next lesson biggrin.gif

 

Oh, I do have one question...

 

 

004F: create_thread ££EXMIS

 

And

 

0002: jump @MAIN_461:MAIN_4610001: wait 0 ms0002: jump @MAIN_472:MAIN_4720001: wait 2500 ms0002: jump @MAIN_472:EXMIS03A4: name_thread 'EXMIS':EXMIS START0001 wait 250 ms~OUR CODES HERE~0002: jump @EXMIS_START

 

 

Does that above mean that I could change it to this and have cleaner code:

 

0002: jump @MAIN_461<--change to @EXMIS and delete the 461 and 472 sections????:MAIN_4610001: wait 0 ms0002: jump @MAIN_472:MAIN_4720001: wait 2500 ms0002: jump @MAIN_472 <---- does that loop forever and never make it to our exmis? :EXMIS03A4: name_thread 'EXMIS':EXMIS START0001 wait 250 ms~OUR CODES HERE~0002: jump @EXMIS_START

 

 

Sorry, I may be going ahead of us, like I said at beginning of my post, I should probably not ask questions yet tounge.gif

Edited by dertyjerzian

Share this post


Link to post
Share on other sites
PLPynton

i am working on it, i have had a lot to do today... this post will be re-edited after i have done my notes.

 

but before, and that is very important now: update your sascm.ini because if i will post the code in so old *.ini most of the opcodes we are going to use will be simply imposible to understand for most of peoples reading it. get my INI from my sig or get ini prepared by Seeman- i do not care which one you actually chose. the last INI from opcodes thread is already at fair level to use it.

Share this post


Link to post
Share on other sites
dertyjerzian

I got it PL, (might as well post a new post tounge.gif)

 

I got the one from your sig.

 

It really is more readable:

 

0229: set_vehicle $4 primary_color_to 126 secondary_color_to 24 

 

 

Lovin that.

 

For future readers of this soon to be legendary topic ( sly.gif ), always remember to decompile and recompile all your scripts whenever you change this file (right? tounge.gif)

 

 

Share this post


Link to post
Share on other sites
PLPynton

CHECKPOINT 1: our code looks like that now:

 

DEFINE OBJECTS 1DEFINE OBJECT SANNY BUILDER v. 2.99e  DEFINE MISSIONS 0//LOCATION A-here we will define missions laterDEFINE EXTERNAL_SCRIPTS 0 // Use -1 in order not to compile AAA scriptDEFINE UNKNOWN_EMPTY_SEGMENT 0DEFINE UNKNOWN_THREADS_MEMORY 0{$VERSION 3.0}//-------------MAIN---------------03A4: name_thread 'MAIN' 016A: do_fade timelimit 0 type 0 042C: set_total_missions_to 0 030D: set_mission_points_total_to 0 01F0: set_max_wanted_level_to 6 0111: set_wasted_busted_check_to 0 00C0: set_current_time_hours_to 20 current_time_minutes_to 0 0005: $7 = 0.0 // G = FLOAT 0005: $6 = 0.0 // G = FLOAT 0005: $5 = 5.0 // G = FLOAT//LOCATION B- here we will put our variables later04E4: unknown_refresh_game_renderer_at $7 $6 03CB: set_rendering_origin_at_3D_coord $7 $6 $5 062A: change_stat 165 to 999.0 // floating-point values 062A: change_stat 23 to 999.0 // floating-point values 062A: change_stat 21 to 0.0 // floating-point values 062A: change_stat 163 to 999.0 // floating-point values 062A: change_stat 160 to 999.0 // floating-point values 062A: change_stat 229 to 999.0 // floating-point values 062A: change_stat 223 to 999.0 // floating-point values 062A: change_stat 230 to 999.0 // floating-point values 0629: change_stat 181 to 4 // integer values 0629: change_stat 68 to 0 // integer values 0053: create_player_with_modelID #NULL at_3D_coord $7 $6 $5 handle_as $PLAYER_CHAR 07AF: get_player $PLAYER_CHAR group_to $PLAYER_GROUP 01F5: get_player_actor $PLAYER_CHAR handle_as $PLAYER_ACTOR 0373: set_camera_directly_behind_player 0173: set_actor $PLAYER_ACTOR Z_angle_to 262.0 01B6: set_weather 1 087B: set_player $PLAYER_CHAR apply_shopping_item_texturename "BBALLJACKRSTAR" model_name "BBJACK" item_type 0 // 16-byte strings 087B: set_player $PLAYER_CHAR apply_shopping_item_texturename "JEANSDENIM" model_name "JEANS" item_type 2 // 16-byte strings 087B: set_player $PLAYER_CHAR apply_shopping_item_texturename "SNEAKERBINCBLK" model_name "SNEAKER" item_type 3 // 16-byte strings 087B: set_player $PLAYER_CHAR apply_shopping_item_texturename "PLAYER_FACE" model_name "HEAD" item_type 1 // 16-byte strings 070D: set_player $PLAYER_CHAR rebuild_model_and_items 04BB: select_interior 0 // select render area 01B4: set_player $PLAYER_CHAR controllable 1 01B7: release_weather 016C: restart_if_wasted_at_3D_coord $7 $6 $5 Z_angle 0.0 for_town_number 0 0247: request_modelID #BULLET 004F: create_thread @EXMIS//LOCATION C- here goes another create thread if we need it later :MAIN_3910001: wait 0 ms 00D6: if 0248:   has_modelID_loaded #BULLET 004D: jump_if_false @MAIN_391 00A5: create_vehicle_with_modelID #BULLET at_3D_coord $7 $6 $5 handle_as $4 0229: set_vehicle $4 primary_color_to 126 secondary_color_to 24 036A: put_actor $PLAYER_ACTOR in_vehicle $4 016A: do_fade timelimit 1000 type 1 0001: wait 100 ms 03E6: remove_text_box 0001: wait 0 ms 0002: jump @MAIN_469 :MAIN_4690001: wait 1000 ms 0002: jump @MAIN_469:EXMIS03A4: name_thread 'EXMIS':EXMIS_START0001: wait 250 ms //LOCATION D- here goes code for our thread that will control missions and their markers0002: jump @EXMIS_START//-------------Mission 0---------------//LOCATION E- here goes code for our future missions

 

i have changed a bit of it (coordinates and removed unused code). there are remarks in code named location A-E and these are the playes we put our changes in.

let us go back to the subject:

 

we need to work on our thread now, that is LOCATION D in the code. we need our thread to actually work only when player is actually playing the game and we will refer to actor that we control in the game. that means we have to use check, that allows the code to continue only in case:

00D6: if

0256: is_player_playing $PLAYER_CHAR

004D: jump_if_false @EXMIS_START

now we need to use a switch. this switch is switched ON whenever we are playing mission and it switches back to OFF when we do not play a mission. this swich can be constructed on global variable $ON_MISSION. now we like our code to go back whenever player is playing a mission. so we add code like this:

00D6: if

0038: $ON_MISSION == 0 // G == INT

004D: jump_if_false @EXMIS_START

now we need to define mission marker- to inform player where to go in order to start the mission. since our thread EXMIS will be looped to work over and over again we have to prevent code form creating duplicates of this marker. we will need to use another switch to store information "is marker already activated or not". we create marker only if it is not active at this instance:

:EXMIS_MARKER_M00

00D6: if

0038: $MARKER_M00_ACTIVE == 0 // G == INT

004D: jump_if_false @EXMIS_BEGIN_M00

02A7: create_icon_marker_and_sphere_at_3D_coord $MARKER_M01_X $MARKER_M01_Y $MARKER_M01_Z radar_icon $MARKER_M00_ICON handle_as $MARKER_M00

0004: $MARKER_M00_ACTIVE = 1 // G = INT

you noticed that the code will jump to EXMIS_BEGIN_M00 whenever our mission marker is already active. this label will contain code for conditions and actions necessary to start our mission 0. but we do not care yet. we have to define our variables we just used in LOCATION B now:

0004: $ON_MISSION = 0 // G = INT

0004: $MARKER_M00_ACTIVE = 0 // G = INT

0005: $MARKER_M00_X = 0.0 // G = FLOAT

0005: $MARKER_M00_Y = 10.0 // G = FLOAT

0005: $MARKER_M00_Z = 5.0 // G = FLOAT

0004: $MARKER_M00_ICON = 16 // G = INT

there variables are now set at the beginning of the game to their value (the values we can and will use/change within our thread EXMIS). we could put them in our thread EXMIS but later about that.

:EXMIS_BEGIN_M00

now this label should take care of starting mission 0. what we have to consider is: how the mission will be triggered? by walking into that marker or driving or both? let us decide that walking onfoot in that marker will trigger the mission 0 to start. there is an opcode 00FF that checks if an actor is near some 3D coordinate. that is the one we will use for this case. reassuming we have to set the code to continue only in that case and in other to go back to the beginning of our thread.

00D6: if

00FF: is_actor $PLAYER_ACTOR near_3D_coord $MARKER_M01_X $MARKER_M01_Y $MARKER_M01_Z within_3D_radius 2.0 2.0 2.0 flag 0 and_onfoot

004D: jump_if_false @EXMIS_START

now we have to mind that good code will consider more events, not only the actions that player can perform but as well the actions of game engine, other parts of the code): it can happen that the player will become uncontrollable (we realize that some other part of the game script can do that) and we do not want to start mission in that case because we know it will cause undesired gameplay effects. we use code that checks that, and whenever it happens it jumps to the beginning of the thread.

00D6: if

03EE: is_player $PLAYER_CHAR controllable

004D: jump_if_false @EXMIS_START

now the mission can be executed, we have to remember to set our ON_MISSION switch to ON(1) in order to let the other parts of script and our thread to realize that the mission is about to begin. after that we jump to the beginning of the thread.

0004: $ON_MISSION = 1 // G = INT

0417: start_mission 0

0002: jump @EXMIS_START

now we have to prepare to create mission script, but before that we realize that we might have forget about something (as usually hapens to all of us from time to time). we have to disable marker while the mission is running. realizing at this point that we might use that thread (EXMIS) to handle our future missions and not only the one is good. that basically means that starting each mission requires disabling of all the markers. so we will use gosub for that to learn a bit of it too. we insert just before the start mission opcode our new line:

0050: gosub @DISABLE_MARKERS

and after our last jump we create label :DISABLE MARKERS to which the gosub points. in that label we have to check if marker is active at the moment and disable if it is. naturally after we disable a marker we set his switch to OFF(0). after that we have to use function "return" that is expected everytime when we use gosub.

:DISABLE_MARKERS

00D6: if

0038: $MARKER_M00_ACTIVE == 1 // G == INT

004D: jump_if_false @DISABLE_MARKERS_2

0164: disable_marker $MARKER_M00

0004: $MARKER_M00_ACTIVE = 0 // G = INT

 

:DISABLE_MARKERS_2

0051: return

now wach out with this gosub. after you use it it has to hit "return". no matter what, any jumps or conditional jumps are special care because they have to lead to "return"- you will experience game crashes if you ignore this rule. so by editing this part you have to consider that.

 

CHECKPOINT 2: our EXMIS code looks like that now

 

:EXMIS03A4: name_thread 'EXMIS' :EXMIS_START0001: wait 250 ms 00D6: if 0256:   is_player_playing $PLAYER_CHAR 004D: jump_if_false @EXMIS_START 00D6: if 0038:   $ON_MISSION == 0 // G == INT 004D: jump_if_false @EXMIS_START:EXMIS_MARKER_M00 00D6: if 0038:   $MARKER_M00_ACTIVE == 0 // G == INT 004D: jump_if_false @EXMIS_BEGIN_M0002A7: create_icon_marker_and_sphere_at_3D_coord $MARKER_M00_X $MARKER_M00_Y $MARKER_M00_Z radar_icon $MARKER_M00_ICON handle_as $MARKER_M00 0004: $MARKER_M00_ACTIVE = 1 // G = INT :EXMIS_BEGIN_M0000D6: if 00FF:   is_actor $PLAYER_ACTOR near_3D_coord $MARKER_M00_X $MARKER_M00_Y $MARKER_M00_Z within_3D_radius 2.0 2.0 2.0 flag 0 and_onfoot 004D: jump_if_false @EXMIS_START00D6: if 03EE:   is_player $PLAYER_CHAR controllable 004D: jump_if_false @EXMIS_START0050: gosub @DISABLE_MARKERS 0004: $ON_MISSION = 1 // G = INT 0417: start_mission 0  // Initial 10002: jump @EXMIS_START:DISABLE_MARKERS00D6: if 0038:   $MARKER_M00_ACTIVE == 1 // G == INT 004D: jump_if_false @DISABLE_MARKERS_20164: disable_marker $MARKER_M000004: $MARKER_M00_ACTIVE = 0 // G = INT :DISABLE_MARKERS_20051: return

 

now we will create this mission, at least some code inside to check how it works. in LOCATION A you will have to make a change: re-define missions number and define mission 0 label. change these lines to look just like that:

 

DEFINE MISSIONS 2DEFINE MISSION 0 AT @MISSION_00

 

now in LOCATION E add this short code

 

:MISSION_0003A4: name_thread 'MISSION' 00BA: print_styled_GXT_reference 'STRAP_4' timelimit 1000 font 2  0001: wait 10000 ms0004: $ON_MISSION = 0 // G = INT 004E: end_thread 

 

so this should put some text on screen when you step at the marker, that will check if the code works correctly. now the only thing to do is to write mission code.

we have tried to write EXMIS thread to be easy to extend to handle more missions, here is the complette code how do that:

 

DEFINE OBJECTS 1DEFINE OBJECT SANNY BUILDER v. 2.99e  DEFINE MISSIONS 2DEFINE MISSION 0 AT @MISSION_00        DEFINE MISSION 1 AT @MISSION_01DEFINE EXTERNAL_SCRIPTS 0 // Use -1 in order not to compile AAA scriptDEFINE UNKNOWN_EMPTY_SEGMENT 0DEFINE UNKNOWN_THREADS_MEMORY 0{$VERSION 3.0}//-------------MAIN---------------03A4: name_thread 'MAIN' 016A: do_fade timelimit 0 type 0 042C: set_total_missions_to 0 030D: set_mission_points_total_to 0 01F0: set_max_wanted_level_to 6 0111: set_wasted_busted_check_to 0 00C0: set_current_time_hours_to 20 current_time_minutes_to 0 0005: $7 = 0.0 // G = FLOAT 0005: $6 = 0.0 // G = FLOAT 0005: $5 = 5.0 // G = FLOAT0004: $ON_MISSION = 0 // G = INT0004: $MARKER_M00_ACTIVE = 0 // G = INT 0005: $MARKER_M00_X = 0.0 // G = FLOAT 0005: $MARKER_M00_Y = 10.0 // G = FLOAT 0005: $MARKER_M00_Z = 5.0 // G = FLOAT0004: $MARKER_M00_ICON = 16 // G = INT   0004: $MARKER_M01_ACTIVE = 0 // G = INT 0005: $MARKER_M01_X = 0.0 // G = FLOAT 0005: $MARKER_M01_Y = 30.0 // G = FLOAT 0005: $MARKER_M01_Z = 5.0 // G = FLOAT 0004: $MARKER_M01_ICON = 17 // G = INT  04E4: unknown_refresh_game_renderer_at $7 $6 03CB: set_rendering_origin_at_3D_coord $7 $6 $5 062A: change_stat 165 to 999.0 // floating-point values 062A: change_stat 23 to 999.0 // floating-point values 062A: change_stat 21 to 0.0 // floating-point values 062A: change_stat 163 to 999.0 // floating-point values 062A: change_stat 160 to 999.0 // floating-point values 062A: change_stat 229 to 999.0 // floating-point values 062A: change_stat 223 to 999.0 // floating-point values 062A: change_stat 230 to 999.0 // floating-point values 0629: change_stat 181 to 4 // integer values 0629: change_stat 68 to 0 // integer values 0053: create_player_with_modelID #NULL at_3D_coord $7 $6 $5 handle_as $PLAYER_CHAR 07AF: get_player $PLAYER_CHAR group_to $PLAYER_GROUP 01F5: get_player_actor $PLAYER_CHAR handle_as $PLAYER_ACTOR 0373: set_camera_directly_behind_player 0173: set_actor $PLAYER_ACTOR Z_angle_to 262.0 01B6: set_weather 1 087B: set_player $PLAYER_CHAR apply_shopping_item_texturename "BBALLJACKRSTAR" model_name "BBJACK" item_type 0 // 16-byte strings 087B: set_player $PLAYER_CHAR apply_shopping_item_texturename "JEANSDENIM" model_name "JEANS" item_type 2 // 16-byte strings 087B: set_player $PLAYER_CHAR apply_shopping_item_texturename "SNEAKERBINCBLK" model_name "SNEAKER" item_type 3 // 16-byte strings 087B: set_player $PLAYER_CHAR apply_shopping_item_texturename "PLAYER_FACE" model_name "HEAD" item_type 1 // 16-byte strings 070D: set_player $PLAYER_CHAR rebuild_model_and_items 04BB: select_interior 0 // select render area 01B4: set_player $PLAYER_CHAR controllable 1 01B7: release_weather 016C: restart_if_wasted_at_3D_coord $7 $6 $5 Z_angle 0.0 for_town_number 0 0247: request_modelID #BULLET 004F: create_thread @EXMIS//here goes another create thread if we need it later :MAIN_3910001: wait 0 ms 00D6: if 0248:   has_modelID_loaded #BULLET 004D: jump_if_false @MAIN_391 00A5: create_vehicle_with_modelID #BULLET at_3D_coord $7 $6 $5 handle_as $4 0229: set_vehicle $4 primary_color_to 126 secondary_color_to 24 036A: put_actor $PLAYER_ACTOR in_vehicle $4 016A: do_fade timelimit 1000 type 1 0001: wait 100 ms 03E6: remove_text_box 0001: wait 0 ms 0002: jump @MAIN_469 :MAIN_4690001: wait 1000 ms 0002: jump @MAIN_469:EXMIS03A4: name_thread 'EXMIS' :EXMIS_START0001: wait 250 ms 00D6: if 0256:   is_player_playing $PLAYER_CHAR 004D: jump_if_false @EXMIS_START 00D6: if 0038:   $ON_MISSION == 0 // G == INT 004D: jump_if_false @EXMIS_START:EXMIS_MARKER_M00 00D6: if 0038:   $MARKER_M00_ACTIVE == 0 // G == INT 004D: jump_if_false @EXMIS_MARKER_M0102A7: create_icon_marker_and_sphere_at_3D_coord $MARKER_M00_X $MARKER_M00_Y $MARKER_M00_Z radar_icon $MARKER_M00_ICON handle_as $MARKER_M00 0004: $MARKER_M00_ACTIVE = 1 // G = INT :EXMIS_MARKER_M0100D6: if 0038:   $MARKER_M01_ACTIVE == 0 // G == INT 004D: jump_if_false @EXMIS_MARKER_M0202A7: create_icon_marker_and_sphere_at_3D_coord $MARKER_M01_X $MARKER_M01_Y $MARKER_M01_Z radar_icon $MARKER_M01_ICON handle_as $MARKER_M01 0004: $MARKER_M01_ACTIVE = 1 // G = INT:EXMIS_MARKER_M02//here goes the code for mission 02 marker :EXMIS_BEGIN_M0000D6: if 00FF:   is_actor $PLAYER_ACTOR near_3D_coord $MARKER_M00_X $MARKER_M00_Y $MARKER_M00_Z within_3D_radius 2.0 2.0 2.0 flag 0 and_onfoot 004D: jump_if_false @EXMIS_BEGIN_M0100D6: if 03EE:   is_player $PLAYER_CHAR controllable 004D: jump_if_false @EXMIS_BEGIN_M010050: gosub @DISABLE_MARKERS 0004: $ON_MISSION = 1 // G = INT 0417: start_mission 0  // Initial 10002: jump @EXMIS_START:EXMIS_BEGIN_M0100D6: if 00FF:   is_actor $PLAYER_ACTOR near_3D_coord $MARKER_M01_X $MARKER_M01_Y $MARKER_M01_Z within_3D_radius 2.0 2.0 2.0 flag 0 and_onfoot 004D: jump_if_false @EXMIS_BEGIN_M0200D6: if 03EE:   is_player $PLAYER_CHAR controllable 004D: jump_if_false @EXMIS_BEGIN_M020050: gosub @DISABLE_MARKERS 0004: $ON_MISSION = 1 // G = INT 0417: start_mission 1  // Initial 10002: jump @EXMIS_START:EXMIS_BEGIN_M02//here goes the code for mission 02 start0002: jump @EXMIS_START:DISABLE_MARKERS00D6: if 0038:   $MARKER_M00_ACTIVE == 1 // G == INT 004D: jump_if_false @DISABLE_MARKERS_20164: disable_marker $MARKER_M000004: $MARKER_M00_ACTIVE = 0 // G = INT :DISABLE_MARKERS_200D6: if 0038:   $MARKER_M01_ACTIVE == 1 // G == INT 004D: jump_if_false @DISABLE_MARKERS_30164: disable_marker $MARKER_M010004: $MARKER_M01_ACTIVE = 0 // G = INT :DISABLE_MARKERS_3//here goes code for mission 02 marker disable0051: return  //-------------Mission 0---------------:MISSION_0003A4: name_thread 'MISSION' 00BA: print_styled_GXT_reference 'STRAP_4' timelimit 1000 font 2  0001: wait 10000 ms0004: $ON_MISSION = 0 // G = INT 004E: end_thread //-------------Mission 1---------------:MISSION_0103A4: name_thread 'MISSION' 00BA: print_styled_GXT_reference 'CESAR_1' timelimit 1000 font 2  0001: wait 10000 ms0004: $ON_MISSION = 0 // G = INT 004E: end_thread

 

this code creates two markers that start two different missions (mission code shows only text on screen).

Edited by PLPynton

Share this post


Link to post
Share on other sites
dertyjerzian

I'm up to speed with you, compiles, and works <3 I really had to read CLOSELY! lol. But it's making more and more sense, PL biggrin.gif

 

I feel as though, as long as I look here, I will always be able to get to this point again biggrin.gif

 

I did, however, have to change all the Z's back to 13 from 5, in order to fit my map tounge.gif I guess that part of SA is only 5 above see level? I thought it was higher! lol

Share this post


Link to post
Share on other sites
PLPynton

ok, so if that works we can focus on mission. do you want this as i did with the thread: descriptions and stuff? i will do it probably today evening.

 

for now i post mission 00 code. it should work like that:

by the mission start a vehicle and a driver Tempenny is created. drivers tries to ram you. whenever you render his (bulletproof) vehicle to smoke he starts to drive away. if his veh is unable to drive he disembarks tries to continue onfoot. if you kill him- a pickup is created. if you pick it up- missions ends. small and simple code. easy to extend i hope. shall i explain this code deeper?

 

:MISSION_0003A4: name_thread 'MIS_00' 0050: gosub @MISSION_00_MAIN 00D6: if 0112:   wasted_or_busted 004D: jump_if_false @MISSION_00_END0050: gosub @MISSION_00_WB :MISSION_00_END0050: gosub @MISSION_00_CLEANUP004E: end_thread :MISSION_00_MAIN0317: increment_mission_attempts054C: use_GXT_table 'VCR1' 0005: $MISSION_00_START_X = 0.0 // G = FLOAT 0005: $MISSION_00_START_Y = 50.0 // G = FLOAT 0005: $MISSION_00_START_Z = 5.0 // G = FLOAT0247: request_modelID #TOPFUN023C: load_special_actor_slot 1 with_model 'TENPEN' //corresponds modelID 290-2990247: request_modelID #TOPFUN :MISSION_00_MAIN_0100D6: if or8248:   not has_modelID_loaded #TOPFUN823D:   not has_special_actor_slot 1 loaded  004D: jump_if_false @MISSION_00_MAIN_020001: wait 0 ms 0002: jump @MISSION_00_MAIN_01 :MISSION_00_MAIN_020395: clear_area_center_at_3D_coord $MISSION_00_START_X $MISSION_00_START_Y $MISSION_00_START_Z   radius 1000.0 flag 1 00A5: create_vehicle_with_modelID #TOPFUN at_3D_coord $MISSION_00_START_X $MISSION_00_START_Y $MISSION_00_START_Z handle_as [email protected]: set_vehicle [email protected] health_to 500 02AC: set_vehicle [email protected] immunities_to_BP 1 FP 0 EP 0 DP 0 WO_or_AP 00129: create_driver_in_vehicle [email protected] with_pedtype 23 with_modelID #SPECIAL01 handle_as [email protected]: set_actor [email protected] using_vehicle [email protected] target_vehicle -1 with_order 2 max_speed 30.0 traffic_flag 50187: create_marker_above_actor [email protected] handle_as [email protected] :MISSION_00_MAIN_030001: wait 0 ms00D6: if 8118:   not is_actor [email protected] dead 004D: jump_if_false @MISSION_00_MAIN_0500D6: if 00DF:   is_actor [email protected] driving 004D: jump_if_false @MISSION_00_MAIN_040811: get_actor [email protected] vehicle_handle_to [email protected] //safe method 00D6: if 8185:   not is_vehicle [email protected] health >= 400 004D: jump_if_false @MISSION_00_MAIN_0306E1: set_actor [email protected] using_vehicle [email protected] target_vehicle -1 with_order 1 max_speed 60.0 traffic_flag 50002: jump @MISSION_00_MAIN_03:MISSION_00_MAIN_040751: AS_actor [email protected] flee_from_actor $PLAYER_ACTOR run_distance 100000.0 timelimit 999999 unknown 1 3000 5000 away_radius 50.0 0002: jump @MISSION_00_MAIN_03:MISSION_00_MAIN_050164: disable_marker [email protected] 00A0: get_actor [email protected] position_3D_coord_to $MISSION_00_PICKUP_X $MISSION_00_PICKUP_Y $MISSION_00_PICKUP_Z  0213: create_pickup #BRIEFCASE type 3 at_3D_coord $MISSION_00_PICKUP_X $MISSION_00_PICKUP_Y $MISSION_00_PICKUP_Z handle_as [email protected] 03DC: create_marker_above_pickup [email protected] handle_as [email protected] 00BC: print_now_GXT_reference 'VCR1__3' timelimit 5000 flag 1 //high priority  // ~s~The target is dead and has dropped the ~g~evidence dossier~s~, grab it before anyone else does.:MISSION_00_MAIN_060001: wait 0 ms00D6: if 0214:   is_pickup [email protected] picked_up 004D: jump_if_false @MISSION_00_MAIN_060164: disable_marker [email protected] 00BC: print_now_GXT_reference 'VCR1__6' timelimit 5000 flag 1 //high priority  // ~s~Congratulations, you have the evidence dossier.0109: set_player $PLAYER_CHAR add_money 500 0001: wait 1000 ms 030C: set_mission_points_add 1 0998: add_mission_respect_points 6 01E3: text_1number_styled 'M_PASSS' 500 timelimit 5000 flag 1  // MISSION PASSED!~n~~w~$~1~~n~~w~RESPECT +0394: play_music 1 :MISSION_00_MAIN_RETURN0051: return :MISSION_00_WB//nothing for now here0051: return:MISSION_00_CLEANUP0164: disable_marker [email protected] 0164: disable_marker [email protected]: delete_pickup [email protected]: mark_modelID_as_no_longer_needed #TOPFUN 0296: mark_special_actor_slot_as_no_longer_needed 1 00D8: mark_all_used_as_no_longer_needed0004: $ON_MISSION = 0 // G = INT  0051: return

 

Edited by PLPynton

Share this post


Link to post
Share on other sites
dertyjerzian

--- double ----

Edited by dertyjerzian

Share this post


Link to post
Share on other sites
dertyjerzian

Shameless bump, Im dyin out here lol

Share this post


Link to post
Share on other sites
dertyjerzian

glorified bump, bitch.

Still cant code. tounge.gif

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.