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

Happy Holidays from the GTANet team!

Double a scrypt


Jack
 Share

Recommended Posts

For VC: Is it possible to double or even triple a scrypt using gosub and return commands, for example something like this:

 

:Gosubs  wait 0   gosub @1  gosub @2  gosub @3  jump @Gosubs  end_thread     :1  wait 0   Some vehicle follow player  jump @1  return     :2  wait 0   The same operation (like in :1)  jump @2  return     :3  wait 0   The same operation (like in :1)  jump @3  return 

 

The problem is that I didn't saw similar scrypt method anywhere in main.scm. I just woke up one morning and this idea crossed my mind, so I need someone to confirm that this is the correct method. I think that the first return from label :1 should go to the gosub @1, the second return from label :2 to gosub @2...So, em I right? Or maybe all of the return commands will slam into the "gosub @3" which would be a disaster? Maybe there's some better and easier method to make a huge number of the same evants in one scrypt without mixing themselves. And there's also a question of speed of the whole thing-What if I decide to make a much biger number of vehicles (like 15) to start follow a player? Will this kind of a scrypt be able to play all 15 events at the same time with a normal speed?

Link to comment
Share on other sites

Well, there's no reason why it would be possible. Your script will just be stuck in a loop in the first subroutine.

Link to comment
Share on other sites

I red this from coding tutorial:

 

:MS_GAME_BEEFYBARON 

$ONMISSION = 1 // integer values 

00BA: text_styled 'BEEFY' 1000 ms 2  // Beefy Baron 

gosub @SUB_FADE_500MS 

start_mission 10  // Beefy Baron 

jump @END_CASE_VIDEO_GAME     

 

:SUB_FADE_500MS 

0169: set_fade_color 0 0 0 

fade 0 500   

:LITCAS_282 

if 

fading 

else_jump @LITCAS_306 

wait 0  jump @LITCAS_282   

 

:LITCAS_306 

Return       

 

So it jumps with a "gosub" to ":SUB_FADE_500MS". When it reaches the "return" command (under ":LITCAS_306"), it goes back to the gosub. After the return, the code will continue with "start_mission 10").

So after my first return, "gosub @2" will be next operation. Also, I just tested this idea and I didn't noticed errors yet. Are you sure that it's not possible?

Link to comment
Share on other sites

sure,

when game will read the return it will start reading from where its Gosub was written,

but in your first script

you made a loop by using jump so it was impossible to read return for the game,

try this

 

:Gosubs       //labelwait 0                  gosub @1               jump @Gosubs  end_thread     // no need of it:1Some vehicle follow player   // do anything but don't jump to :gosubreturn     

 

Link to comment
Share on other sites

It's pretty hard to notice an error in this kind of a scrypt. I expeled the jump commands from 1, 2, 3 labels:

 

:Gosubs  wait 0   gosub @1  gosub @2  gosub @3  jump @Gosubs  end_thread     :1  wait 0   Some vehicle follow player  return     :2  wait 0  The same operation (like in :1)  return     :3  wait 0   The same operation (like in :1)  return 

 

and it seems fine in game. I hope you are all agree with Ashwin (that this scrypt structure should work now). If some of you think that something is still wrong then gimme the worst case scenario what will happen in game because finding these erros is not easy even when I start playing. Like Bad.boy! said-the evants in these labels are the same.

Also the main reason I started this topic is because I was hoping that maybe someone knows how to duplicate scrypt evants with some regular (already existed) method which was used in originaly main.scm file. But still, you helped a lot so thank you for your replies.

Edited by JACK JONES
Link to comment
Share on other sites

I'm sorry for double post but my scrypt (based on the idea from above) have some error. Besides that error everything works fine so please help me to find it. I tried to find it myself but without luck. Here's the problem:

The idea is that SWAT teams attack a player in VCPDHQ. If a player kill them all they'll recreate themselves in 5 seconds (only if they are all dead). When a plyer do all that for exactly 7 times, the game crashes in a moment when SWAT teams create themselves again (7th time of their creation). Maybe it has something to do with "Model.Destroy(#SOMETHING)" command but I'm not sure what. Please help, I can't find this error. Here's that scrypt:

 

:TACTEAM  thread 'SWAT'     :LOAD  wait 250   if and       Player.Defined($PLAYER_CHAR)       Player.WantedLevel($PLAYER_CHAR) > 3  0056:   player $PLAYER_CHAR 0 354.3227 -484.1484 380.0685 -475.388   else_jump @LOAD  Model.Load(#ENFORCER)  Model.Load(#SWAT)  Model.Load(#ARMY)  Model.Load(#M4)  Model.Load(#MP5LNG)  Model.Load(#TEC9)  038B: load_requested_models     :STUFF  wait 0   if and       Model.Available(#ENFORCER)       Model.Available(#SWAT)       Model.Available(#ARMY)       Model.Available(#M4)       Model.Available(#MP5LNG)       Model.Available(#TEC9)  else_jump @STUFF  020C: create_explosion_with_radius 11 at 395.982 -473.508 12.343    Camera.Shake(1000)[email protected] = Actor.Create(CivMale, #SWAT, 386.9318, -484.7817, 12.34322)  [email protected] = Actor.Create(CivMale, #SWAT, 388.7173, -482.7012, 12.34322)  [email protected] = Actor.Create(CivMale, #SWAT, 390.2015, -480.854, 12.34322)  [email protected] = Actor.Create(CivMale, #SWAT, 393.5883, -476.6203, 12.34322)  02AB: set_actor [email protected] immunities 0 1 0 0 0   02AB: set_actor [email protected] immunities 0 1 0 0 0   02AB: set_actor [email protected] immunities 0 1 0 0 0   02AB: set_actor [email protected] immunities 0 1 0 0 0   02A9: set_actor [email protected] immune_to_nonplayer 1   02A9: set_actor [email protected] immune_to_nonplayer 1   02A9: set_actor [email protected] immune_to_nonplayer 1   02A9: set_actor [email protected] immune_to_nonplayer 1   01B2: give_actor [email protected] weapon 25 ammo 9999 // Load the weapon model before using this   01B2: give_actor [email protected] weapon 25 ammo 9999 // Load the weapon model before using this   01B2: give_actor [email protected] weapon 25 ammo 9999 // Load the weapon model before using this   01B2:: give_actor [email protected] weapon 25 ammo 9999 // Load the weapon model before using this   02E2: set_actor [email protected] weapon_accuracy_to 10   02E2: set_actor [email protected] weapon_accuracy_to 10   02E2: set_actor [email protected] weapon_accuracy_to 10   02E2:: set_actor [email protected] weapon_accuracy_to 10   0502: unknown_actor [email protected] sprint_to 382.1172 -491.1101   0502: unknown_actor [email protected] sprint_to 381.8355 -488.5485   0502: unknown_actor [email protected] sprint_to 382.1172 -491.1101   0502: unknown_actor [email protected] sprint_to 381.8355 -488.5485   Model.Destroy(#ENFORCER)  Model.Destroy(#SWAT)  Model.Destroy(#ARMY)  Model.Destroy(#M4)  Model.Destroy(#MP5LNG)  Model.Destroy(#TEC9)    :GOSUBS  wait 0   if or       not Player.Wasted($PLAYER_CHAR)       Player.WantedLevel($PLAYER_CHAR) > 3  else_jump @SWAT_1756   gosub @SWAT_3  gosub @SWAT_4   gosub @SWAT_5  gosub @SWAT_6  jump @GOSUBS  end_thread     :SWAT_3  wait 0   if or  80ED:   not actor [email protected] 0 383.4081 -486.859 radius 0.4 0.4   80ED:   not actor [email protected] 0 387.024 -482.5168 radius 0.4 0.4   80ED:   not actor [email protected] 0 385.2087 -488.4312 radius 0.4 0.4   80ED:   not actor [email protected] 0 388.8536 -484.0807 radius 0.4 0.4   else_jump @SWAT_801   if   0123:   actor [email protected] spotted_player $PLAYER_CHAR   else_jump @SWAT_842   if        not Actor.Dead([email protected])  else_jump @SWAT_1680   01CA: actor [email protected] kill_player $PLAYER_CHAR   jump @SWAT_889     :SWAT_801  0502: unknown_actor [email protected] sprint_to 382.5863 -491.2727   if   8123:   not actor [email protected] spotted_player $PLAYER_CHAR   else_jump @SWAT_889   jump @SWAT_842     :SWAT_842  04C4: create_coordinate [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR offset 1.0 1.0 0.0   0502: unknown_actor [email protected] sprint_to [email protected] [email protected]   jump @SWAT_889     :SWAT_889  return     :SWAT_4  wait 0   if or  80ED:   not actor [email protected] 0 383.4081 -486.859 radius 0.4 0.4   80ED:   not actor [email protected] 0 387.024 -482.5168 radius 0.4 0.4   80ED:   not actor [email protected] 0 385.2087 -488.4312 radius 0.4 0.4   80ED:   not actor [email protected] 0 388.8536 -484.0807 radius 0.4 0.4   else_jump @SWAT_1064   if   0123:   actor [email protected] spotted_player $PLAYER_CHAR   else_jump @SWAT_1105   if        not Actor.Dead([email protected])  else_jump @SWAT_1680   01CA: actor [email protected] kill_player $PLAYER_CHAR   jump @SWAT_1152     :SWAT_1064  0502: unknown_actor [email protected] sprint_to 382.5863 -491.2727   if   8123:   not actor [email protected] spotted_player $PLAYER_CHAR   else_jump @SWAT_1152   jump @SWAT_1105     :SWAT_1105  04C4: create_coordinate [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR offset 1.0 1.0 0.0   0502: unknown_actor [email protected] sprint_to [email protected] [email protected]   jump @SWAT_1152     :SWAT_1152  return     :SWAT_5  wait 0   if or  80ED:   not actor [email protected] 0 383.4081 -486.859 radius 0.4 0.4   80ED:   not actor [email protected] 0 387.024 -482.5168 radius 0.4 0.4   80ED:   not actor [email protected] 0 385.2087 -488.4312 radius 0.4 0.4   80ED:   not actor [email protected] 0 388.8536 -484.0807 radius 0.4 0.4   else_jump @SWAT_1327   if   0123:   actor [email protected] spotted_player $PLAYER_CHAR   else_jump @SWAT_1368   if        not Actor.Dead([email protected])  else_jump @SWAT_1680   01CA: actor [email protected] kill_player $PLAYER_CHAR   jump @SWAT_1415     :SWAT_1327  0502: unknown_actor [email protected] sprint_to 382.5863 -491.2727   if   8123:   not actor [email protected] spotted_player $PLAYER_CHAR   else_jump @SWAT_1415   jump @SWAT_1368    :SWAT_1368  04C4: create_coordinate [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR offset 1.0 1.0 0.0   0502: unknown_actor [email protected] sprint_to [email protected] [email protected]   jump @SWAT_1415     :SWAT_1415  return     :SWAT_6  wait 0   if or  80ED:   not actor [email protected] 0 383.4081 -486.859 radius 0.4 0.4   80ED:   not actor [email protected] 0 387.024 -482.5168 radius 0.4 0.4   80ED:   not actor [email protected] 0 385.2087 -488.4312 radius 0.4 0.4   80ED:   not actor [email protected] 0 388.8536 -484.0807 radius 0.4 0.4   else_jump @SWAT_1590   if   0123:   actor [email protected] spotted_player $PLAYER_CHAR   else_jump @SWAT_1631   if        not Actor.Dead([email protected])  else_jump @SWAT_1680   01CA: actor [email protected] kill_player $PLAYER_CHAR   jump @SWAT_1678     :SWAT_1590  0502: unknown_actor [email protected] sprint_to 382.5863 -491.2727   if   8123:   not actor [email protected] spotted_player $PLAYER_CHAR   else_jump @SWAT_1678   jump @SWAT_1631     :SWAT_1631  04C4: create_coordinate [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR offset 1.0 1.0 0.0   0502: unknown_actor [email protected] sprint_to [email protected] [email protected]   jump @SWAT_1678     :SWAT_1678  return     :SWAT_1680  if        Actor.Dead([email protected])  else_jump @SWAT_889   if        Actor.Dead([email protected])  else_jump @SWAT_1152   if        Actor.Dead([email protected])  else_jump @SWAT_1415   if        Actor.Dead([email protected])  else_jump @SWAT_1678   wait 5000   jump @SWAT_1756     :SWAT_1756  Actor.DestroyInstantly([email protected])  Actor.DestroyInstantly([email protected])  Actor.DestroyInstantly([email protected])  Actor.DestroyInstantly([email protected])  jump @LOAD

 

Edited by JACK JONES
Link to comment
Share on other sites

 

:SWAT_1678  return    :SWAT_1680  if       Actor.Dead([email protected])  else_jump @SWAT_889 <--- bullsh*tif       Actor.Dead([email protected])  else_jump @SWAT_1152 <--- bullsh*t if       Actor.Dead([email protected])  else_jump @SWAT_1415 <--- bullsh*t if       Actor.Dead([email protected])  else_jump @SWAT_1678 <--- bullsh*t wait 5000  jump @SWAT_1756<--- bullsh*t    :SWAT_1756  Actor.DestroyInstantly([email protected])  Actor.DestroyInstantly([email protected])  Actor.DestroyInstantly([email protected])  Actor.DestroyInstantly([email protected])  jump @LOAD

 

these are jumps to previous labels above of the jumpinstruction

so these labels need a wait but they don't have any

SWAT_889, SWAT_1152, SWAT_1415, SWAT_1678

 

 

in addition is this scriptpart a part of a subscript and must end with return at the end

but it should jump to SWAT_1756 if all actors are dead

but the part of SWAT_1756 isn't a subscript, it jumps back instead to beginning

 

remove the actor dead check at that place and put it in your "GOSUB"-Loop

 

:GOSUBS  wait 0  if or     not Player.Wasted($PLAYER_CHAR)     Player.WantedLevel($PLAYER_CHAR) > 3  else_jump @SWAT_1756  gosub @SWAT_3  gosub @SWAT_4  gosub @SWAT_5  gosub @SWAT_6  if and      Actor.Dead([email protected])        Actor.Dead([email protected])        Actor.Dead([email protected])         Actor.Dead([email protected])else_jump @GOSUBSActor.DestroyInstantly([email protected])  Actor.DestroyInstantly([email protected])  Actor.DestroyInstantly([email protected])  Actor.DestroyInstantly([email protected])  jump @LOAD:SWAT_1678  return    :SWAT_1680  return:SWAT_1756  Actor.DestroyInstantly([email protected])  Actor.DestroyInstantly([email protected])  Actor.DestroyInstantly([email protected])  Actor.DestroyInstantly([email protected])  jump @LOAD

 

Edited by ZAZ
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.