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

    1. Red Dead Redemption 2

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

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

      1. Recruitment
    2. Events

    1. GTA Online

      1. DLC
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
      7. The Diamond Casino Heist
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

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

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
timmy2004

Help with some things...

Recommended Posts

timmy2004

For my mod 'Tropica Islands'; I'm constructing a mission. Here is the code:

 

:1-xxxmission002A7: $xxxmissionsphere = create_icon_marker_and_sphere 17 at 214.052 -480.686 6.7210002: jump ££2-xxxmission0:2-xxxmission00001: wait  500 ms00D6: if  100F9:   player $PLAYER_CHAR stopped  0 ()near_point_on_foot 214.052 -480.686 6.721 radius  1.3  1.3  2.00038:   $ONMISSION ==  0004D: jump_if_false ££2-xxxmission00247: request_model #sanchez0247: request_model #army0247: request_model #mp5lng038B: load_requested_models0169: set_fade_color  0  0  0016A: fade  0 ()  1000 ms0001: wait 700 ms00A5: $moto = create_car #sanchez at -1435.580 455.482 6.7210175: set_car $moto z_angle_to 270.0  036A: put_actor $player_actor in_car $moto015F: set_camera_position  -1435.580 455.482 15.721  0.0  0.0  0.00160: point_camera  -920.363 459.167 6.721  20001: wait 500 ms03BD: destroy_sphere  $xxxmissionsphere016A: fade  1 (back)  1000 ms00BC: text_highpriority "CRED016"  5000 ms  10004: $ONMISSION =  10001: wait 1000 ms015A: restore_camera004F: create_thread ££playerdeadcheckxxx1004F: create_thread ££playerwincheckxxx10002: jump ££3-xxxmission0:3-xxxmission0009A: $army2 = create_actor  4 #army at  -1385.643 479.169 6.72101B2: give_actor $army2 weapon  25 ammo  100;; Load the weapon model before using this035F: set_actor $army2 armour_to  9990223: set_actor $army2 health_to  99902E2: set_actor $army2 weapon_accuracy_to  900350: unknown_actor $army2 not_scared_flag  101CA: actor $army2 kill_player $PLAYER_CHAR0319: set_actor $army2 wander_state_to  1 (off)009A: $army3 = create_actor  4 #army at  -1350.897 477.528 6.72101B2: give_actor $army3 weapon  25 ammo  100;; Load the weapon model before using this035F: set_actor $army3 armour_to  9990223: set_actor $army3 health_to  99902E2: set_actor $army3 weapon_accuracy_to  900350: unknown_actor $army3 not_scared_flag  101CA: actor $army3 kill_player $PLAYER_CHAR0319: set_actor $army3 wander_state_to  1 (off)009A: $army4 = create_actor  4 #army at  -1304.251 472.922 6.72101B2: give_actor $army4 weapon  25 ammo  100;; Load the weapon model before using this035F: set_actor $army4 armour_to  9990223: set_actor $army4 health_to  99902E2: set_actor $army4 weapon_accuracy_to  900350: unknown_actor $army4 not_scared_flag  101CA: actor $army4 kill_player $PLAYER_CHAR009A: $army5 = create_actor  4 #army at  -1260.295 468.582 6.72101B2: give_actor $army5 weapon  25 ammo  100;; Load the weapon model before using this035F: set_actor $army5 armour_to  9990223: set_actor $army5 health_to  99902E2: set_actor $army5 weapon_accuracy_to  900350: unknown_actor $army5 not_scared_flag  101CA: actor $army5 kill_player $PLAYER_CHAR009A: $army6 = create_actor  4 #army at  -1211.138 477.496 6.72101B2: give_actor $army6 weapon  25 ammo  100;; Load the weapon model before using this035F: set_actor $army6 armour_to  9990223: set_actor $army6 health_to  99902E2: set_actor $army6 weapon_accuracy_to  900350: unknown_actor $army6 not_scared_flag  101CA: actor $army6 kill_player $PLAYER_CHAR009A: $army7 = create_actor  4 #army at  -1190.548 441.536 6.72101B2: give_actor $army7 weapon  25 ammo  100;; Load the weapon model before using this035F: set_actor $army7 armour_to  9990223: set_actor $army7 health_to  99902E2: set_actor $army7 weapon_accuracy_to  900350: unknown_actor $army7 not_scared_flag  101CA: actor $army7 kill_player $PLAYER_CHAR0319: set_actor $army7 wander_state_to  1 (off)009A: $army8 = create_actor  4 #army at  -1229.284 436.112 6.72101B2: give_actor $army8 weapon  25 ammo  100;; Load the weapon model before using this035F: set_actor $army8 armour_to  9990223: set_actor $army8 health_to  99902E2: set_actor $army8 weapon_accuracy_to  900350: unknown_actor $army8 not_scared_flag  101CA: actor $army8 kill_player $PLAYER_CHAR009A: $army9 = create_actor  4 #army at  -1266.787 436.411 6.72101B2: give_actor $army9 weapon  25 ammo  100;; Load the weapon model before using this035F: set_actor $army9 armour_to  9990223: set_actor $army9 health_to  99902E2: set_actor $army9 weapon_accuracy_to  900350: unknown_actor $army9 not_scared_flag  101CA: actor $army9 kill_player $PLAYER_CHAR009A: $army10 = create_actor  4 #army at  -1317.462 441.750 6.72101B2: give_actor $army10 weapon  25 ammo  100;; Load the weapon model before using this035F: set_actor $army10 armour_to  9990223: set_actor $army10 health_to  99902E2: set_actor $army10 weapon_accuracy_to  900350: unknown_actor $army10 not_scared_flag  101CA: actor $army10 kill_player $PLAYER_CHAR009A: $army11 = create_actor  4 #army at  -1359.613 442.015 6.72101B2: give_actor $army11 weapon  25 ammo  100;; Load the weapon model before using this035F: set_actor $army11 armour_to  9990223: set_actor $army11 health_to  99902E2: set_actor $army11 weapon_accuracy_to  900350: unknown_actor $army11 not_scared_flag  101CA: actor $army11 kill_player $PLAYER_CHAR0319: set_actor $army11 wander_state_to  1 (off)004E: end_thread:playerwincheckxxx103A4: name_thread "xxx2"0001: wait  500 ms00D6: if  000F9:   player $PLAYER_CHAR stopped  0 ()near_point_on_foot -920.363 459.167 6.721 radius  6.3  6.3  6.0004D: jump_if_false ££playerwincheckxxx10055: put_player $PLAYER_CHAR at  1407.044 -728.604 6.72101E3: text_1number_styled "M_PASS"  5000  5000 ms  1;; MISSION PASSED! $~1~0109: player $PLAYER_CHAR money += 50000459: end_thread_named "xxx1"034F: destroy_actor_with_fade $army2;; The actor fades away like a ghost034F: destroy_actor_with_fade $army3;; The actor fades away like a ghost034F: destroy_actor_with_fade $army4;; The actor fades away like a ghost034F: destroy_actor_with_fade $army5;; The actor fades away like a ghost034F: destroy_actor_with_fade $army6;; The actor fades away like a ghost034F: destroy_actor_with_fade $army7;; The actor fades away like a ghost034F: destroy_actor_with_fade $army8;; The actor fades away like a ghost034F: destroy_actor_with_fade $army9;; The actor fades away like a ghost034F: destroy_actor_with_fade $army10;; The actor fades away like a ghost034F: destroy_actor_with_fade $army11;; The actor fades away like a ghost0002: jump ££1-xxxmission0004E: end_thread:playerdeadcheckxxx103A4: name_thread "xxx1"0001: wait 300 ms00d6: if 00118:   actor $PLAYER_ACTOR dead004D: jump_if_false ££playerdeadcheckxxx1034F: destroy_actor_with_fade $army2;; The actor fades away like a ghost034F: destroy_actor_with_fade $army3;; The actor fades away like a ghost034F: destroy_actor_with_fade $army4;; The actor fades away like a ghost034F: destroy_actor_with_fade $army5;; The actor fades away like a ghost034F: destroy_actor_with_fade $army6;; The actor fades away like a ghost034F: destroy_actor_with_fade $army7;; The actor fades away like a ghost034F: destroy_actor_with_fade $army8;; The actor fades away like a ghost034F: destroy_actor_with_fade $army9;; The actor fades away like a ghost034F: destroy_actor_with_fade $army10;; The actor fades away like a ghost034F: destroy_actor_with_fade $army11;; The actor fades away like a ghost0459: end_thread_named "xxx1"00BA: text_styled "M_FAIL"  5000 ms  1;; MISSION FAILED!0004: $ONMISSION =  00002: jump ££1-xxxmission0004E: end_thread

 

 

Now I'm sure you people don't want to read through it all and figure out what it is and what's wrong wih it, so I'll explain...

 

You walk to the coords at '$xxxmissionsphere' (this starts the mission).

And it teleports you into another location on a Sanchez motobike.

You have to drive your motobike to the other side of the island that your on, then hop off the bike and walk into the coords: '-920.363 459.167 6.721' at the thread: 'playerwincheckxxx1'.

While you drive there, you have all the '#army' actors shoot at you and if you die it ends the mission, destroys the actor, tells you 'MISSION FAILED', etc AND your SUPPOSED to be able to start the mission again by going into $xxxmissionsphere, but it doesn't start.

But if you are able to make it to the coords at the end; you win 5000, get sent back the the other island and you are SUPPOSED to be able to do the mission again by going back to $xxxmissionsphere, but it doesn't start.

 

Why wont the mission start again when I go back there? The sphere is there, but the mission will not start again.

At the end of the playerdead and playerwin checks it jumps back up to the first thread, so it SHOULD start again.

 

 

And also; I'm using an extremly stripped script (I think) and I can't create cars, why?

Here is the simple thread for my cars:

 

:cars014B: $1 = init_parked_car_generator #greenwoo -1 -1 1 alarm 0 door_lock 0 0 10000 at 1413.434 -762.232 6.414 angle 0.0 014C: set_parked_car_generator $1 cars_to_generate_to 100 014B: $2 = init_parked_car_generator #admiral -1 -1 1 alarm 0 door_lock 0 0 10000 at 1300.346 -601.698 6.244 angle 0.0 014C: set_parked_car_generator $2 cars_to_generate_to 100 014B: $3 = init_parked_car_generator #banshee -1 -1 1 alarm 0 door_lock 0 0 10000 at 1171.492 -704.610 6.240 angle 0.0 014C: set_parked_car_generator $3 cars_to_generate_to 100 014B: $4 = init_parked_car_generator #police -1 -1 1 alarm 0 door_lock 0 0 10000 at 1167.710 -228.603 6.496 angle 0.0 014C: set_parked_car_generator $4 cars_to_generate_to 100 014B: $5 = init_parked_car_generator #maverick -1 -1 0 alarm 0 door_lock 0 0 10000 at 1279.442 30.346 6.442 angle 0.0 014C: set_parked_car_generator $5 cars_to_generate_to 100 014B: $6 = init_parked_car_generator #patriot -1 -1 0 alarm 0 door_lock 0 0 10000 at 847.927 -291.811 6.794 angle 0.0 014C: set_parked_car_generator $6 cars_to_generate_to 100004E: end_thread

 

None of them show up...

Edited by timmy2004

Share this post


Link to post
Share on other sites
redviper88

Timmy,

 

Maybe the first one is because you didn't remove the reference to your bike.

I am not sure though, but I think it is at least a problem.

 

For the cars: I have never used the "generate to 100" you could just test it with 101 (infinate)

 

Hopefully I have helped you a bit

Share this post


Link to post
Share on other sites
timmy2004

Nope.

 

The bike was acctully the last thing added into the script and it still didn't work then.

 

As for the cars; they were always set as 101, but I just recently changed them to 100 to see if they would appear if I did that.

 

But thanks for the help anyway, I'll make it remove the bike when the player finishes the mission. :D

 

Also another thought about the cars; Maybe I need to add the 'create_car' opcode in there as well, I dunno.

Edited by timmy2004

Share this post


Link to post
Share on other sites
PatrickW

Timmy,

 

To start, I would like to say that this is a very unconventional way of coding missions. If you plan to add more missions, I would advice you, to have a look how R* executes their missions, and build yours in the same way.

 

Back to the problem at hand: as far as I can see, your problems is caused by two factors:

1) Your wincheck thread is missing a "0004: $ONMISSION = 0", therefor your code that should start the mission will never be unblocked.

2) Your deadcheck thread kills itself instead of the wincheck thread: 0459: end_thread_named "xxx1"

 

 

Some other issues in your code:

• you should insert "if player defined" checks after each "wait" before referencing the PLAYER_CHAR or PLAYER_ACTOR again, or your mission may crash at unexpected moments.

• As redviper said, you should remove references to the bike when the mission is done, otherwise all the bikes will be kept in the game, and after a couple of missions, the random traffic will start to dissapear.

• Try to use sensible names for labels, variables and threads ( see the second problem above)

• Also don't use all numerical varnames ( e.g. $1, $234) for your own created variables, as they might interfere with existing variables the decompiler created ( this might cause your parked car generators to misbehave, but I'm not sure.

 

 

 

Are you sure the parker car generator code is actualy run?

Share this post


Link to post
Share on other sites
Hammer83

ANother thing I would like to add. I don't know how safe it is within Rockstar interpreter, but it's generally not a good idea in programming to terminate a thread. Instead a thread should check for termination condition itself and do some cleanup work if necessary before termination. Ending a thread in the middle of execution can result in corrupted state of variables.

Share this post


Link to post
Share on other sites
PatrickW
ANother thing I would like to add. I don't know how safe it is within Rockstar interpreter, but it's generally not a good idea in programming to terminate a thread. Instead a thread should check for termination condition itself and do some cleanup work if necessary before termination. Ending a thread in the middle of execution can result in corrupted state of variables.

In normal programming your absolutly right, but the thread concept that the SCM-interpreter uses is very abstract, and R* uses the ill_thread_by_name opcode itself.

So we can assume that it is save to use and that the proper cleanups will occur below the hood.

 

But you're right, this is certainly not how I would program it. In this situation, I don't think there's a need for using additional threads at all.

 

The wincheck-thread and the deadcheck-thread can easily be merged, and the result doesn't have to be started as a new thread, while killing the original thread itself. Just a simple jump to this code would suffice.

Share this post


Link to post
Share on other sites
timmy2004

Sorry I didn't replay sooner, but I only do my mission coding on the weekends (it's saturday now :D ).

 

Okay, well I was able to fix that mission, thanks very much Pat. :D

 

I still can't get the cars to work though.

 

I even saw this thread (this is an extract of the first part of the thread):

 

;-------------Mission 0---------------; Originally: (no description):Label009B4303A4: name_thread "INITIAL"0004: $DEFAULT_WAIT_TIME =  250 ;; integer values029B: $ARENA_DOOR_1 = init_object -1 (DTN_STADDOORA) at -1109.615  1330.097  20.37201C7: remove_object_from_mission_cleanup_list $ARENA_DOOR_1029B: $ARENA_DOOR_2 = init_object -2 (DTN_STADDOORB) at -1109.615  1331.932  20.37201C7: remove_object_from_mission_cleanup_list $ARENA_DOOR_2029B: $8 = init_object -3 (DTHOTRING_A) at -1037.08  1340.258  36.55201C7: remove_object_from_mission_cleanup_list $8029B: $FILM_STUDIO_FRONT_GATE_OPEN = init_object -163 (CI_GATESOPEN) at  10.273  963.308  12.25801C7: remove_object_from_mission_cleanup_list $FILM_STUDIO_FRONT_GATE_OPEN

 

And realised that in the original R* main.scm they put their cars in this thread, so I put them in there, but they still don't work.

 

What do you mean by 'Are you sure the parker car generator code is actualy run?'?

Share this post


Link to post
Share on other sites
PatrickW

What do you mean by 'Are you sure the parker car generator code is actualy run?'?

 

 

Want I meant was, that you are sure that the opcodes you put in, are executed, but if you put them in the thread you showed, that's a good place.

 

Did you use proper names for the car_generators, instead of the numerical names you used before...

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  

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