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

Externscripts for snack machines and snack machines in empty main scm


AlbertWesker
 Share

Recommended Posts

I was wondering if anybody knows this. I have a empty main scm, but i want cj to be able to eat and drink from the snack and drink machines located in sa. Does anybody knows which scripts i need from the original main scm to get this to work? Any help would be appreciated!

Link to comment
Share on other sites

4 hours ago, ZAZ said:

EXTERNAL_SCRIPT VENDING_MACHINE AT @VENDING

Thanks ZAZ, that's what i was thinking too, but when i do that my game freezes when i go to the vending machine in 24-7.

 

I added this to my script so far:

 

DEFINE EXTERNAL_SCRIPTS 1 // Use -1 in order not to compile AAA script
DEFINE SCRIPT VENDING_MACHINE AT @VENDING // 1

 

and at intial 1 i added:

 

 

0929: init_external_script_trigger 1 (VENDING_MACHINE) with_object_model #VENDMACHFD priority 100 radius 6.0 type -1 
0929: init_external_script_trigger 1 (VENDING_MACHINE) with_object_model #VENDMACH priority 100 radius 6.0 type -1 
0929: init_external_script_trigger 1 (VENDING_MACHINE) with_object_model #VENDIN3 priority 100 radius 6.0 type -1 
0929: init_external_script_trigger 1 (VENDING_MACHINE) with_object_model #CJ_SPRUNK1 priority 100 radius 6.0 type -1 
0929: init_external_script_trigger 1 (VENDING_MACHINE) with_object_model #CJ_CANDYVENDOR priority 100 radius 6.0 type -1 
0929: init_external_script_trigger 1 (VENDING_MACHINE) with_object_model #CJ_EXT_CANDY priority 100 radius 6.0 type -1 

 

And off course i added:

//-------------External script 1 (VENDING_MACHINE)---------------

:VENDING
script_name 'VENDING' 
[email protected] = 0 
if 
  [email protected] == 1 
jf @VENDING_80 
Object.Init([email protected], #VENDMACHFD, 0.0, 0.0, 0.0)
Object.Init([email protected], #KB_BEER, 0.0, 0.0, 0.0)

:VENDING_80
wait 0 
01BD: $CURRENT_TIME_IN_MS2 = current_time_in_ms 
if 
03CA:   object [email protected] exists 
jf @VENDING_1579 
if 
0977:   player_in_radius_of_object [email protected] external_script_trigger 
jf @VENDING_1484 
if 
   Player.Defined($PLAYER_CHAR)
jf @VENDING_1391 
if 
  [email protected] == 0 
jf @VENDING_173 
04ED: load_animation "VENDING" 
[email protected] += 1 

:VENDING_173
if 
  [email protected] == 1 
jf @VENDING_395 
if 
04EE:   animation "VENDING" loaded 
jf @VENDING_384 
0400: store_coords_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3 from_object [email protected] with_offset 0.0 -1.0 0.5 
if 
00FF:   actor $PLAYER_ACTOR sphere 0 in_sphere $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3 radius 0.6 0.6 1.0 on_foot 
jf @VENDING_377 
if or
   Object.Model([email protected]) == #VENDIN3
   Object.Model([email protected]) == #CJ_CANDYVENDOR
   Object.Model([email protected]) == #CJ_EXT_CANDY
jf @VENDING_343 
03CF: load_wav 42601 as 4 
0512: show_permanent_text_box 'SLOT_04'  // ~k~~VEHICLE_ENTER_EXIT~ Buy Snack: $1
jump @VENDING_363 

:VENDING_343
03CF: load_wav 42600 as 4 
0512: show_permanent_text_box 'SLOT_05'  // ~k~~VEHICLE_ENTER_EXIT~ Buy Drink: $1

:VENDING_363
07CC: set_player $PLAYER_CHAR can_enter_exit_vehicles 0 
[email protected] += 1 

:VENDING_377
jump @VENDING_395 

:VENDING_384
04ED: load_animation "VENDING" 

:VENDING_395
if 
  [email protected] == 2 
jf @VENDING_1210 
if 
04EE:   animation "VENDING" loaded 
jf @VENDING_1199 
0400: store_coords_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3 from_object [email protected] with_offset 0.0 -1.0 0.5 
if or
   Object.Model([email protected]) == #VENDIN3
   Object.Model([email protected]) == #CJ_CANDYVENDOR
   Object.Model([email protected]) == #CJ_EXT_CANDY
jf @VENDING_512 
03CF: load_wav 42601 as 4 
jump @VENDING_521 

:VENDING_512
03CF: load_wav 42600 as 4 

:VENDING_521
if 
00FF:   actor $PLAYER_ACTOR sphere 0 in_sphere $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3 radius 0.6 0.6 1.0 on_foot 
jf @VENDING_1176 
if 
00E1:   player 0 pressed_key 15 
jf @VENDING_1169 
if 
   Player.Controllable($PLAYER_CHAR)
jf @VENDING_1169 
if 
   Player.Money($PLAYER_CHAR) > 0
jf @VENDING_1141 
if 
03D0:   wav 4 loaded 
jf @VENDING_1134 
$TEMPVAR_ANGLE = Object.Angle([email protected])
0400: store_coords_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3 from_object [email protected] with_offset 0.0 -0.2 0.6 
Object.Init([email protected], #CJ_JUICE_CAN, $TEMPVAR_FLOAT_1, $TEMPVAR_FLOAT_2, $TEMPVAR_FLOAT_3)
$TEMPVAR_ANGLE = Object.Angle([email protected])
0615: define_AS_pack_begin $3395 
0400: store_coords_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3 from_object [email protected] with_offset 0.2 -1.0 0.0 
0804: AS_actor -1 walk_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3 angle $TEMPVAR_ANGLE radius 0.4 animation "VEND_USE" IFP_file "VENDING" 4.0 LA 0 LX 0 LY 0 LF 1 LT 0 
if or
   Object.Model([email protected]) == #VENDIN3
   Object.Model([email protected]) == #CJ_CANDYVENDOR
   Object.Model([email protected]) == #CJ_EXT_CANDY
jf @VENDING_859 
0A1A: actor -1 perform_walk_animation "VEND_EAT_P" IFP "VENDING" framedelta 4.0 loopA 0 lockX 0 lockY 0 lockF 0 -1 ms // versionC 
jump @VENDING_1001 

:VENDING_859
07E4: get_model #CJ_JUICE_CAN dimensions_cornerA_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3 dimensions_cornerB_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3 
$TEMPVAR_FLOAT_2 /= 2.0 
$TEMPVAR_FLOAT_2 += 0.027 
070A: AS_actor -1 attach_to_object [email protected] offset 0.062 $TEMPVAR_FLOAT_2 0.0 on_bone 5 16 perform_animation "VEND_USE_PT2" IFP_file "VENDING" time 0 
070A: AS_actor -1 attach_to_object [email protected] offset 0.062 $TEMPVAR_FLOAT_2 0.0 on_bone 5 16 perform_animation "VEND_DRINK2_P" IFP_file "VENDING" time 0 

:VENDING_1001
0616: define_AS_pack_end $3395 
0618: assign_actor $PLAYER_ACTOR to_AS_pack $3395 
061B: remove_references_to_AS_pack $3395 
Player.Money($PLAYER_CHAR) += -1
03E6: remove_text_box 
if or
   Object.Model([email protected]) == #VENDIN3
   Object.Model([email protected]) == #CJ_CANDYVENDOR
   Object.Model([email protected]) == #CJ_EXT_CANDY
jf @VENDING_1076 
03CF: load_wav 42601 as 4 
jump @VENDING_1085 

:VENDING_1076
03CF: load_wav 42600 as 4 

:VENDING_1085
if 
03D0:   wav 4 loaded 
jf @VENDING_1111 
0949: link_wav 4 to_actor $PLAYER_ACTOR 
03D1: play_wav 4 

:VENDING_1111
008B: [email protected] = $CURRENT_TIME_IN_MS2 // (int) 
[email protected] += 3000 
[email protected] += 1 

:VENDING_1134
jump @VENDING_1169 

:VENDING_1141
Actor.StorePos($PLAYER_ACTOR, $TEMPVAR_FLOAT_1, $TEMPVAR_FLOAT_2, $TEMPVAR_FLOAT_3)
018C: play_sound 1053 at $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3 

:VENDING_1169
jump @VENDING_1192 

:VENDING_1176
03E6: remove_text_box 
07CC: set_player $PLAYER_CHAR can_enter_exit_vehicles 1 
[email protected] = 1 

:VENDING_1192
jump @VENDING_1210 

:VENDING_1199
04ED: load_animation "VENDING" 

:VENDING_1210
if 
  [email protected] == 3 
jf @VENDING_1324 
062E: get_actor $PLAYER_ACTOR task 1560 status_store_to $416 // ret 7 if not found 
if 
04A3:   $416 == 7 // == constant 
jf @VENDING_1324 
0623: add 5 to_integer_stat 245 
$3396 = Actor.Health($PLAYER_ACTOR)
$3396 += 30 
Actor.Health($PLAYER_ACTOR) = $3396
Object.RemoveReferences([email protected])
03E6: remove_text_box 
07CC: set_player $PLAYER_CHAR can_enter_exit_vehicles 1 
008B: [email protected] = $CURRENT_TIME_IN_MS2 // (int) 
[email protected] += 1500 
[email protected] += 1 

:VENDING_1324
if 
  [email protected] == 4 
jf @VENDING_1384 
if 
001E:   $CURRENT_TIME_IN_MS2 > [email protected] // (int) 
jf @VENDING_1384 
0687: clear_actor $PLAYER_ACTOR task 
04EF: release_animation "VENDING" 
[email protected] = 0 

:VENDING_1384
jump @VENDING_1477 

:VENDING_1391
if 
  [email protected] > 0 
jf @VENDING_1477 
if 
  [email protected] > 1 
jf @VENDING_1436 
03E6: remove_text_box 
07CC: set_player $PLAYER_CHAR can_enter_exit_vehicles 1 

:VENDING_1436
if 
  [email protected] > 2 
jf @VENDING_1459 
Object.RemoveReferences([email protected])

:VENDING_1459
04EF: release_animation "VENDING" 
[email protected] = 0 

:VENDING_1477
jump @VENDING_1572 

:VENDING_1484
if 
  [email protected] > 0 
jf @VENDING_1570 
if 
  [email protected] > 1 
jf @VENDING_1529 
03E6: remove_text_box 
07CC: set_player $PLAYER_CHAR can_enter_exit_vehicles 1 

:VENDING_1529
if 
  [email protected] > 2 
jf @VENDING_1552 
Object.RemoveReferences([email protected])

:VENDING_1552
04EF: release_animation "VENDING" 
[email protected] = 0 

:VENDING_1570
terminate_this_script 

:VENDING_1572
jump @VENDING_1667 

:VENDING_1579
if 
  [email protected] > 0 
jf @VENDING_1665 
if 
  [email protected] > 1 
jf @VENDING_1624 
03E6: remove_text_box 
07CC: set_player $PLAYER_CHAR can_enter_exit_vehicles 1 

:VENDING_1624
if 
  [email protected] > 2 
jf @VENDING_1647 
Object.RemoveReferences([email protected])

:VENDING_1647
04EF: release_animation "VENDING" 
[email protected] = 0 

:VENDING_1665
terminate_this_script 

:VENDING_1667
jump @VENDING_80          
terminate_this_script 

 

Is there something i did wrong? Maybe i missed something.

 

 

Link to comment
Share on other sites

1 hour ago, ZAZ said:

first extern script = script number 0

 

DEFINE SCRIPT VENDING_MACHINE AT @VENDING // 0

 

so it should be

0929: init_external_script_trigger 0 (VENDING_MACHINE)

I changed it and it works perfectly now. Thanks for your help!

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.