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

nubbel

savegarage creation

Recommended Posts

V41N

Ok, I've got my garage working, and working on a script to prevent the pile-up that occurs when it's full and you drive a new car where one would be tounge.gif (No cars are there until you get out, then they pile up hehe)

 

I also would like to add a gate to help with this, any suggestions? I'm not asking anyone to write the script for me or anything, I just figure if someone knows something tricky about it, maybe you could give me a heads up. smile.gif

 

Thanks for the help everyone!

Share this post


Link to post
Share on other sites
Demarest
Garages spawn the vehicles they retain as soon as you're within a few feet of its front. Blank out a door and you can watch the way it occurs. What you're talking about is more akin to the Marina Carpark. As you go to spawn all the vehicles, you'd have to reposition some based on where you currently are and that sounds like a LOT of unnecessary code.

Share this post


Link to post
Share on other sites
V41N

notify.gif HuH?!? I don't think you're following me here. hehe I'm not talking about spawning cars manually or anything. I just want a gate that will only open if the garage isn't full...(and already having difficulties getting one to spawn, but that's another story sigh.gif )

 

As far as the cars being visible, is it possible to open a garage from further away?

Like if I were to say if player is within x distance from it, then open_garage.. Would that make them visible or do you have to be a few feet away to actually open it/see them?

 

Edit: an explanation of the 'pile-up' problem I was refering to in my last post:

If you have 4 vehicles already in the garage and you bring another one, the garage doesn't open. Since there is no door to prevent you from entering, you can still drive the vehicle to where the garage is. Then when you get out, since you are not in a vehicle anymore, the garage opens. If your new car is in the same spot as one in the garage, then they pile up and cause damage. Creating a door for the garage would prevent you from entering when it's full (if it's possible) Think of it like a parking lot with a gate that only holds 4 cars.

Edited by NDG474

Share this post


Link to post
Share on other sites
PatrickW

I'm building this answer on the way garages worked in VC, so it might not be fully appropriate for SA. At least it should be helpfull as background info during your testing.

 

In VC, a garage is defined from the SCM by means of specifying a cube ( 3d-area ).

The further operation of the garage (opening of the door, closing of the door, storing the cars, respawning the cars) was hardcoded.

 

The .exe contained a list of models that were used as a garage door. When one of the objects on that list was available in the defined cube of the garage, it was considered to be the door of that garage, and moved accordingly.

 

If you want to make a garage in VC with a properly working door, you should use one of the existing garage-doors ( which is thus already on the list) and place it in front of your garage.

Another possibility, ( mainly used by larger mods like GTA:LC and Myriad ) is to somehow change the list of garagedoor models in the .exe

 

Seeing that garages in SA are defined in IPL files, it wouldn't suprise me that the garagedoor issue has also been changed. But research in needed in this topic.

 

Figureing this out is a great way to earn respect in the modding community.

Share this post


Link to post
Share on other sites
V41N

monocle.gif Hmm.. Ceratainly interesting. I took a look at more of the files in the data directory, and found something odd. Inside the Object.dat file there's a list of the garage doors. In this list all doors seem to have the same attributes (like mass, TurnMass, Elasticity...). What I am curious of is why they list doors that aren't used, like "sweetsdoor_LAe2". Wouldn't it be true that if the doors listed have the same attributes that they might be manipulated in the same way? Just a thought, havn't looked into it too much yet.

 

Anyways about the gate I wanted to make. I wasn't really trying to make the gate be the door, but only act like it. The actual garage door itself I would like to have open from a further distance so you can see the vehicles parked inside from more than a few feet away (since it's an invisible garage). The gate would merely check how many car's are parked inside, or maybe have been driven past it (in and out). Then if it's full it would say so and not let you thru while in the vehicle. My real question is: Is there any way to check the number of car's parked in a garage, or would I have to make a counter with the gate (if so I'm probably not going to do it)? Sorry for all the questions, I just don't want to end up trying to achieve the impossible (for me at least tounge.gif )

Share this post


Link to post
Share on other sites
nubbel

Don't stop asking, asking is good tounge2.gif

It's an interesting issue, these garages. Did you figure out how to let the camera act normal inside these garage szones?

I hate it to run in such an area and the camera going crazy.

Share this post


Link to post
Share on other sites
Demarest
Opcode 03DA.

Share this post


Link to post
Share on other sites
V41N

Thanks Damarest! You've been a great help! Thanks for answering all my questions (yeah, I know I have a lot tounge.gif )

 

 

Edit:

Well, here is what I've come up with so far

 

 

:CriB_G10299: activate_garage 'VaiNG1':CriB_G20001: wait  500 ms00D6: if 210100:   actor $PLAYER_ACTOR  near_point_in_car  1496.814 -687.9254  95.56331 radius  4.0  4.0  4.0 sphere 000FF:   actor $PLAYER_ACTOR  0 ()near_point_on_foot 1496.814 -687.9254 95.56331 radius  30.0  30.0  30.0004D: jump_if_false ££CriB_G300D6: if 083B0:   NOT   garage 'VaiNG1' door_open004D: jump_if_false ££CriB_G20360: open_garage 'VaiNG1';03DA: set_garage_camera_follows_player 1;*CRASHES GAME*0002: jump ££CriB_G2:CriB_G30361: close_garage 'VaiNG1'0002: jump ££CriB_G2

 

 

 

It doesn't work though sad.gif

 

I have tried many trial&Error methods and it seems there is no way to control the garage_open/close command of a custom created garage area (makes sense I suppose). Also the code for the garage_camera causes the game to crash when loading a new game.

 

Edited by NDG474

Share this post


Link to post
Share on other sites
Demarest

You're quite welcome. When I have questions, other people answer them... It's what makes this place so great smile.gif For that matter, for future opcode questions, bookmark the Opcode Database.

 

When you say "loading" a new game, do you mean starting a new game? Also, you should probably check to make sure that that opcode is somewhere in SA's original code. Many opcodes die and come to life from one installment to the next.

 

The whole open/close almost goes back to what I was saying earlier. In GTA3 and VC, the EXE had tables within it that mapped out what map items to consider as garage doors. Get near them and they open automatically. Does the item you're using for your door have the same name as an existing door? I'm not sure if you can have copies of doors or if you go to use that one there, you can't use it elsewhere too. Of course, if you use an original doorpiece and the SA engine is like its predecessors, you won't need any code at all beyond initializing the garage. It will do it automatically.

 

I REALLY need to get SAPC so I can be of more use with this stuff confused.gif

Share this post


Link to post
Share on other sites
nubbel

Hey guys, I figured something out. When you create a garage area from IPL files using below parameters, the camera acts normal, like there is no garage area:

 

 

1  2  3   4  5   6  7  8   9   10   11------------------------------------------X, Y, Z,  X, Y,  X, Y, Z,  5,  31,  NAME1-3: The x, y and z coordinate lower left front4-5: The x, y coordinate lower right front6-8: The x, y, z coordinate top left back9: Garage type anyhow (most times 1)10: Unknown (may interact with parameter 9 ?!?)11: Identifier / Name

 

 

The parameter 9 when set to 5 lets the camera act normal. But I guess thats just a side effect. Value 5 has e.g. the big hangar in the desert, and one safehouse in Los Santos. I have no clue what parameter 10 does.

 

These garages areas can hold 4 cars.

 

Share this post


Link to post
Share on other sites
V41N

Yeah, the Opcode Database is how I found out what the line was to use the opcode (I didn't remember seeing that op there before). I understand what you mean by it already being in the script somewhere, unfortunately it isn't though... Does that mean the code cannot be used?

 

As far as the door, there isn't one. I was just trying to trick the game into acting like the garage area was opened. (Kinda hard to explain) The vehicles that are parked in the garage become invisible when you take a few steps away from the area (as if the garage closes), you have to be right in front of the area before they become visible again (as if the garage opens). I'm trying to figure out how to make them visible while being within a certain distance away, but it doesn't seem to be possible. confused.gif

 

This is becoming much more complicated then I had expected.. Maybe it'll be best just to wait for a new carpark mod, unless someone wants to help me create one rolleyes.gif

 

Honestly though I havn't really attempted anything from that aspect yet.

 

I won't be around much until sunday (I work 12hr shifts second half of the week, not much free time). Hopefully someone will have a few ideas to add by then. I am bound and determined to add new garages to the game though, so I won't be giving up regardless.

 

Edit: Nubbel, just noticed your post. Great find! smile.gif

Edited by NDG474

Share this post


Link to post
Share on other sites
nubbel
I am bound and determined to add new garages to the game

Yup, me too.

There is a lot of nice, unused space in this game.

Share this post


Link to post
Share on other sites
V41N

New discovery: When you have two created garage areas within sight of eachother, you can notice something. When you enter one area, the vehicles stored in the other area become visible. When you leave the area, the other's still remain visible (seemingly persistantly). Maybe we can use this to our advantage somehow. smile.gif

 

 

Edit: Cancel that... Evidentally if you exit the game then run it again and load the save, the ones that remained visible are no longer there.. This might mean you can only have one area-garage... sad.gif

Edited by NDG474

Share this post


Link to post
Share on other sites
PatrickW

Converting my marina-carpark mod to SA is the next thing on my ToDo list, after finishing a first release of the mission master mod. I still have to search for a nice carpark in SA to implement it in. Getting a basic version to work shouldn't be too hard, but perfecting it ( retaining all the features of the stored cars like variations/mods/paintjob, might prove to be more of a hassle, as the proper opcodes need to be found for that.

 

Share this post


Link to post
Share on other sites
Demarest
Yeah, the Opcode Database is how I found out what the line was to use the opcode (I didn't remember seeing that op there before). I understand what you mean by it already being in the script somewhere, unfortunately it isn't though... Does that mean the code cannot be used?

Not necessarily. I "added" functionality to MB for a lot of opcodes in GTA3 that were never used, but VC later revealed were there. I just say search existing code because if you DO find it, then you know it will work and see how.

 

I'm familiar with the ways garages do their thing, so I can visualize what you're saying. What you're doing to make them appear sooner is a unique idea smile.gif I would make the in car radius more than 4 if that's your aim. Even better, instead of having separate checks using radii that will ever reveal them if you're behind the back wall, why not just check to see if $PLAYER_ACTOR is in a rectangle that is in front of the building? Then you could specify the area and only have to use one check instead of two.

 

The open and close garage commands may not work if you don't have a door. As for why that one opcode crashed your game, not sure. It could be that it is no longer supported. Or it could be that they hard-coded garages in general to behave one way and one way only camera-wise. It's been awhile since I've even played the game, so I can't recall.

Share this post


Link to post
Share on other sites
Guill

would it be possible to have a valet?

have a marker like in the chop shop mod and have the valet store the vehicle in the garage.

that will get rid of the camera prob

also you could have a menu for vehicle recovery like SA_MMM by PatrickW

 

OpCodes that might help:

 

01d5 send_actor_to_car_driversseat $actorID, $carID

01d3 make_actor_leave_car $actorID, $carID

00d9 store_actor_car $actorID, $carID

00db is_actor_driving_car $actorID, $carID

02c2 drive_car_to_point1 $carID, X, Y, Z

03c0 get_actor_car= $actorID, $carID

03c1 get_player_car= $player_char, $carID

 

do not know how possible it is but it might be an alternative idea

Share this post


Link to post
Share on other sites
nubbel

 

Converting my marina-carpark mod to SA is the next thing on my ToDo list, after finishing a first release of the mission master mod. I still have to search for a nice carpark in SA to implement it in. Getting a basic version to work shouldn't be too hard, but perfecting it ( retaining all the features of the stored cars like variations/mods/paintjob, might prove to be more of a hassle, as the proper opcodes need to be found for that.

 

If you could share such a "basic version" with us, I would be very very thankful. For example just a small area that gets checked and does all the garage stuff, so that we can play around with the code and move the area(s) somewhere else.

 

 

I still have to search for a nice carpark in SA to implement it in.

Well there are some nice big carparks in LV, but thats the smallest problem to find one good.

 

 

would it be possible to have a valet?

have a marker like in the chop shop mod and have the valet store the vehicle in the garage.

that will get rid of the camera prob

The idea is great. I wouldn't use it to get rid of the camera problem (well this is btw. no real problem anylonger), but a personal valet guy would be fun and not that difficult.

 

Edited by nubbel

Share this post


Link to post
Share on other sites
PatrickW

My homepage ( under mods), contain a "do it yourself" packet for the marina carpark, which contains all the code. you're free to browse /reuse it ( with credits ofcourse ;D ).

 

The VC version had a cosum implemention of arrays, as they were not supported by the engine. That part will need a rewrite for SA.

 

The code works basicly like this. In front of the entrance, a large area is defined ( +_ 200x50 ), ("the portal"). When the player enters this area from the outside, the carpark code is activated, and starts creating all the cars that are stored in it's arrays.

 

right in front of the entrance, a small area is defined. When the player is in this area, and all cars in the carpark are spawned, the entrance gate is opened and the player can enter the garage. If the garage, already contains the maximum number of vehicles, the gate will only open if the player is on foot.

 

When the player leaves the garage, and moves aoutside the Portal, the infomation of all the cars in the garage is stored, and the cars are destroyed.

 

The most difficult thing about moving the carpark to another location, is defining the size/location of the portal. It should be big enough, so that normally the cars in the garage are all spawned, when the player is close enough to look inside through the gates.

On the other hand, the portal should not be too big, as the vehicles in the garage still exist as long as the player drives inside the portal when leaving the garage. The problem is, that as long as the vehicles inside the garage exist, the engine won't be spawning any random traffic, thus the portal should not be any bigger than needed.

 

Note that this description is based on how the VC engine reacted, and the SA engine might react totally different.

 

 

Share this post


Link to post
Share on other sites
nubbel

yeah, I read through the codes 2 times and understood the basic steps (maybe also because of the good comments), but what I don't understand is how the cars are stored/saved (which part is it exactly?). How does the game after restarting it still know what cars to generate? Where is the car array saved?

 

I made one sad discovery: The garage areas defined in the \data\maps\*.IPL files only work when you start a new game sad.gif

 

Thanks a lot, nubbel

Share this post


Link to post
Share on other sites
PatrickW

This is the part that recreates the cars from the Arrays:

 

$cp_type_index = 0:cp_recreate_loop          get_array $cp_typeif 0  NOT $cp_type == -1 jump_if_false ££cp_recreate_next;--------------------------; RECREATE THIS CAR;--------------------------; decode model and colors from typeinteger $cp_temp = $cp_type$cp_temp /= 65536integer $cp_model = $cp_temp  ;; model0247: request_model $cp_model$cp_temp *= 65536integer $cp_type -= $cp_temp  integer $cp_temp = $cp_type$cp_temp /= 256integer $cp_pcol = $cp_temp  ;; pcolor$cp_temp *= 256integer $cp_type -= $cp_temp  integer $cp_scol = $cp_type;; scolorinteger $cp_handle_index = $cp_type_indexinteger $cp_x_index = $cp_type_indexinteger $cp_y_index = $cp_type_indexinteger $cp_rz_index = $cp_type_indexget_array $cp_x get_array $cp_yget_array $cp_rz  :cp_wait_model0001: wait 0 ms if 0 0248:   model $cp_model available jump_if_false ££cp_wait_model   $cp_z = 6.502CE: $cp_z = ground_z $cp_x  $cp_y $cp_z00A5: $cp_handle = create_car $cp_model at $cp_x $cp_y $cp_z  0175: set_car $cp_handle z_angle_to $cp_rz  0229: set car $cp_handle color to  $cp_pcol $cp_scol 020A: set car $cp_handle door status to  1set_array $cp_handle ;-------------------------; ITERATE OVER ALL SLOTS;-------------------------:cp_recreate_next $cp_type_index +=  1  if 0  NOT  40 > $cp_type_index  jump_if_false ££cp_recreate_loop 

 

It uses the array support barton build into his mission builder.

 

 

 

This is the part that stores the basic-info ( model and colors ) in the arrays:

 

:cp_carpark_store03C1: $cp_handle = player $PLAYER_CHAR car ; Code model, pcolor and scolor onto 1 variable0441: $cp_type = car $cp_handle model  integer [email protected] = $cp_type$cp_type *= 65536integer $cp_handle_index = $cp_type_index03F3: get car $cp_handle color  [email protected]  [email protected]@ *= 256integer $cp_type += [email protected] $cp_type += [email protected]_array $cp_type       set_array $cp_handleinteger $cp_new_car = $cp_type_index $cp_nof_cars += 1jump ££cp_carpark_end 

 

 

And this part updates the position of all the vehciles in the garage into the arrays:

 

$cp_type_index = 0:cp_walk_loopif 0  40 > $cp_type_index jump_if_false ££cp_carpark_endget_array $cp_typeif 0  NOT $cp_type == -1jump_if_false ££cp_walk_next;--------------------------; SLOT IS OCCUPIED;--------------------------integer $cp_handle_index = $cp_type_indexinteger $cp_x_index = $cp_type_indexinteger $cp_y_index = $cp_type_indexinteger $cp_rz_index = $cp_type_indexget_array $cp_handle        00AA: store_car $cp_handle position_to $cp_x $cp_y [email protected]: $cp_rz = car $cp_handle z_angleset_array $cp_x set_array $cp_yset_array $cp_rz :cp_walk_next$cp_type_index +=  1  0002: jump ££cp_walk_loop 

 

 

 

The arrays are globals variables, and as such are automaticly saved and loaded during the normal procedure..

 

Share this post


Link to post
Share on other sites
gta_matt

Will it store modded cars for san andreas?VC only had model and color.

Share this post


Link to post
Share on other sites
Y_Less
Not at the moment, until Pat (or someone else) code's it to (after first figuring out how).

Share this post


Link to post
Share on other sites
GangsterAngel

What are the arguments?

 

715.806, -462.403, 14.9635, 724.293, -462.403, 715.806, -447.29, 21.4398, 1, 5,

 

Arg 1

Arg 2

Arg 3

Arg 4

Arg 5

Arg 6

Arg 7

Arg 8

 

Share this post


Link to post
Share on other sites
nubbel

Thank you Patrick, I will atleast play around a bit to learn more basics. But it's too advanced for me at the moment I would say.

 

If the first carpark garage for GTA SA allows you to save modded cars is not important in my opinion. I'm seeing forward to have any garage that stores more than 4 cars rolleyes.gif

Share this post


Link to post
Share on other sites
PatrickW

yeah, more stuff needs to be stored for SA.

Hopefully SA also has some opcodes that weren't present in VC, that allow you to obtain a car's immunities, and current model-variation, so that those can also be stored (which wasn't possible for VC).

 

The basics should be easily to transfer to SA, but to get it owrking perfectly ( and that is what I'm always aiming for) some proper research is needed.

 

As I've stated before, a carpark mod is on my ToDo list, and I will try to get it working perfectly. I still have a (never released) version for VC (90% finished) that can also store boats and heli's, whioch also contains much more optimised code (storage/speed wise).

 

I'm very curious to see your progress....

Share this post


Link to post
Share on other sites
Y_Less

 

What are the arguments?

 

715.806, -462.403, 14.9635, 724.293, -462.403, 715.806, -447.29, 21.4398, 1, 5,

 

Arg 1

Arg 2

Arg 3

Arg 4

Arg 5

Arg 6

Arg 7

Arg 8

What opcode did you take them from? Arguments 3 and 4 are infact 2 seperate ones so there are 8 co-ordinate like parameters, which isn't a multiple of 3 so can't be all x,y,z's and the 4th and 8th aren't rotations either

 

Edit: just realised what you are on about, there are still actually 8 co-ordinate parameters, x1 y1 z1 x2 y2 z2 x3 y3 and 2 flags or other pieces of data about which I don't know. (xyz)1 define one corner of the garage, (xyz)2 define the far corner, and all the area contained within them is the garage and (xy)3 defines where the front of the garage is (usually a point half way along where you want the door to be along the fromt wall.

Edited by Y_Less

Share this post


Link to post
Share on other sites
Guill

 

Hey guys, I figured something out. When you create a garage area from IPL files using below parameters, the camera acts normal, like there is no garage area:

 

 

1  2  3   4  5   6  7  8   9   10   11------------------------------------------X, Y, Z,  X, Y,  X, Y, Z,  5,  31,  NAME1-3: The x, y and z coordinate lower left front4-5: The x, y coordinate lower right front6-8: The x, y, z coordinate top left back9: Garage type anyhow (most times 1)10: Unknown (may interact with parameter 9 ?!?)11: Identifier / Name

 

 

The parameter 9 when set to 5 lets the camera act normal. But I guess thats just a side effect. Value 5 has e.g. the big hangar in the desert, and one safehouse in Los Santos. I have no clue what parameter 10 does.

 

These garages areas can hold 4 cars.

This what u need GangsterAngel?

Share this post


Link to post
Share on other sites
V41N

Wow, thanks a million Patrick! inlove.gif Good commenting in the code as well.

 

Oh, so the ability to use arrays is built-in with Barton's builders (I now noticed this was in the read_me file tounge.gif ). And these arrays are automatically persistant globals (persistant between game sessions)?

 

I also noticed many lines starting with "integer". I noticed it's not using an opcode, is this another global variable?

 

Nevermind, I just found this:

 

To copy a global variable containing an integer number

to another global variable, use

INT $<global variable name> = $<global variable name>

or INTEGER $<global variable name> = $<global variable name>

 

and I noticed this as well:

 

4.8.1  Setting variables

 

To set a global variable to an integer value, use

$<global variable name> = <integer number>

 

So I guess my main question is are all global variables saved and loaded? As in if a global integer is set durring the game, then they exit back to windows and run it again, will the integer load back to what it was set to durring the game?

 

I attempted to port some of the code into the builder and it doesn't seem to understand what to do with the array lines (figured as much). I checked the read_me and found this about arrays:

 

 

4.3.1.2  Defining arrays / allocating memory for arrays / redefining arrays

 

This only applies to custom global arrays (meaning arrays with a custom global

variable name). All you need to do to define one is to use this:

 

  <custom global variable name>(<any variable as index>,<number of elements in the array><array type>)

 

Example code:

  @1 = 0

  $CustomArray(@1,10i) = 0  ; "reserves" 44 bytes (40 used) of memory. The memory can be

                            ; changed using "methods of direct memory access"

  $CustomArray(1) = 1

  $CustomArray(2) = 2

  $CustomArray(3) = 3

  $CustomArray(4) = 4

  $CustomArray(5) = 5

  $CustomArray(6) = 6

  $CustomArray(7) = 7

  $CustomArray(8) = 8

  $CustomArray(9) = 9

  ; $CustomArray(10) would be out of range

 

 

Looks like the new format for arrays (same as used for save points).. Guessing the comments show why it's limited to 40 cars? Is this only limited to this particular array or all arrays that are created? I mean if you had separate arrays for seperate garages would they both hold 40?

 

 

Edit: Evidentally the only thing I can't figure out how to convert to SA in the builder is the lines for "get_array" and "set_array". I think these may actually not be needed as the way the other scripts use arrays is like:

 

arrayname(index) = whatever

 

I think that's all you have to do to actually 'set' the value for that index of that array. I could be wrong though. Have no clue as far as 'get_array'. Perhaps this could be done using another loop. Like checking the first index and adding 1 and looping until you reach the max... Just a thought.

 

 

FYI: Here is my next goal for a mod. I would like to create a persistant parking lot (with a default view-distance and such). I would also like to keep this code portable and able to easily be added to so that any coder (and maybe average player) could use the script to create multiple persistant parking lots wherever they like (including parking garages). This wouldn't require the use of a gate either, but rather a simple text message stating "Parking Lot is Full" to notify the player that the vehicle would not be saved if they left it there.

 

Complicated, yes, especially with the newer vehicle properties. But with the sample of PatrickW's genious mod this may proove to be a successful and very popular mod. Let me know what you think.

Edited by NDG474

Share this post


Link to post
Share on other sites
Demarest

So I guess my main question is are all global variables saved and loaded?

A game save is a memory dump. All threads, their current position, variables, etc are saved. In SA, it's been said that external scripts are NOT saved just as in GTA3 and VC, you could not save while on a mission. Certain things just didn't survive the reload.

 

 

Guessing the comments show why it's limited to 40 cars?  Is this only limited to this particular array or all arrays that are created? I mean if you had separate arrays for seperate garages would they both hold 40?

I believe that Patrick's research revealed that the engine could only handle having to reference 40 vehicles at any given time. I would think that for as long as you don't require the game to map our more global vars than it can, you could have multiple garages so long as your code under no circumstances would be trying to populate more than one. Of course, you could always just have each one hold LESS than 40, but the juggernaut would never admit to that being possible tounge.gif

 

 

Edit: Evidentally the only thing I can't figure out how to convert to SA in the builder is the lines for "get_array" and "set_array".

I could be mistaken, but I believe that Patrick's arrays are manual and that SA actually supports this feature to begin with.

 

 

This wouldn't require the use of a gate either, but rather a simple text message stating "Parking Lot is Full" to notify the player that the vehicle would not be saved if they left it there.

Generically speaking, in coding, when dealing with a limited array with the possibility of overflow, you simply set it up as a revolving array. So in the case of a 40 car parking lot, if car 41 is deposited, it would overwrite car 1 like so

 

$carnumber = carnumber+1if $carnumber>40jf nextlabel$carnumber = carnumber-40nextlabelarrayname[$carnumber]...

 

This would prevent a crash. In the area where you subtract 40, you could first have a text prompt to inform them the first car would be overwritten. Then have the code sniff to see if they're actually leaving it. If so, then they must be okay with it. Of course, if I'm right about Patrick's research, even approaching the area with a 41st car would make the engine either crash or devour a car (furthest one). If it did that, the player might not even have the chance to grab the first and take off with it to save it. Of course, we're still talking about an insane amount of vehicles and I don't see anybody even in SA trying to maintain that many. tounge.gif

 

Bottom line though: we love dedicated modders willing to learn and put forth the effort. So be sure to keep up your enthusiasm. smile.gif

Share this post


Link to post
Share on other sites
nubbel

Well, I read a bit through the marina carpark code and the readme of Bartons Editor and tried some coding stuff (though I'm a noob):

 

Here is what I yet coded: garage_scm.txt

 

2 threats:

1 that checks if you are in the garage cube in a car, stores the car handle and the type in an array and puts you out of the car.

The other threat should check if you are near the area and then load the data from the 2 arrays (if not already loaded), creates the color + postion of each car from the handle and then create the cars.

 

At least the game doesn't crash tounge.gif

But seems that nothing or nothing usable is saved. Or maybe the loading thread doesn't work.

But I guess there are just lots of general faults, it was just a try. Using arrays and loops is really dusgusting in this programing language suicidal.gif

 

Maybe anyone wants to read the code, don't know tounge.gif

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • 1 User Currently Viewing
    0 Members, 0 Anonymous, 1 Guest

×

Important Information

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