GTA: Modification Area

A website for the GTA modding scene

Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Big-game starts raising Schneider's profile
Sun Mar 04, 2012 2:28 am by lavivi

» [Help] cleo created lighting
Thu Oct 14, 2010 1:03 am by findmy012

» Mission Question
Thu Oct 14, 2010 1:02 am by findmy012

» [IV] Spoiler Script
Thu Oct 14, 2010 1:02 am by findmy012

» Mission mod [help]
Sat Sep 18, 2010 5:50 pm by jayd00

» Bc7 Mod Help
Fri Aug 20, 2010 11:19 am by pengpeng

» Found a bug
Fri Dec 18, 2009 4:22 am by _CJ360_

» [IV] Novitec Rosso 599 GTB
Tue Nov 17, 2009 4:22 pm by Kotton

» Hello/Guidance Request
Mon Oct 12, 2009 6:45 am by Adler

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search
Affiliates
image

Image

Image

Image

Image

Image

Image

Image

Image

Image

image

Image

steve-m.com

Image


----- Русский -----

Если ваш сайт содержит большую коллекцию SCM/CLEO-скриптов (больше 16), напишите на мой e-mail, и я добавлю его в список. Приветствуются скрипты, которые не встречаются на других сайтах ... Спасибо. ))))


----- English -----

If your website has a big enough collection of SCM/CLEO scripts (more than 16) notify me by e-mail
, and I will add it to the list. The unique scripts are preferable ... Thank you. ))))

Log in

I forgot my password



December 2016
MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
262728293031 

Calendar Calendar


You are not connected. Please login or register

Car generators(rules)

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Car generators(rules) on Wed Apr 15, 2009 7:04 pm

Usually the beginner scripter starts with a small and simple script to spawn a vehicle with a parked generator. It is recommend because not much knowledge is needed - however, as I have seen all over GTAForums, that people are actually confused about how the generator parameter (014c's last parameter) works, let me explain:

0 means the vehicle will never spawn. 101 or greater means the vehicle will always spawn for a unlimited amount of time. Where-as say for example 20, would make the vehicle spawn 20 times, so 1 would make it spawn 1 time, and 99 would make it spawn 99 times.

Now when spawning a vehicle, it is not necessary to pay attention to the 32@, 33@ (local timers) rule. These may even be used as a handler for the parked car generator. (32@ is available anywhere, even if the thread is big I guess.)


Code:

014b: 32@ = init_parked_car_generator #BULLET color -1 -1 1 alarm 0 door_lock 0 0 10000 at x y z angle <p>
014c: set_parked_car_generator 32@ cars_to_generate_to 3 // spawn 3 times


And it's still correct as:


Code:

014b: 0@ = init_parked_car_generator #BULLET color -1 -1 1 alarm 0 door_lock 0 0 10000 at x y z angle <p>
014c: set_parked_car_generator 0@ cars_to_generate_to 3 // spawn 3 times


Would be.

As such, car generators is(-are) different from actually scripting a handler, and you can not use these cars to perform a task, say you want the car to drive, or you want to destroy it. You NEVER need to load a model of the vehicle when using a parked car generator, and you NEVER need to check if weather the player is in range to spawn the vehicle.

If you want to create a car normally, and can actually use the car for things then use the opcode 00a5:


Code:

#INFERNUS.load

repeat
    wait 0
until #INFERNUS.Available

04C4: store_coords_to 0@ 1@ 2@ from_actor $PLAYER_ACTOR with_offset 0.0 5.0 1.2
0395: clear_area 1 at 0@ 1@ 2@ radius 5.0
00A5: 3@ = create_car #INFERNUS at 0@ 1@ 2@
#INFERNUS.Destroy
01C3: remove_references_to_car 3@


There exist 4 opcodes, to-do with the parked generators, (014b, sets-up the car, 09e2 is the same only you can add your own custom number plate, 014c makes the vehicle generate, and 0a17, sets the parked car as player-owned).

In a CLEO script, most scripter's usually save there vehicle, so that it is always present within your save-game file. For this you can add the opcode 0a95 at the start of the script:


Code:

0A95: enable_thread_saving


And so it would be like this:


Code:

{$CLEO}

0A95: enable_thread_saving
014b: 0@ = init_parked_car_generator #BULLET color -1 -1 1 alarm 0 door_lock 0 0 10000 at x y z angle <p>
014c: set_parked_car_generator 0@ cars_to_generate_to 101 // unlimited spawn limit
0A93: end_custom_thread


As in a CLEO script, some may wanna use global variables, to make there code more readable, if you wanna disable the car for example, then global variables, will come in handy. Although if it's parking is handled by a separate thread, you may use a local variable.

For making your code even more readable, without using the global variables, you can use the const..end function:


Code:

const
    MY_CAR1 = 0@
end


Like that:


Code:

{$CLEO}

const
    MY_CAR1 = 0@
end

0A95: enable_thread_saving
014b: MY_CAR1 = init_parked_car_generator #BULLET color -1 -1 1 alarm 0 door_lock 0 0 10000 at x y z angle <p>
014c: set_parked_car_generator MY_CAR1 cars_to_generate_to 101 // unlimited spawn limit
0A93: end_custom_thread


There is a limit of how many parked cars can be placed within the game, that limit is 500(185 in Vice City), including the vehicles already in the original main.scm(if you have it that is). Analogous to GTA 4 the opcode 014c = SWITCH_CAR_GENERATOR and 014B = CREATE_CAR_GENERATOR You can read more information about the parked car generator opcodes at GTAModding.com.

View user profile http://gtamodding.com

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum