Quantcast

Jump to content

» «
Photo

Help with some things...

7 replies to this topic
timmy2004
  • timmy2004

    Gangsta

  • Members
  • Joined: 05 Aug 2004

#1

Posted 16 May 2005 - 02:29 AM Edited by timmy2004, 16 May 2005 - 05:09 AM.

For my mod 'Tropica Islands'; I'm constructing a mission. Here is the code:
CODE
:1-xxxmission0
02A7: $xxxmissionsphere = create_icon_marker_and_sphere 17 at 214.052 -480.686 6.721
0002: jump ££2-xxxmission0

:2-xxxmission0
0001: wait  500 ms
00D6: if  1
00F9:   player $PLAYER_CHAR stopped  0 ()near_point_on_foot 214.052 -480.686 6.721 radius  1.3  1.3  2.0
0038:   $ONMISSION ==  0
004D: jump_if_false ££2-xxxmission0
0247: request_model #sanchez
0247: request_model #army
0247: request_model #mp5lng
038B: load_requested_models
0169: set_fade_color  0  0  0
016A: fade  0 ()  1000 ms
0001: wait 700 ms
00A5: $moto = create_car #sanchez at -1435.580 455.482 6.721
0175: set_car $moto z_angle_to 270.0  
036A: put_actor $player_actor in_car $moto
015F: set_camera_position  -1435.580 455.482 15.721  0.0  0.0  0.0
0160: point_camera  -920.363 459.167 6.721  2
0001: wait 500 ms
03BD: destroy_sphere  $xxxmissionsphere
016A: fade  1 (back)  1000 ms
00BC: text_highpriority "CRED016"  5000 ms  1
0004: $ONMISSION =  1
0001: wait 1000 ms
015A: restore_camera
004F: create_thread ££playerdeadcheckxxx1
004F: create_thread ££playerwincheckxxx1
0002: jump ££3-xxxmission0

:3-xxxmission0
009A: $army2 = create_actor  4 #army at  -1385.643 479.169 6.721
01B2: give_actor $army2 weapon  25 ammo  100;; Load the weapon model before using this
035F: set_actor $army2 armour_to  999
0223: set_actor $army2 health_to  999
02E2: set_actor $army2 weapon_accuracy_to  90
0350: unknown_actor $army2 not_scared_flag  1
01CA: actor $army2 kill_player $PLAYER_CHAR
0319: set_actor $army2 wander_state_to  1 (off)
009A: $army3 = create_actor  4 #army at  -1350.897 477.528 6.721
01B2: give_actor $army3 weapon  25 ammo  100;; Load the weapon model before using this
035F: set_actor $army3 armour_to  999
0223: set_actor $army3 health_to  999
02E2: set_actor $army3 weapon_accuracy_to  90
0350: unknown_actor $army3 not_scared_flag  1
01CA: actor $army3 kill_player $PLAYER_CHAR
0319: set_actor $army3 wander_state_to  1 (off)
009A: $army4 = create_actor  4 #army at  -1304.251 472.922 6.721
01B2: give_actor $army4 weapon  25 ammo  100;; Load the weapon model before using this
035F: set_actor $army4 armour_to  999
0223: set_actor $army4 health_to  999
02E2: set_actor $army4 weapon_accuracy_to  90
0350: unknown_actor $army4 not_scared_flag  1
01CA: actor $army4 kill_player $PLAYER_CHAR
009A: $army5 = create_actor  4 #army at  -1260.295 468.582 6.721
01B2: give_actor $army5 weapon  25 ammo  100;; Load the weapon model before using this
035F: set_actor $army5 armour_to  999
0223: set_actor $army5 health_to  999
02E2: set_actor $army5 weapon_accuracy_to  90
0350: unknown_actor $army5 not_scared_flag  1
01CA: actor $army5 kill_player $PLAYER_CHAR
009A: $army6 = create_actor  4 #army at  -1211.138 477.496 6.721
01B2: give_actor $army6 weapon  25 ammo  100;; Load the weapon model before using this
035F: set_actor $army6 armour_to  999
0223: set_actor $army6 health_to  999
02E2: set_actor $army6 weapon_accuracy_to  90
0350: unknown_actor $army6 not_scared_flag  1
01CA: actor $army6 kill_player $PLAYER_CHAR
009A: $army7 = create_actor  4 #army at  -1190.548 441.536 6.721
01B2: give_actor $army7 weapon  25 ammo  100;; Load the weapon model before using this
035F: set_actor $army7 armour_to  999
0223: set_actor $army7 health_to  999
02E2: set_actor $army7 weapon_accuracy_to  90
0350: unknown_actor $army7 not_scared_flag  1
01CA: actor $army7 kill_player $PLAYER_CHAR
0319: set_actor $army7 wander_state_to  1 (off)
009A: $army8 = create_actor  4 #army at  -1229.284 436.112 6.721
01B2: give_actor $army8 weapon  25 ammo  100;; Load the weapon model before using this
035F: set_actor $army8 armour_to  999
0223: set_actor $army8 health_to  999
02E2: set_actor $army8 weapon_accuracy_to  90
0350: unknown_actor $army8 not_scared_flag  1
01CA: actor $army8 kill_player $PLAYER_CHAR
009A: $army9 = create_actor  4 #army at  -1266.787 436.411 6.721
01B2: give_actor $army9 weapon  25 ammo  100;; Load the weapon model before using this
035F: set_actor $army9 armour_to  999
0223: set_actor $army9 health_to  999
02E2: set_actor $army9 weapon_accuracy_to  90
0350: unknown_actor $army9 not_scared_flag  1
01CA: actor $army9 kill_player $PLAYER_CHAR
009A: $army10 = create_actor  4 #army at  -1317.462 441.750 6.721
01B2: give_actor $army10 weapon  25 ammo  100;; Load the weapon model before using this
035F: set_actor $army10 armour_to  999
0223: set_actor $army10 health_to  999
02E2: set_actor $army10 weapon_accuracy_to  90
0350: unknown_actor $army10 not_scared_flag  1
01CA: actor $army10 kill_player $PLAYER_CHAR
009A: $army11 = create_actor  4 #army at  -1359.613 442.015 6.721
01B2: give_actor $army11 weapon  25 ammo  100;; Load the weapon model before using this
035F: set_actor $army11 armour_to  999
0223: set_actor $army11 health_to  999
02E2: set_actor $army11 weapon_accuracy_to  90
0350: unknown_actor $army11 not_scared_flag  1
01CA: actor $army11 kill_player $PLAYER_CHAR
0319: set_actor $army11 wander_state_to  1 (off)
004E: end_thread

:playerwincheckxxx1
03A4: name_thread "xxx2"
0001: wait  500 ms
00D6: if  0
00F9:   player $PLAYER_CHAR stopped  0 ()near_point_on_foot -920.363 459.167 6.721 radius  6.3  6.3  6.0
004D: jump_if_false ££playerwincheckxxx1
0055: put_player $PLAYER_CHAR at  1407.044 -728.604 6.721
01E3: text_1number_styled "M_PASS"  5000  5000 ms  1;; MISSION PASSED! $~1~
0109: player $PLAYER_CHAR money += 5000
0459: end_thread_named "xxx1"
034F: destroy_actor_with_fade $army2;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army3;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army4;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army5;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army6;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army7;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army8;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army9;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army10;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army11;; The actor fades away like a ghost
0002: jump ££1-xxxmission0
004E: end_thread

:playerdeadcheckxxx1
03A4: name_thread "xxx1"
0001: wait 300 ms
00d6: if 0
0118:   actor $PLAYER_ACTOR dead
004D: jump_if_false ££playerdeadcheckxxx1
034F: destroy_actor_with_fade $army2;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army3;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army4;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army5;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army6;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army7;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army8;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army9;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army10;; The actor fades away like a ghost
034F: destroy_actor_with_fade $army11;; The actor fades away like a ghost
0459: end_thread_named "xxx1"
00BA: text_styled "M_FAIL"  5000 ms  1;; MISSION FAILED!
0004: $ONMISSION =  0
0002: jump ££1-xxxmission0
004E: 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:
CODE
:cars
014B: $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 100
004E: end_thread

None of them show up...

redviper88
  • redviper88

    Player Hater

  • Members
  • Joined: 17 Feb 2004

#2

Posted 16 May 2005 - 10:08 AM

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

timmy2004
  • timmy2004

    Gangsta

  • Members
  • Joined: 05 Aug 2004

#3

Posted 16 May 2005 - 10:21 AM Edited by timmy2004, 16 May 2005 - 10:24 AM.

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.

PatrickW
  • PatrickW

    GTA Juggernaut

  • Moderator
  • Joined: 07 Jan 2004
  • Netherlands

#4

Posted 16 May 2005 - 12:52 PM

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?

Hammer83
  • Hammer83

    Hustler

  • Members
  • Joined: 11 Jan 2003

#5

Posted 16 May 2005 - 11:41 PM

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.

PatrickW
  • PatrickW

    GTA Juggernaut

  • Moderator
  • Joined: 07 Jan 2004
  • Netherlands

#6

Posted 17 May 2005 - 10:21 AM

QUOTE (Hammer83 @ May 17 2005, 01:41)
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.

timmy2004
  • timmy2004

    Gangsta

  • Members
  • Joined: 05 Aug 2004

#7

Posted 20 May 2005 - 11:44 PM

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):
CODE
;-------------Mission 0---------------
; Originally: (no description)


:Label009B43
03A4: name_thread "INITIAL"
0004: $DEFAULT_WAIT_TIME =  250 ;; integer values
029B: $ARENA_DOOR_1 = init_object -1 (DTN_STADDOORA) at -1109.615  1330.097  20.372
01C7: remove_object_from_mission_cleanup_list $ARENA_DOOR_1
029B: $ARENA_DOOR_2 = init_object -2 (DTN_STADDOORB) at -1109.615  1331.932  20.372
01C7: remove_object_from_mission_cleanup_list $ARENA_DOOR_2
029B: $8 = init_object -3 (DTHOTRING_A) at -1037.08  1340.258  36.552
01C7: remove_object_from_mission_cleanup_list $8
029B: $FILM_STUDIO_FRONT_GATE_OPEN = init_object -163 (CI_GATESOPEN) at  10.273  963.308  12.258
01C7: 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?'?

PatrickW
  • PatrickW

    GTA Juggernaut

  • Moderator
  • Joined: 07 Jan 2004
  • Netherlands

#8

Posted 21 May 2005 - 02:01 AM

QUOTE (timmy2004 @ May 21 2005, 01:44)

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




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users