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. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    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

altman

[WIP | SA | Thread] Air traffic mod

Recommended Posts

altman

Air Traffic Mod version 1.0 (25.06.07)

 

user posted image user posted image

 

Credits:

======================================

Original code by Jay-Rocc aka Altman

(http://westcoast-4-life.msk.ru)

Thanks to Demarest (co-author, I think)

Thanks to all Seemann for advices.

 

Mod features:

======================================

- This mod enables air traffic around all San Andreas between LS, SF and LV airports.

- The AT400 planes take off, fly in certain routes and landing in all three airports

- The flights are not dependent on player behaviour and have totally random timetable

- You can make air accident in any place of plane route smile.gif

- If you have paintjob compatible planes you can see them with different airlines artwork on boards

 

More features to come (in v2):

- Parked planes with different paintjobs

 

Installation:

======================================

Make backup of your /script/ folder!

Replace main.scm and script.img in /data/script folder

...or just insert code from SB code.txt to your scm file

 

DOWNLOAD MOD

Share this post


Link to post
Share on other sites
drozle

Great job COULD say,but...I am lol in coding so can you host .scm file.Please biggrin.gif

Share this post


Link to post
Share on other sites
altman

@drozle

 

For now it's not public release, I need to test and optimize code. The game could crash in case of plane accident. It never happened with me because of lack of air traffic but if I add new plane paths...

Share this post


Link to post
Share on other sites
Demarest
DOES ANYBODY REALLY KNOW HOW TO OPTIMIZE THIS CODE?

Because I know that this code is far from perfect.

Sure, but are you serious? Last guy that asked threw a hissy fit when I answered his call for optimization. From the beginning...

 

Nothing jumps to PLANEZZ23, so there's no reason to make a separate label there.

 

NEVER use DMA unless you know what you're doing and have to. Original code didn't use those vars, so I know you didn't have to. Besides, you're better off using locals anyways.

 

After you create the car from model 577 (?), you have a pair of waits. Neither are necessary.

 

Nothing jumps to PLANEZZ_01 except a failed path loaded check. An is loaded loop should never include the request inside the loop, so essentially nothing jumps to that label and therefore isn't needed.

 

Your is path 49 available is "upside down." By flipping it, you eliminate the need for the next label (and of course I've fixed the label it jumps back to to ONLY be the is loaded loop).

 

Once 49 is loaded, there is another wait that is not necessary. It's better to have too many than too little, but it's still good to get a feel for when you need it. With some of the stuff I've pulled off in Windshield, I think you'd be surprised at how much you do NOT need waits.

 

After you assign the car to the path, you have a wait 30000. That's 30 secons. A LOT can happen in 30 seconds, including the player dieing and returning here again. Better is using a local timer to check for 30 seconds elapsing AND constantly checking if the player is not defined or the car is wrecked. Because if either happens, it's safe to remove references to the car and reset the thread.

 

After that, you have a compound check that checks if car is wrecked AND a conditional that addresses the car. The whole point of having an is car wrecked check is to make sure that it's safe to talk to the engine about that car. Which means the check has to come BEFORE your other conditional, not at the same time. Your if operand was 0 anyways when you meant 1.

 

Since you had three long waits, the above two are true several times. When you impliment the right way, it gets considerably longer. I COULD compress this part down to be less than half as long. It would work the same, but the process might be confusing to newer coders. So I'll go without it and if you're interested in how I'd propose compressing it further, say so and I'll show you. If you're iffy, ask for it anyways as I think you'll be happy to see it smile.gif

 

You have a destroy car command AFTER removing references. When you command the engine to remove references to a car, you cannot refer to it any longer.

 

The release model command comes after you remove references to the car. This command should be used as soon as you no longer need the model loaded, which is right after it's created. Also, I didn't see a remove references or similar discarding of the path. I'll admit that I'm not terribly familiar with the paths. But you should double check existing code to make sure you don't need to. Otherwise, your code will stuff somebody's game up in time.

 

Finally, you have a couple commented out lines. No biggie, just if you're sharing code (especially in the showroom), you should probably clean that up first.

 

Put all of the above together, and this is what JUST THE FIRST THREAD would look like

:PLANEZ_403A4: name_thread 'PLANEZ2':PLANEZZ220001: wait  0 ms00D6: if  0 0256:   player $PLAYER_CHAR defined004D: jump_if_false ££PLANEZZ220247: request_model  577038B: load_requested_models:PLANEZZ240001: wait  0 ms00D6: if  00248:   model  577  available004D: jump_if_false ££PLANEZZ240395: clear_area  1 at -1626.0 -137.3 13.0 range  40.0 00A5: @0 = create_car  577 at  -1626.0 -137.3 13.00175: set_car @0 z_angle_to  1800209: @1 = random_int  0  306ED: set_car @0 paintjob  @10249: release_model 57707C0: request_path 49                 :PLANEZZ_2840001: wait  0 ms00D6: if  0 07C1:    path 49 available004D: jump_if_false ££PLANEZZ_28400D6: if  0 8119:   NOT   car @0 wrecked004D: jump_if_false ££PLANEZZ_30605EB: assign_vehicle @0 to_path 490006: @32 =  0:PLANEZZ_3050001: wait  500 ms00D6: if  10256:   player $PLAYER_CHAR defined8119:   NOT   car @0 wrecked004D: jump_if_false ££PLANEZZ_30600D6: if  00019:   @32 >  30000004D: jump_if_false ££PLANEZZ_30500D6: if  0860E:   NOT   car @0 is_assigned_to_existing_path  004D: jump_if_false ££PLANEZZ_30608E6: set_plane @0 landing_gear  10006: @32 =  0:PLANEZZ_305B0001: wait  500 ms00D6: if  10256:   player $PLAYER_CHAR defined8119:   NOT   car @0 wrecked004D: jump_if_false ££PLANEZZ_30600D6: if  00019:   @32 >  90000004D: jump_if_false ££PLANEZZ_305B00D6: if  0860E:   NOT   car @0 is_assigned_to_existing_path 004D: jump_if_false ££PLANEZZ_30608E6: set_plane @0 landing_gear  00006: @32 =  0:PLANEZZ_305C0001: wait  500 ms00D6: if  10256:   player $PLAYER_CHAR defined8119:   NOT   car @0 wrecked004D: jump_if_false ££PLANEZZ_30600D6: if  00019:   @32 >  30000004D: jump_if_false ££PLANEZZ_305C         :PLANEZZ_30601C3: remove_references_to_car @00002: jump ££PLANEZ_4

 

You PROBABLY could (and should) make it all one thread. But since your intervals are different, it would be no easy task. Just keep in mind that using more threads than you need to can be dangerous, especially for people who like using multiple mods together (and they all overthread this way).

 

If you have any questions about why this or why that or you'd like me to revise the above with the three local timer loops consolidated, let me know smile.gif

Share this post


Link to post
Share on other sites
SteaVor

Just wanted to mention that 038B (load_requested_models) is a NOP in SA (you do need it for III/VC coding though), 0247 could therefore be called request_and_load_model.

Edited by SteaVor

Share this post


Link to post
Share on other sites
altman

@Demarest

Oh, thanks that amazing! These advices helps me so much to understand basics of coding.

I have few questions to you:

1. Is it possible to make time check (timetable) for running airport script to prevent airplane crashing on the same airfield stripe.

2. I have no idea how to make more than 1 flight wo copy/paste main part of the script. If it possible can you give me advice about this technique or example?

Thanks a lot!

Share this post


Link to post
Share on other sites
Hollaz

This mod is cool.. but can you follow or destroy the airplanes?

 

Just wondering!

 

alien.gif

Share this post


Link to post
Share on other sites
Demarest

Hmmm. I'm not sure I understand your question. If your first question has to do with your scripted planes colliding with planes that already exist (moving around), I have no idea. I don't think the SCM has anything to do with the generic plane traffic.

 

As for your second question, I don't understand. If I'm reading the code correctly, this is something that repeats every 2.5 minutes. What were you looking to accomplish?

Share this post


Link to post
Share on other sites
altman

@Demarest

1. I mean do you know is it possible to make flights timetable that can be created with time checking. In my first message I have time checking code, but I can't get it work. Was it mistaken?

 

2. For the second question:

I mean I have this script only for one flight, and If I need to make another route I need to copy the code and rename variables, so I will have the same doubled code except vars, coords and path names. I have no Idea how to shrink code to prevent copying same part for the script for every route. Is it possible?

 

Thanks.

 

@Hollaz

Yes, you can follow or destroy planes

Share this post


Link to post
Share on other sites
Blackadder.

Woah! Nice mod, can you get in the planes? or are they just for show?

 

Either way, good job icon14.gif I'll be sure to try this out some time.

Share this post


Link to post
Share on other sites
altman

Some of them will be placed around airports and you can get in.

Share this post


Link to post
Share on other sites
Demarest

@Demarest

1. I mean do you know is it possible to make flights timetable that can be created with time checking. In my first message I have time checking code, but I can't get it work. Was it mistaken?

It's inefficient. Mostly in ways that I've already covered. One way I did not: The MAIN thread already establishes $WEEKDAY, $TIME_HOURS, and $TIME_MINS and it stores them into global vars, meaning any thread has access to them. You don't need your mod to establish them again. Put that together with the tips I gave above and you should have something like
:PLANE_DAYCHECK0001: wait  0 ms00D6: if  210038:   $WEEKDAY ==  6;; integer values0038:   $WEEKDAY ==  7;; integer values004D: jump_if_false ££PLANE_NONWEEKEND00D6: if  210038:   $TIME_HOURS ==  7;; integer values0038:   $TIME_HOURS ==  11;; integer values004D: jump_if_false ££PLANE_DAYCHECK00BA: text_styled 'BEEFY'  2000 ms  2; Beefy Baron (whatever code you put here will run when it's 7 or 11 on days 6 and 7. I don't think there even is a day 7 because computers begin counting at 0)0002: jump ££PLANE_DAYCHECK:PLANE_NONWEEKEND00D6: if  210038:   $TIME_HOURS ==  8;; integer values0038:   $TIME_HOURS ==  10;; integer values004D: jump_if_false ££PLANE_DAYCHECK00BA: text_styled 'DRV3_9'  2000 ms  2; ~r~One of the packages was destroyed! (whatever code you put here will run when it's 8 or 10 on days 0-5)0002: jump ££PLANE_DAYCHECK

Please note that in addition to consolidation, I removed lines you had appearing after jump commands, such as return and end_thread. A jump commands jumps, so any code after it will never be run and is therefor added weight.

 

 

2. For the second question:

I mean I have this script only for one flight, and If I need to make another route I need to copy the code and rename variables

You will not need to rename variables. I STRONGLY urge you to read the MB readme again (don't feel bad; it's a file the people should return to many times because it's so much information, each read is bound to teach you more) to re-familiarize yourself with variables and the differences between local and global. If you do this and are still confused, PM me and maybe I can help clear it up for you. The point here is that if you copy pasted the code I posted, all you'd need to change is the label names. And since your threads had different time amounts, you'd need to change those as well. The fact that it will be a different thread altogether means that the locals used in it will not overlap with the locals used by other threads. Search original code and you will find that @0 and @34 for example can be found in MANY threads.

 

 

I have no Idea how to shrink code to prevent copying same part for the script for every route. Is it possible?
I don't know what you're asking here. If you're asking how I would compress the code further by consolidating the three local timer checks, here's what it would look like
:PLANEZ_403A4: name_thread 'PLANEZ2':PLANEZZ220001: wait  0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££PLANEZZ220247: request_model  577038B: load_requested_models:PLANEZZ240001: wait  0 ms00D6: if  00248:   model  577  available004D: jump_if_false ££PLANEZZ240395: clear_area  1 at -1626.0 -137.3 13.0 range  40.000A5: @0 = create_car  577 at  -1626.0 -137.3 13.00175: set_car @0 z_angle_to  1800209: @1 = random_int  0  306ED: set_car @0 paintjob  @10249: release_model 57707C0: request_path 49              :PLANEZZ_2840001: wait  0 ms00D6: if  007C1:    path 49 available004D: jump_if_false ££PLANEZZ_28400D6: if  08119:   NOT   car @0 wrecked004D: jump_if_false ££PLANEZZ_30605EB: assign_vehicle @0 to_path 490006: @2 =  2:PLANEZZ_3050006: @32 =  0:PLANEZZ_305B0001: wait  500 ms00D6: if  10256:   player $PLAYER_CHAR defined8119:   NOT   car @0 wrecked004D: jump_if_false ££PLANEZZ_30600D6: if  00019:   @32 >  30000004D: jump_if_false ££PLANEZZ_305B00D6: if  218039:   NOT   @2 ==  10019:   @32 >  90000004D: jump_if_false ££PLANEZZ_305B00D6: if  0860E:   NOT   car @0 is_assigned_to_existing_path  004D: jump_if_false ££PLANEZZ_306000E: @2 -=  100D6: if  08039:   NOT   @2 ==  -1004D: jump_if_false ££PLANEZZ_30608E6: set_plane @0 landing_gear  @20002: jump ££PLANEZZ_305:PLANEZZ_30601C3: remove_references_to_car @00002: jump ££PLANEZ_4

This is made possible by the fact that you call for landing gear in a reverse sequential order, so I used a var to signify this. The code would be even shorter except you had the middle time to be 90 seconds instead of 30, so some code had to be tossed in to make sure that exception was addressed.

 

Now if instead you meant making it smaller by having one thread instead of three, that would get to be quite complicated. So much so that you're better off using multiple threads and just walking away with the knowledge that multiple threads should be avoided to possibly help you make future mods leaner. If you use time tables instead of differing time increments, then combining them into one thread will likely be easier and shorter to the point of being realistic.

 

As always, any questions, fire away smile.gif

Share this post


Link to post
Share on other sites
altman

 

Please note that in addition to consolidation, I removed lines you had appearing after jump commands, such as return and end_thread. A jump commands jumps, so any code after it will never be run and is therefor added weight.

hmm, interesting, I found this example in original game code...

 

 

You will not need to rename variables. I STRONGLY urge you to read the MB readme again (don't feel bad; it's a file the people should return to many times because it's so much information, each read is bound to teach you more) to re-familiarize yourself with variables and the differences between local and global. If you do this and are still confused, PM me and maybe I can help clear it up for you. The point here is that if you copy pasted the code I posted, all you'd need to change is the label names. And since your threads had different time amounts, you'd need to change those as well. The fact that it will be a different thread altogether means that the locals used in it will not overlap with the locals used by other threads. Search original code and you will find that @0 and @34 for example can be found in MANY threads.

Yeah, I understand that label names should be renamed. But can we put this code one time, instead of 6(number of flights) times?:

 

 

:PLANEZ230247: request_model  577038B: load_requested_models:PLANEZ240001: wait  0 ms00D6: if  00248:   model  577  available004D: jump_if_false ££PLANEZ240395: clear_area  1 at 1577.298 -2493.749 13.5895 range  40.000A5: $11479 = create_car  577 at  1577.298 -2493.749 13.58950175: set_car $11479 z_angle_to  1800209: $11480 = random_int  0  306ED: set_car $11479 paintjob  $114800001: wait  0 ms

 

Edited by altman

Share this post


Link to post
Share on other sites
Demarest

hmm, interesting, I found this example in original game code...
Oh I know. I wasn't judging you. Just letting you know. I imagine the reason you see such fat in R*'s code is because their code is the product of MANY people working on the same code for an extended period of time. What you see is section markers they never cleared out when they were finished. Which is a shame because it happens so much more in SA (being larger) and SA has a much lower ceiling compared to the original code than the other games. So it just makes modders hit the ceiling a WHOLE lot faster than they need to. Last summer, I started writing TTSA. As I fingered through R*'s code, I was astounded at how dirty their code is. You wouldn't believe how far I've been able to compress some of their work because I was one person looking at the finished product instead of a team of people working together to make it from scratch.

 

 

Yeah, I understand that label names should be renamed. But can we put this code one time, instead of 6(number of flights) times?:
Well not THAT code because it contains DMA globals when locals will suffice. If you're asking if you need to load the model six times, I'm afraid so. One of the many advantages to having one thread instead of six is not having to make this call six times. Report back to me if my cleanup of your timing code helped you reach your goal of timed flights any better. If so, it will be that much more possible to get this all into one thread.

Share this post


Link to post
Share on other sites
evilrex

Great mod, I would love to see different types of aeroplanes land/take off at the airports, is this possible?

Share this post


Link to post
Share on other sites
SteaVor

Of course, you'd just have to change which model is used for the plane (in the mod it's always 577, but that can be changed/randomized of course).

Share this post


Link to post
Share on other sites
altman

@Demarest

 

I have an idea about combining of all flight routes in 1 thread to prevent duplicating code.

1. First I should create 6 separate threads. In every thread I will create hour and day checking. (I need separate threads to make hours checking for all flights in same time)

2. If script values and hours in game are congruent we will jump to the next label where we set local variables of coords, path number, plane var, etc.

3. Then we jump to part of the script, where plane will spawn. This part of the script is the same for all 6 threads.

The main idea of my method to set different values (coords, path, etc) for different flights, but execute the same script for plane spawning. I hope you understand what I mean, otherwise I draw basic sketch for you.

Edited by altman

Share this post


Link to post
Share on other sites
Demarest

Have you considered simplifying your approach? Based on the topic title, I'm guessing you made this to add random air traffic into the skies, eh? If so, why not make it RANDOM? Like say the thread starts and selects a random number of one through six. That will determine which flight is taking place right now. Put that one through its paces. When all is said and done, random one through six and repeat the process. Or you could have once an hour on the hour select a random one to six. And so on. The complexity in smashing it into one thread is that you're having the one thread monitor/direct all six flights at the same time. What I'm suggesting would be easier to write and the end result would be more random in game. Of course, this is only a good idea if I actually grasp your intent. If not, let me know.

 

Otherwise, you might have to get into strobe coding. R* did this a lot in SA. It's an approach whereby the thread is literally checking all bases one right after another. "Where's plane one? Oh, there is no plane one? Create it and send her on her way. Where's plane two? In flight? Very well. Where's plane three? Approaching its destination? Better extend the landing gear..." and so on. Not too hard, but a BIG undertaking. Which means a large potential for mistakes. But the end result would be a jammed airway and you having full control of all flights at all times.

Share this post


Link to post
Share on other sites
altman

 

Have you considered simplifying your approach? Based on the topic title, I'm guessing you made this to add random air traffic into the skies, eh? If so, why not make it RANDOM? Like say the thread starts and selects a random number of one through six. That will determine which flight is taking place right now. Put that one through its paces. When all is said and done, random one through six and repeat the process. Or you could have once an hour on the hour select a random one to six. And so on. The complexity in smashing it into one thread is that you're having the one thread monitor/direct all six flights at the same time. What I'm suggesting would be easier to write and the end result would be more random in game. Of course, this is only a good idea if I actually grasp your intent. If not, let me know.

 

I want to see more than 1 plane flying in same time, but I don't want to make planes crashing. But in this case you can see only one plane flying. I like your way, but how i can prevent airplane accidents?

Edited by altman

Share this post


Link to post
Share on other sites
Demarest
Well "my way" only has one at a time, so there'd be no accidents. Besides, what's wrong with accidents? Are you sure the path to and from LS and SF for example are on top of one another? In the original game, a plane randomly biting it is hilarious (as long as you're not at ground zero at the time). But if you insist on no accidents and are certain a path and return path would cause such a collision, then I guess the answer would be only have one plane in-between any two island at one time.

Share this post


Link to post
Share on other sites
pinky

I am starting on a similar mod myself and didn't realise someone had started an aircraft pattern mod till I checket out in here.

My take on it to reduce accidents would be to take a realistic approuch and handle the aircraft similar to air traffic control, assign them different routes and alltitudes to reduce collisions.

Personally I would only use the Nevada for local flights between airports, including using this for the airline tickets, and use the larger AT400s for outgoing and incoming International flights. More realistic as the AT400 is a bit large to fly around inland in a place as small as SA.

The ATs I would spawn out to sea and have them fly into and then leave the airport heading back out to sea, the vehicle then being destroyed or released as being no longer needed.

You could then fine tune the spawning times to remove/reduce air collisions between ATs and or Nevadas at airports.

Again you could introduce further domestic or pleasure flights at different altitudes and areas to add more diversity.

I would be tempted to either create randomly or script an occaisional air crash and maybe have search rescue helis on arriving on scene. That should keep the rubberneckers happy.

 

Be a while before I do any actuall air traffic programming as I am side tracked on creating dogfights and ped AI for fighting back when an aircraft is shot at and bailing out when it is near destroyed.

 

On a side note, the game seems to handle at least 12 AI aircraft trying to destroy you at the same time so in theory at least 12 aircraft running in game(not including your own) is possible without a glitch.

 

Quick question too.

Is there an op code to bring the gear up smoothly?

I can only get it to jump from up or down position with no animation in between, a small detail that annoys me a little.

Share this post


Link to post
Share on other sites
altman

@Demarest

Here the update of the script. I tried to randomize all 7 flights. But for now (i can't understand why) the planes won't wait until prev. flight is over.

Another fault that the references of the planes always removed after ~1 minute of flight and the plane fall down on the oil refinery near ocean docks. I can't understand why it happen. Is it possible to trigger this script run one flight each other. not in same time?

 

 

:PLANEZ_103A4: name_thread 'PLANEZ' :PLANEZ_20001: wait  0 ms00D6: if  0 0256:   player $PLAYER_CHAR defined004D: jump_if_false ££PLANEZ_2 0209: @3 = random_int  0  6 0871: init_jump_table @3 total_jumps  7  0 ££PLANEZ_8 jumps  0 ££PLANEZ_8  1 ££PLANEZ_17  2 ££PLANEZ_26  3 ££PLANEZ_35  4 ££PLANEZ_44  5 ££PLANEZ_53  6 ££PLANEZ_62 :PLANEZ_80007: @4 =  1577.298;; floating-point values0007: @5 = -2493.749;; floating-point values0007: @6 =  13.5895;; floating-point values0006: @7 =  270;; integer values0006: @8 =  42;; integer values0006: @9 =  30000;; integer values0006: @10 =  160000;; integer values00BA: text_styled 'CRASH_1'  1000 ms  2 ; Burning Desire0002: jump ££PLANEZ_71 :PLANEZ_170007: @4 = -1626.0;; floating-point values0007: @5 = -137.3;; floating-point values0007: @6 =  13.0;; floating-point values0006: @7 =  180;; integer values0006: @8 =  49;; integer values0006: @9 =  30000;; integer values0006: @10 =  90000;; integer values00BA: text_styled 'RYDER_1'  1000 ms  2 ; Home Invasion0002: jump ££PLANEZ_71 :PLANEZ_260007: @4 =  1577.298;; floating-point values0007: @5 = -2493.749;; floating-point values0007: @6 =  13.5895;; floating-point values0006: @7 =  270;; integer values0006: @8 =  46;; integer values0006: @9 =  30000;; integer values0006: @10 =  110000;; integer values00BA: text_styled 'RYDER_3'  1000 ms  2 ; Catalyst0002: jump ££PLANEZ_71 :PLANEZ_350007: @4 =  1473.33;; floating-point values0007: @5 = -2600.0;; floating-point values0007: @6 =  13.5895;; floating-point values0006: @7 =  270;; integer values0006: @8 =  41;; integer values0006: @9 =  30000;; integer values0006: @10 =  140000;; integer values00BA: text_styled 'RYDER_2'  1000 ms  2 ; Robbing Uncle Sam0002: jump ££PLANEZ_71 :PLANEZ_440007: @4 =  1577.298;; floating-point values0007: @5 = -2493.749;; floating-point values0007: @6 =  13.5895;; floating-point values0006: @7 =  270;; integer values0006: @8 =  42;; integer values0006: @9 =  30000;; integer values0006: @10 =  160000;; integer values00BA: text_styled 'SMOKE_1'  1000 ms  2 ; OG Loc0002: jump ££PLANEZ_71 :PLANEZ_530007: @4 =  1577.298;; floating-point values0007: @5 = -2493.749;; floating-point values0007: @6 =  13.5895;; floating-point values0006: @7 =  270;; integer values0006: @8 =  42;; integer values0006: @9 =  30000;; integer values0006: @10 =  160000;; integer values00BA: text_styled 'SMOKE_2'  1000 ms  2 ; Running Dog0002: jump ££PLANEZ_71 :PLANEZ_620007: @4 =  1577.298;; floating-point values0007: @5 = -2493.749;; floating-point values0007: @6 =  13.5895;; floating-point values0006: @7 =  270;; integer values0006: @8 =  42;; integer values0006: @9 =  30000;; integer values0006: @10 =  160000;; integer values00BA: text_styled 'SMOKE_4'  1000 ms  2 ; Just Business0002: jump ££PLANEZ_71 :PLANEZ_710001: wait  0 ms00D6: if  0 0256:   player $PLAYER_CHAR defined004D: jump_if_false ££PLANEZ_2 0247: request_model #AT400 038B: load_requested_models:PLANEZ_770001: wait  0 ms00D6: if  0 0248:   model #AT400 available004D: jump_if_false ££PLANEZ_77 0395: clear_area  1 at @4 @5 @6 range  40.0 00A5: @0 = create_vehicle #AT400 at @4 @5 @6;; Load the vehicle model before using this0175: set_car @0 z_angle_to @7 0209: @1 = random_int  0  3 06ED: set_car @0 paintjob @1 0249: release_model #AT400 07C0: request_path @8 :PLANEZ_880001: wait  0 ms00D6: if  0 07C1:   path @8 available004D: jump_if_false ££PLANEZ_88 00D6: if  0 8119:   NOT   car @0 wrecked004D: jump_if_false ££PLANEZ_119 05EB: assign_vehicle @0 to_path @8 0006: @2 =  2;; integer values:PLANEZ_970006: @32 =  0;; integer values:PLANEZ_980001: wait  500 ms00D6: if  1 0256:   player $PLAYER_CHAR defined8119:   NOT   car @0 wrecked004D: jump_if_false ££PLANEZ_119 00D6: if  0 001D:   @32 > @9;; integer values  004D: jump_if_false ££PLANEZ_98 00D6: if  21 8039:   NOT   @2 ==  1;; integer values001D:   @32 > @10;; integer values  004D: jump_if_false ££PLANEZ_98 00D6: if  0 860E:   NOT   car @0 is_assigned_to_existing_path004D: jump_if_false ££PLANEZ_119 000E: @2 -=  1;; integer values00D6: if  0 8039:   NOT   @2 == -1;; integer values004D: jump_if_false ££PLANEZ_119 08E6: set_plane @0 landing_gear @2 0002: jump ££PLANEZ_97 :PLANEZ_11901C3: remove_references_to_car @0;; Like turning a car into any random car0002: jump ££PLANEZ_1

 

Share this post


Link to post
Share on other sites
pinky

Possibly add pilots to the planes using opcode 0129: (after requesting models of course).

 

0129: $Vent1pilot = create_actor_pedtype 5 model #FBI in_car $Venturas1 driverseat

 

NOTE: Sanny builder code.

This may stop them crashing but I suspect they will just turn into random vehicles judging by the previous crashing behaviour.

Share this post


Link to post
Share on other sites
Demarest
But for now (i can't understand why) the planes won't wait until prev. flight is over.

Another fault that the references of the planes always removed after ~1 minute of flight and the plane fall down on the oil refinery near ocean docks.

Perhaps they're connected. If for whatever reason, the code executes the remove references to command, that would cause it to spawn the next one and for the last one to maybe just drop out of the sky. If I'm correct, that would me fixing one "problem" would solve both symptoms. The trick is to figure out if it's running remove references too soon and if so, why. Maybe toss in another on screen text command there to see when it is being run.

 

Your approach here is really good. I hope you don't mind more constructive criticism to help you get even better. As you probably know, this mod doesn't actually need any if player defined checks. I'm guessing you probably kept them in so that the mod will reset when busted/wasted. But really, this isn't necessary as it's supposed to be totally random anyways. If you want to keep them in, there's still one point you can take it out of. In PLANEZ_71, if you take out the wait there (as it's not needed), you would no longer need to check if player defined again since there's been no wait since the last check. Also, just before PLANEZ_71 is a command to jump to it, which can be removed.

 

Since @9 always equals 30000, you can remove all lines that set it and then just change the one line that checks against it to check against 30000 instead. Don't forget to change the opcode too since you're no longer comparing one local to another. Also, you might as well load the model and the path at the same time. This would save some space as well as the need to check if it's wrecked before assigning it to the path.

Share this post


Link to post
Share on other sites
altman

@Pinky

I use default plane paths to make smooth take off and landing, of course planes keep their way on different paths to prevent crashing in air. The only place, where accidents may happen is airfield strip.

I'll make pilots soon, thanks for advice.

 

@Demarest

Interesting situation with code:

 

:PLANEZ_103A4: name_thread 'PLANEZ' 0001: wait  0 ms0209: @3 = random_int  0  6 0871: init_jump_table @3 total_jumps  7  0 ££PLANEZ_5 jumps  0 ££PLANEZ_5  1 ££PLANEZ_13  2 ££PLANEZ_21  3 ££PLANEZ_29  4 ££PLANEZ_37  5 ££PLANEZ_45  6 ££PLANEZ_53 :PLANEZ_50007: @4 =  1577.298;; floating-point values0007: @5 = -2493.749;; floating-point values0007: @6 =  13.5895;; floating-point values0006: @7 =  270;; integer values0006: @8 =  42;; integer values0006: @10 =  160000;; integer values0002: jump ££PLANEZ_61 :PLANEZ_130007: @4 = -1626.0;; floating-point values0007: @5 = -137.3;; floating-point values0007: @6 =  13.0;; floating-point values0006: @7 =  180;; integer values0006: @8 =  49;; integer values0006: @10 =  90000;; integer values0002: jump ££PLANEZ_61 :PLANEZ_210007: @4 =  1577.298;; floating-point values0007: @5 = -2493.749;; floating-point values0007: @6 =  13.5895;; floating-point values0006: @7 =  270;; integer values0006: @8 =  46;; integer values0006: @10 =  110000;; integer values0002: jump ££PLANEZ_61 :PLANEZ_290007: @4 =  1473.33;; floating-point values0007: @5 = -2600.0;; floating-point values0007: @6 =  13.5895;; floating-point values0006: @7 =  270;; integer values0006: @8 =  41;; integer values0006: @10 =  140000;; integer values0002: jump ££PLANEZ_61 :PLANEZ_370007: @4 =  1577.298;; floating-point values0007: @5 = -2493.749;; floating-point values0007: @6 =  13.5895;; floating-point values0006: @7 =  270;; integer values0006: @8 =  42;; integer values0006: @10 =  160000;; integer values0002: jump ££PLANEZ_61 :PLANEZ_450007: @4 =  1577.298;; floating-point values0007: @5 = -2493.749;; floating-point values0007: @6 =  13.5895;; floating-point values0006: @7 =  270;; integer values0006: @8 =  42;; integer values0006: @10 =  160000;; integer values0002: jump ££PLANEZ_61 :PLANEZ_530007: @4 =  1577.298;; floating-point values0007: @5 = -2493.749;; floating-point values0007: @6 =  13.5895;; floating-point values0006: @7 =  270;; integer values0006: @8 =  42;; integer values0006: @10 =  160000;; integer values :PLANEZ_610001: wait  0 ms0247: request_model #AT400 038B: load_requested_models:PLANEZ_640001: wait  0 ms00D6: if  0 0248:   model #AT400 available004D: jump_if_false ££PLANEZ_64 0395: clear_area  1 at @4 @5 @6 range  40.0 00A5: @0 = create_vehicle #AT400 at @4 @5 @6;; Load the vehicle model before using this0175: set_car @0 z_angle_to @7 0209: @1 = random_int  0  3 06ED: set_car @0 paintjob @1 0249: release_model #AT400 07C0: request_path @8 :PLANEZ_750001: wait  0 ms00D6: if  0 07C1:   path @8 available004D: jump_if_false ££PLANEZ_75 00D6: if  0 8119:   NOT   car @0 wrecked004D: jump_if_false ££PLANEZ_111 05EB: assign_vehicle @0 to_path @8 0006: @2 =  2;; integer values:PLANEZ_840006: @32 =  0;; integer values:PLANEZ_850001: wait  500 ms00D6: if  0 8119:   NOT   car @0 wrecked004D: jump_if_false ££PLANEZ_111 [b]00BA: text_styled 'CRASH_1'  1000 ms  2 ; Burning Desire[/b] - I see only this blinking text for ~30 secs, then the airplane removes(?) from path and fall down on refinery. May be its problem place, but I can't find an error?00D6: if  0 0019:   @32 >  30000;; integer values004D: jump_if_false ££PLANEZ_85 00BA: text_styled 'RYDER_1'  1000 ms  2 ; Home Invasion00D6: if  21 8039:   NOT   @2 ==  1;; integer values0019:   @32 >  150000;; integer values (For test I set up constant flying time - 150000)004D: jump_if_false ££PLANEZ_85 00BA: text_styled 'RYDER_3'  1000 ms  2 ; Catalyst00D6: if  0 860E:   NOT   car @0 is_assigned_to_existing_path004D: jump_if_false ££PLANEZ_111 00BA: text_styled 'RYDER_2'  1000 ms  2 ; Robbing Uncle Sam000E: @2 -=  1;; integer values00D6: if  0 8039:   NOT   @2 == -1;; integer values004D: jump_if_false ££PLANEZ_111 00BA: text_styled 'SMOKE_1'  1000 ms  2 ; OG Loc08E6: set_plane @0 landing_gear @2 00BA: text_styled 'SMOKE_2'  1000 ms  2 ; Running Dog0002: jump ££PLANEZ_84 :PLANEZ_11100BA: text_styled 'SMOKE_4'  1000 ms  2 ; Just Business -------------> I never saw this text01C3: remove_references_to_car @0;; Like turning a car into any random car0002: jump ££PLANEZ_1 

 

 

and of course I cleaned up code.

Share this post


Link to post
Share on other sites
Demarest

The first two waits in that code aren't necessary. You can still combine the loading of the model and the path. Also, I only just noticed that your jump table uses all seven jumps when you only have six different flight paths. You can save even more space by killing the 7th set, lowering the random high value by one, and just making the final jump in the table dead end just as R* did when they didn't need all the jumps.

 

The fact that the text that SHOULD show up with the remove_references command is quite confusing. It would be different if any of your JF's pointed to before the loop, but none of them do. I'm wondering if it might have something to do with the fact that all your texts have a time of 1000, but the wait in the loop is only 500. This means that when all conditions are met, it would be displaying a few texts all at once. Maybe it IS showing and you're just not seeing it because it's being flooded. Maybe establish a global var and set it as some on screen numeral (like cash/time in the Trucking missions) and then have each section change the value of that number. If you do that, maybe also add a wait a few seconds after the remove reference command so you don't miss it.

 

That's all I can help right now. Reason is because I could say that since it's 30 seconds, perhaps it's something AFTER then is > 30 seconds command. We know this isn't the case because it would either loop back and display it again (which is isn't) or it would break out of the loop and remove_references and reset. Which as of this second, you don't believe is happening. If you follow my above advice and you find that remove references IS running, then that means that the checks after is > 30 seconds is being satisfied before you wish it to be. Though at first glance, everything seems alright. Let me know.

 

Also, as an aside, would you mind telling me how you're monitoring this ingame?

Share this post


Link to post
Share on other sites
pinky
@Pinky

I use default plane paths to make smooth take off and landing, of course planes keep their way on different paths to prevent crashing in air. The only place, where accidents may happen is airfield strip.

I'll make pilots soon, thanks for advice.

I was beginning to figure the path thing out myself, I have noticed planes don't like to take off on a set course alone from runways. Fast planes are a real problem because they veer into the side buildings.

 

Shaping up to be a nice mod. smile.gif

Share this post


Link to post
Share on other sites
altman

I solve this sh*tty problem with script, it was just an error in "is vehicle assigned to path" opcode. For now everything works perfect. There are 7 destinations around state. Also I've added pilots in cockpit. The code in SB.

 

 

create_thread @PLANEZ0//------------------- Planes ---------------------------------:PLANEZ0thread 'PLANEZ':PLANEINIT_298wait 00209: [email protected] = random_int 0 7 0871: init_jump_table [email protected] total_jumps 7 0 @PLANEINIT_299 jumps 0 @PLANEINIT_299 1 @PLANEINIT_320 2 @PLANEINIT_341 3 @PLANEINIT_363 4 @PLANEINIT_385 5 @PLANEINIT_407 6 @PLANEINIT_429 :[email protected] = 1473.33 // integer values [email protected] = -2600.0 // integer values            [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 13.0822jump @PLANEZ1 :PLANEINIT_320    [email protected] = 1577.298 // integer values [email protected] = -2493.749 // integer [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 13.0822jump @PLANEZ1 :[email protected] = 1577.298 // integer values [email protected] = -2493.749 // integer [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 13.0822jump @PLANEZ1 :PLANEINIT_363              [email protected] = 1479.46 // integer values [email protected] = 1641.41 // integer values            [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 10.3581jump @PLANEZ1 :[email protected] = 1479.46 // integer values [email protected] = 1641.41 // integer values            [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 10.3581jump @PLANEZ1 :[email protected] = -1586.67 // integer values [email protected] = -93.33 // integer values            [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 13.6904 jump @PLANEZ1 :[email protected] = -1626.0 // integer values [email protected] = -137.3 // integer [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 13.6904:PLANEZ1wait 0 Model.Load(#AT400)Model.Load(#WMYPLT)038B: load_requested_models :PLANEZ1_38wait 0 if and  Model.Available(#AT400)  Model.Available(#WMYPLT) else_jump @PLANEZ1_380395: clear_area 1 at [email protected] [email protected] [email protected] range 40.0 [email protected] = Car.Create(#AT400, [email protected], [email protected], [email protected])Car.Angle([email protected]) = [email protected]: [email protected] = random_int 0 3 06ED: set_car [email protected] paintjob [email protected]: [email protected] = create_actor_pedtype 4 model #WMYPLT in_car [email protected] driverseat01C8: [email protected] = create_actor 4 #WMYPLT in_car [email protected] passenger_seat 0Model.Destroy(#WMYPLT)Model.Destroy(#AT400)07C0: load_path [email protected] :PLANEZ1_139wait 0 if 07C1:   path [email protected] available else_jump @PLANEZ1_139 if   not Car.Wrecked([email protected])else_jump @PLANEZ1_324 05EB: assign_vehicle [email protected] to_path [email protected]@ = 0 // integer values :PLANEZ1_195wait 500 if  not Car.Wrecked([email protected])else_jump @PLANEZ1_324 if  [email protected] > 30000 // integer values else_jump @PLANEZ1_195if 060E:   not  [email protected] else_jump @PLANEZ1_32408E6: set_plane [email protected] landing_gear  [email protected] =  0:PLANEZZ_305Bwait  500 ms    if   not Car.Wrecked([email protected])else_jump @PLANEZ1_324if001D:  [email protected] > [email protected] // integer values else_jump @PLANEZZ_305B if 060E:   not  [email protected] else_jump @PLANEZ1_32408E6: set_plane [email protected] landing_gear  [email protected] =  0:PLANEZZ_305Cwait  500 msif  not Car.Wrecked([email protected])else_jump @PLANEZ1_3240395: clear_area 1 at [email protected] [email protected] [email protected] range 40.0if [email protected] > 60000else_jump @PLANEZZ_305C        :PLANEZ1_324wait 100Car.RemoveReferences([email protected])Actor.RemoveReferences([email protected])06C5: release_car [email protected] from_path0873: release_path [email protected] @PLANEINIT_298

 

Edited by altman

Share this post


Link to post
Share on other sites
SteaVor

You should've posted a new reply instead of editing the old post. This would've bumped up your topic and would have notified the regulars of your update.

Editing a post (adding relevant information) after such a long time is not useful for you or your audience because there's absolutely no visual change that would indicate that there are new infos inside the thread. And double-posting is definitely allowed in such cases since there's no other possibility to make others take note of the updated content.

 

Share this post


Link to post
Share on other sites
haki_PL

Where should I paste this script or could someone post reply with ready main.scm (with this script included)?

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.
Note: Your post will require moderator approval before it will be visible.

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.


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