Jump to content

vehicle spawning


Recommended Posts

 

{$CLEO .cs}:DEMOTEXT03A4: name_thread "DEMO"wait 10000247: load_model #TIPPER038B: load_requested_models:Load_Model_Check0001: wait  0 ms00D6: if  00248:   model #TIPPER available004D: jump_if_false @Load_Model_Check0506: set_car_model #TIPPER next_variation 0 0 // first param is useless  00A5: 1@ = create_car #TIPPER at 896.1469 15.9772 91.3380175: set_car 1@ Z_angle_to 90.0//0249: release_model #TIPPER//01C3: remove_references_to_car 1@ // Like turning a car into any random car0A93: end_custom_thread

 

 

Hi smile.gif I've just begun CLEO scripting and have a query concerning the code above part of which I copied from ZAZ's scripting tutorial. (The vehicle #TIPPER is a standalone one I added myself; it's working ok in game this is not the problem). I get the impression from observation that the line "0248: release_model #TIPPER" which I have commented out also prevents the main script from using the model. That is it no longer appears in traffic. Is that the case? if that is true I'd like to know whether I can safely omit this line. I see that "0249: release_model 1@" is not flagged as an error and does not prevent the vehicle from appearing in traffic. maybe that one is more appropriate?

I have also commented out "01C3: remove_references_to_car 1@" because when I use it the vehicle doesn't spawn. In any case 1@ is a local variable so I doubt it is important.

 

btw why have I been flagged as "player hater"? sad.gif

Edited by seggaeman
Link to comment
https://gtaforums.com/topic/460354-vehicle-spawning/
Share on other sites

{$CLEO .cs}:DEMOTEXT03A4: name_thread "DEMO"wait 10000247: load_model #TIPPER038B: load_requested_models:Load_Model_Check0001: wait  0 ms00D6: if  00248:   model #TIPPER available004D: jump_if_false @Load_Model_Check0506: set_car_model #TIPPER next_variation 0 0 // first param is useless  00A5: 1@ = create_car #TIPPER at 896.1469 15.9772 91.3380175: set_car 1@ Z_angle_to 90.0//0249: release_model #TIPPER//01C3: remove_references_to_car 1@ // Like turning a car into any random car0A93: end_custom_thread

 

 

Hi smile.gif I've just begun CLEO scripting and have a query concerning the code above part of which I copied from ZAZ's scripting tutorial. (The vehicle #TIPPER is a standalone one I added myself; it's working ok in game this is not the problem). I get the impression from observation that the line "0248: release_model #TIPPER" which I have commented out also prevents the main script from using the model. That is it no longer appears in traffic. Is that the case? if that is true I'd like to know whether I can safely omit this line. I see that "0249: release_model 1@" is not flagged as an error and does not prevent the vehicle from appearing in traffic. maybe that one is more appropriate?

I have also commented out "01C3: remove_references_to_car 1@" because when I use it the vehicle doesn't spawn. In any case 1@ is a local variable so I doubt it is important.

 

btw why have I been flagged as "player hater"? sad.gif

Hi,

 

you use 0249: to release the model. You do it if you don't need the model anymore to create other vehicles of this type e.g. .

 

 

:Load_Model0247: load_model #m4:Load_model_Checkwait 0if0248: model #m4 available jf @Load_model_check01B2: give_actor $PLAYER_ACTOR weapon 31 ammo 600 // Load the weapon model before using this0249: release_model #m4

 

 

You just assure the engine you don't need the model loaded in your script anymore because after you created e.g. a car with its model the model is kept in memory by the engine

So: No, 0249 will not influence the appierence of your car on streets wink.gif

 

If you remove the references, the car disappears if the player is not close to it

 

This is an example how to use it:

 

 

{$CLEO .cs}//-------------MAIN---------------0000: NOP :NONAME_20001: wait 20 ms 00D6: if 0256:   player $PLAYER_CHAR defined 004D: jump_if_false @NONAME_2 00D6: if 03EE:   player $PLAYER_CHAR controllable 004D: jump_if_false @NONAME_2 00D6: if 80DF:   not actor $PLAYER_ACTOR driving 004D: jump_if_false @NONAME_2 00D6: if 84AD:   not actor $PLAYER_ACTOR in_water 004D: jump_if_false @NONAME_2 00D6: if 00E1:   player 0 pressed_key 4 004D: jump_if_false @NONAME_2 03E5: show_text_box 'CHEAT1'  // Cheat activated0247: load_model #INFERNUS :NONAME_1030001: wait 10 ms 00D6: if 0248:   model #INFERNUS available 004D: jump_if_false @NONAME_103 04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 3.0 0.0 02CE: 3@ = ground_z_at 1@ 2@ 3@ 0172: 4@ = actor $PLAYER_ACTOR Z_angle 000B: 4@ += 270.0 00A5: 0@ = create_car #INFERNUS at 1@ 2@ 3@ 0175: set_car 0@ Z_angle_to 4@ 0224: set_car 0@ health_to 2000 0249: release_model #INFERNUS 01C3: remove_references_to_car 0@ // Like turning a car into any random car 0001: wait 2000 ms 0002: jump @NONAME_2 

 

 

if you want the car to be spawn without being close to it

use

014B and 014C to create it as a parked car generator tounge.gif

don't have to load the model, no references and so on

 

{$CLEO .cs}

0000:

 

014B: 0@ = init_parked_car_generator #TIPPER color -1 -1 1 alarm 0 door_lock 0 0 10000 at 2435.302 -1671.848 12.8007 angle 90.0014C: set_parked_car_generator 0@ cars_to_generate_to 101

// 0-100 is the percentage value on how problably the car will be their so 101 is = always tounge.gif

 

 

Player Hater is the default title, go to your profile > edit my profile and on the right is a little window named 'Member title' change it to wahtever you want

 

cheers

 

 

Link to comment
https://gtaforums.com/topic/460354-vehicle-spawning/#findComment-1060149031
Share on other sites

Thanks! I didn't know many of those opcodes you listed. But in fact I'm positive about what I said concerning the traffic. Let's say you spawned a car (dunno about car generator, haven't tried that yet) and are still driving it after the thread has ended: it seems that the vehicle doesn't appear in traffic if you have used that "release model #XXX" line. I tried it with the new vehicle I added and also a stock one (the tractor). I drove around the whole place where I usually see the vehicle for like 15 minutes and no sign of it.

Interestingly though, if I get out of the car and get inside again the same vehicle restarts to spawn in traffic. (Or else if I start driving another type of vehicle) Anyway try it if you can and let me know what happens.

Try the following script; press the fire button near the place where the car is supposed to appear. Modify the vehicle and the coordinates as you see fit. For this it would be preferable to use a vehicle that appears in traffic often.

 

 

{$CLEO .cs}:DEMOTEXT03A4: name_thread "DEMO"wait 1000:DEMOTEXT_1wait 0if0256:   player $PLAYER_CHAR defined 004D: jump_if_false @DEMOTEXT_1if00E1:   key_pressed  0  17004D: jump_if_false @DEMOTEXT_100BA: text_styled 'FEM_OK'  1000 ms  10247: load_model #TRACTOR038B: load_requested_models:Load_Model_Check0001: wait  0 ms00D6: if  00248:   model #TRACTOR available004D: jump_if_false @Load_Model_Check0506: set_car_model #TRACTOR next_variation 0 0 // first param is useless  00A5: 1@ = create_car #TRACTOR at 896.1469 15.9772 91.3380175: set_car 1@ Z_angle_to 90.00249: release_model #TRACTOR01C3: remove_references_to_car 1@ // Like turning a car into any random car0A93: end_custom_thread

 

Link to comment
https://gtaforums.com/topic/460354-vehicle-spawning/#findComment-1060149192
Share on other sites

0249: has no influence on the traffic tounge.gif

 

with 0247: You tell the script engine, "Hey, man.. gimme the blueprints of the model I posted!" <<

 

with 0248: you check "Do I have them? did you already gave them to me?"

 

with 0249: you say: "Hay cheers mate! here, created an object by using the blueprints you gave me, put them back into the archive!"

 

 

:Load_Model0247: load_model #INFERNUS // ey engine!, load model #INFERNUS into the memory:Load_Model_Checkwait 0 // for the loopif0248: model #INFERNUS available // did the engine already load the modle into the memory?jf @Load_model_check 00A5: handle = #infernus x y z // using the model from the memory0249: #infernus  // can be released from memory 

 

 

The traffic is controlled by the exe and the paths and set by the values set in vehicles.ide

Edited by The_Siggi
Link to comment
https://gtaforums.com/topic/460354-vehicle-spawning/#findComment-1060149199
Share on other sites

Honest I know what I am talking about. Here is what I suggest try your own script with the "release_model..." line and then again with it commented out. Drive the spawned vehicle. I'm positive you'll see more instances of the car in traffic the second time, and none in the first case

This is what I've noticed in game.

Well if that doesn't happen could be its an issue with my GTA SA installation.

But thanks for your script it's pretty well written.

Link to comment
https://gtaforums.com/topic/460354-vehicle-spawning/#findComment-1060149271
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
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.