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. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

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

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    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 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 Mods
    10. GTA Vice City

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

      1. Guides & Strategies
      2. Help & Support
      3. GTA 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

stitchman

spawning car with nitro

Recommended Posts

stitchman

Ok ive spent the last 8 hours reading diffrent tutorials and posts looking for the answer to my question, so if its been posted before my apologies but heres my question:

 

can someone give me a clear example of how to spawn a car with nitrous, and or how to spawn a car thats bulletproof

 

i already have my car spawning in front of CJ's house and it spawns in the color i want, i just can not figure out how to spawn it with nitro or make it bulletproof, thanks.

 

 

Share this post


Link to post
Share on other sites
superglitch
you could edit the vechiles spawn crap with the ultimate editor so it always spawns with nitro.

Share this post


Link to post
Share on other sites
stitchman

is there any other way than making them all have nitro?

Share this post


Link to post
Share on other sites
Demarest
Use opcode 02AC.

Share this post


Link to post
Share on other sites
stitchman

 

can someone give me a clear example...

like:

 

02AC: set_car $cj_car immunities 1 0 0 0 0

 

or what? im not some kinda coding expert or anything

 

this is what i have right now:

 

014B: $cj_car = init_parked_car_generator #SABRE 110 0  0 alarm  0 door_lock  0  0  10000 at  2488.0 -1682.5  13.0 angle -90.0014C: set_parked_car_generator $cj_car cars_to_generate_to  101

 

 

past that ill need specific instructions, ive tried at least a few dozen diffrent ways to add the 02AC but im having no luck

Edited by stitchman

Share this post


Link to post
Share on other sites
superglitch

02AC: set_car_immunities $cj_car 1 1 1 1 1

 

Is anti:

Bullet, Fire, Explosion, Damage, Water

Share this post


Link to post
Share on other sites
Demarest
You don't have to be a coding expert to read the tutorials and immitate existing code. Your problem is that you're using a parked car generator. You can't specify things like these on it. You have to manually spawn one and set its immunities and/or mods (the latter of which I couldn't tell you how, but I'm guessing the job where you need a lowrider is a good place to start since it recreates the car, but with a mod).

Share this post


Link to post
Share on other sites
stitchman

oooooh, i didnt know i couldnt set things with the car park thingy. i spent all day reading tutorials and such, didnt find a mention of that at all. thanks. biggrin.gif

Share this post


Link to post
Share on other sites
superglitch
oooooh, i didnt know i couldnt set things with the car park thingy. i spent all day reading tutorials and such, didnt find a mention of that at all. thanks. biggrin.gif

omfg

 

angry.gif

Share this post


Link to post
Share on other sites
stitchman

i for the life of me can not figure out why this wont work, i pulled it right out of some other code in the .scm and plugged in the info i needed

 

 

00A5: $cjcar = create_car #SABRE at  2488.0 -1682.5  13.002AC: set_car $cjcar immunities  1  0  0  0  00229: set_car $cjcar color_to  110  00175: set_car $cjcar z_angle_to  -90.0053F: set_car $cjcar tires_vulnerable  0

 

Share this post


Link to post
Share on other sites
Demarest
It will. You just have to request that vehicle model first, loop to make sure it's available, and THEN use it. Also (not that it's critical), set car angle to 270, not -90.

Share this post


Link to post
Share on other sites
mageezer

what do you mean by loop? and how do you request the model? I thought you only had to do that once and then use the model as much as you like.

Share this post


Link to post
Share on other sites
Demarest

what do you mean by loop?
Basic coding concept. As the name implies, it is code that CAN run over and over again. In SCM, if a label has a jump or jf to that label, it is potentially a loop.

 

 

how do you request the model?
How did the original code request the model? For assistance search either original code or the opcode database for the word request. This is a good habit to get into.

 

 

I thought you only had to do that once and then use the model as much as you like.
Up until you release the model, this is true. Nevertheless, you cannot proceed until you DO load the model and make sure that the load has completed before accessing it.

Share this post


Link to post
Share on other sites
!llus!on

Here is a example of how the code will look with loop when i want to spawn my car

this time its a sentinel

 

:RequestCars

0247: request model 405

038B: load requested models

 

:WaitCars

00D6: if 0

0248: model 405 available

004D: jump if false ££WaitCars

 

:CreateCars

00A5: $mycar = create_car 405 at 2488.0 -1682.5 13.0

02AC: set_car $mycar immunities 1 0 0 0 0

0229: set_car $mycar color_to 0 0

0175: set_car $mycar z_angle_to 270

053F: set_car $mycar tires_vulnerable 0

Share this post


Link to post
Share on other sites
Demarest
Loops need waits. Use local vars when possible.

Share this post


Link to post
Share on other sites
!llus!on

ok i will do that next time thanks for the advice

i just started coding so i'm glad to get advice of someone

 

can you post the code like you would do it so i can see how it would

need to be

 

thnx all ready

Share this post


Link to post
Share on other sites
brotherbozar

If anyone has any further findings about this i'd be glad to hear about it, been trying for ages.

Demarest - an example of complete code would be nice. I know you dish out lots of advise which is welcome. Mimicking existing code is great ,so long as we know which existing code to mimick... therein lies the problem. The tutorials are pretty slim and just seem to cover spawning normal parked cars.

Share this post


Link to post
Share on other sites
Premium

:RequestCars0247: request model #SENTINEL06E9: request_car_component #NTO_B_TW 038B: load_requested_models:WaitCars00D6: if  60248:   model #SENTINEL available0248:   model #NTO_B_TW available004D: jump_if_false ££WaitCars :GetCars 00A5: $mycar = create_car  #SENTINEL at  2488.0 -1682.5 13.0        0229: set_car $mycar color_to  19  0 02AC: set_car $mycar immunities  1  1  1  1  10175: set_car $mycar z_angle_to  270.0;0224: set_car $mycar health_to  5000;0423: car $mycar improve_handling  2.006E7: $mynos = add_car_component #NTO_B_TW to_car $mycar :ReleaseCars0001: wait  10 ms01C3: remove_references_to_car $mycar 0249: release_model #SENTINEL06EB: release_car_component #NTO_B_TW  

 

 

Car components names can be found at your-sa-path/data/carmods.dat

Edited by Premium

Share this post


Link to post
Share on other sites
Demarest
If anyone has any further findings about this i'd be glad to hear about it, been trying for ages.

Demarest - an example of complete code would be nice. I know you dish out lots of advise which is welcome. Mimicking existing code is great ,so long as we know which existing code to mimick... therein lies the problem. The tutorials are pretty slim and just seem to cover spawning normal parked cars.

I totally understand that. But considering there are buildings set up throughout the game that are made to add attachments to cars, finding it should be a breeze searching by GXT calls alone. This is especially true considering the code attaches it before you even decide to buy it, can detach it if you change your mind, etc.

Share this post


Link to post
Share on other sites
brotherbozar

Thanks for the quick fix Premium ..i needed that.

A couple of questions:

 

Where do i put that code?

 

Does it need/have a create thread or anything?

 

Are there limits to what carmods can be fitted?

 

How would i go about spawning:

a) more than one type of car in the same place?

 

b) Different cars at different places?

 

Thanks again,

Share this post


Link to post
Share on other sites
Premium

004F: create_thread ££RequestCars for create thread.

 

Limitations seem just to be what's on the cars line in carmods.dat

 

you may need to define the car part under :Second_Segment, and of course increase the number of defined objects

 

Share this post


Link to post
Share on other sites
ReeferSmoke

Can anyone help me with this? The game crashes when i start a new game.

 

:RequestCars0247: request model #SENTINEL06E9: request_car_component #NTO_B_TW 038B: load_requested_models:WaitCars00D6: if  60248:   model #SENTINEL available0248:   model #NTO_B_TW available004D: jump_if_false ££WaitCars :GetCars 00A5: $mycar = create_car  #SENTINEL at  2488.0 -1682.5 13.0 0175: set_car $mycar z_angle_to  269.8       0229: set_car $mycar color_to  19  0 02AC: set_car $mycar immunities  1  1  1  1  10175: set_car $mycar z_angle_to  270.0;0224: set_car $mycar health_to  5000;0423: car $mycar improve_handling  2.006E7: $mynos = add_car_component #NTO_B_TW to_car $mycar :ReleaseCars0001: wait  10 ms01C3: remove_references_to_car $mycar 0249: release_model #SENTINEL06EB: release_car_component #NTO_B_TW

 

I've added "NTO_B_TW" to the DEFINE OBJECTS and increased the number up one. Is there something I'm missing? Thanks for any help.

Share this post


Link to post
Share on other sites
Demarest

First things first: Is that even a valid object? Original code never called upon it and if it's not referenced as a car component, that alone would crash it. If it IS a valid car component, then you wouldn't need to define it and doing so would crash the game unless there is an object called by that name in gta3.img.

 

Why if 6? That is incorrect, but shouldn't crash the game. There's no need for the wait where you have it, but there IS a need in your loop. If I'm right above, that loop is eternal and with no wait... CRASH!

 

Other than that, use vocals where able and there's no need to set the z angle twice.

Share this post


Link to post
Share on other sites
ReeferSmoke

Well, I'm fairly new to coding so please bear with me.

 

There's no need for the wait where you have it, but there IS a need in your loop. If I'm right above, that loop is eternal and with no wait... CRASH!

 

I added a some waits to the code, but i dunno if it's in the right loop.

 

 

:RequestCars0001: wait  0 ms0247: request model #SENTINEL06E9: request_car_component #NTO_B_S 038B: load_requested_models:WaitCars00D6: if  20248:   model #SENTINEL available0248:   model #NTO_B_S available004D: jump_if_false ££WaitCars :GetCars0001: wait  0 ms 00A5: $mycar = create_car  #SENTINEL at  2487.35 -1655.12  13.3  0175: set_car $mycar z_angle_to  90.0        0229: set_car $mycar color_to  19  0 02AC: set_car $mycar immunities  1  1  1  1  1;0224: set_car $mycar health_to  5000;0423: car $mycar improve_handling  2.006E7: $mynos = add_car_component #NTO_B_S to_car $mycar :ReleaseCars0001: wait  10 ms01C3: remove_references_to_car $mycar 0249: release_model #SENTINEL06EB: release_car_component #NTO_B_S004D: jump_if_false ££RequestCars 

 

 

I also changed the OBJECT to one found in the main.scm, but still crashes. I don't quite have the best understanding with the waits and loops. I really hope to figure these out though.

Share this post


Link to post
Share on other sites
Opius

I believe there's a dedicated opcode for checking whether a car component is loaded. Use that, instead of 'is model available'.

 

Also, add a 0ms wait right underneath :WaitCars. In it's current state, it won't cause crashes, but it will lock up your game until the models are loaded.

Share this post


Link to post
Share on other sites
Demarest

?

 

When a loop has no wait, if it draws the game at all, the game crashes. Been that way since GTA3. blink.gif

 

@Reefer: Your is available lines is the loop. That's because there's a jump in it that points back to itself. When you have one, you need a wait (even if it is 0).

Share this post


Link to post
Share on other sites
Opius

Re: Waits and loops

Are you sure? I've written a few things for VC that unintentionally went into a loop, and although everything except the radio stopped, it didn't crash.

 

However, depending on the internal priority of the mission script, an infinite loop may prevent the objects from loading, thus ensuring the loop will never break.

 

Basically, use a wait. wink.gif

Share this post


Link to post
Share on other sites
ReeferSmoke

FIrst off. Thanks for the replies guys. Second. I've got this working, but the car placed only seems to spawn once. Am I missing a jump to make it respawn or something? Here is my stripped script.

 

DEFINE VERSION SA 0.330002: jump ££Second_SegmentDEFINE MEMORY  43800; Equals Mission Builder type global variable range $2 to $10949:Second_Segment0002: jump ££Third_SegmentDEFINE OBJECTS  3DEFINE OBJECT (no name)                  ; This is an unused object. You can put anything here.DEFINE OBJECT NTO_B_S                    ; Object number -1DEFINE OBJECT NTO_B_TW                   ; Object number -2:Third_Segment0002: jump ££Fourth_SegmentDEFINE MISSIONS  0:Fourth_Segment0002: jump ££Fifth_SegmentDEFINE EXTERNAL_SCRIPTS  0:Fifth_Segment0002: jump ££Sixth_SegmentDEFINE UNKNOWN_FIFTH_SEGMENT                        DEFINE UNKNOWN1  0:Sixth_Segment0002: jump ££MAIN_1DEFINE UNKNOWN_SIXTH_SEGMENTDEFINE UNKNOWN3  574;-------------MAIN---------------:MAIN_103A4: name_thread 'MAIN'016A: fade  0 ()  0 ms01F0: set_max_wanted_level_to  00111: set_wasted_busted_check_to  0 (disabled)00C0: set_current_time  10  004E4: unknown_refresh_game_renderer_at  2488.562 -1666.86403CB: set_camera  2488.562 -1666.864  13.37570053: $PLAYER_CHAR = create_player #NULL at  2488.562 -1666.864  12.875701F5: $PLAYER_ACTOR = create_emulated_actor_from_player $PLAYER_CHAR0373: set_camera_directly_behind_player0173: set_actor $PLAYER_ACTOR z_angle_to  270.0  01B6: set_weather  1                                           070D: $PLAYER_CHAR04BB: select_interior  0;; select render area01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)01B7: release_weather  016C: restart_if_wasted at  2488.562 -1666.864  12.8757 angle  0.0 unknown  0016D: restart_if_busted at  2488.562 -1666.864  12.8757 angle  0.0 unknown  0016A: fade  1 ()  1000 ms0001: wait  100 ms03E6: remove_text_box004F: create_thread ££RequestCars0247: request_model #SULTAN06E9: request_car_component #NTO_B_S:MAIN_20001: wait  0 ms                                       00D6: if  00248:   model #SULTAN available004D: jump_if_false ££MAIN_200A5: $mycar1 = create_car #SULTAN at 2488.562 -1666.864 12.875706E7: $var = add_car_component #NTO_B_S to_car $mycar1036A: put_actor $PLAYER_ACTOR in_car $mycar1:RequestCars0001: wait  0 ms0247: request model #SULTAN06E9: request_car_component #NTO_B_TW 038B: load_requested_models:WaitCars0001: wait  0 ms 00D6: if  20248:   model #SULTAN available0248:   model #NTO_B_TW available004D: jump_if_false ££WaitCars :GetCars0001: wait  0 ms 00A5: $mycar2 = create_car  #SULTAN at  2487.35 -1655.12  13.3 06E7: $mynos = add_car_component #NTO_B_TW to_car $mycar2 0175: set_car $mycar2 z_angle_to  90.0        0229: set_car $mycar2 color_to  19  0 02AC: set_car $mycar2 immunities  1  1  1  1  1;0224: set_car $mycar2 health_to  5000;0423: car $mycar2 improve_handling  2.0:ReleaseCars0001: wait  10 ms01C3: remove_references_to_car $mycar2 0249: release_model #SULTAN06EB: release_car_component #NTO_B_TW004D: jump_if_false ££RequestCars:MAIN_30001: wait 2500 ms0002: jump ££MAIN_3

 

 

In this script, you spawn in a Sultan with NOS, and i have placed another Sultan nearby. I used "NTO_B_S and NTO_B_TW" objects. Although NTO_B_TW is not in the original main.scm, it still works. It is the double bottle.. Any help is appreciated..

Share this post


Link to post
Share on other sites
Opius

create_car only creates a car once. It's supposed to do that.

 

For what you want to do, you would check to see if the player was near the point the car was supposed to be in, and if so, THEN generate the car.

 

Then, you would check if the player WASN'T near that point, and if so, remove references to that car. Then you would jump back to the first check.

 

But don't destroy the car. If the player got in the car and drove away, the car would be destroyed as soon as you left the area. Removing references to it makes it act like any other car on the road, so if the player isn't interacting with it, it will disappear on it's own.

Share this post


Link to post
Share on other sites
ReeferSmoke

Looking through the original code I found these.

 

00FE:   actor $PLAYER_ACTOR  0 ()near_point  658.0068 -1866.313  4.4537 radius  15.0  15.0  15.080EC:   NOT   actor $PLAYER_ACTOR  0 ()near_point  1812.369 -1929.922 radius  500.0  500.0

 

Are these the opcodes I would use to check for the near points?

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.


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