Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (92,908 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

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

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. 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

    2. Red Dead Redemption

    3. 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. Forum Support

    2. Site Suggestions

Sign in to follow this  
Automan

[SA|TUT|WIP] Sliding Doors (with ZM2)

Recommended Posts

Automan

For this tutorial I based on a script Albreht:
http://gtaforums.com/user/631482-albreht/
which I think is no longer active... :(
.
With Cleo script we can only handle rotation doors.
They are considered doors also bonnet and boot, more precisely defined components.

08A6: set_car [email protected] componentA 4 rotation_to 0.0 // close, 0°08A6: set_car [email protected] componentA 4 rotation_to 1.0 // open, ~45° boot/bonnet, ~ 80° doors.

The list of components is:
0 -Bonnet
1 - Boot
2 - Left Front Door
3 - Right Front Door
4 - Left Rear Door
5 - Right Rear Door
.
We are interested only component 4 and 5. The rear doors.
The concept is to have a component 3D mesh in the 3D file .dff, to move instead of rotating.
Since it can not begin working classics, using a method that acts directly on the memory of the game:

0AA6: call_method 5878048 struct [email protected] num_params 3 pop 0 0.0 0.0 0.0

The component [email protected] must look for it, and honestly this part of me is still obscure:

0A97: [email protected] = car [email protected] [email protected] += 16120A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0if   not [email protected] == 0else_jump @MB_SL_R_514 // Actor is in [email protected] += 1520A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0if   not [email protected] == 0else_jump @MB_SL_R_514 // Actor is in [email protected] += 16 // 2° 3D mesh.

As we indicated, in our case is the 2# 3D mesh in the file .dff, immediately after the 3D chassis.
.
I must say that in any case our 3D mesh will not be any, but the rear doors themselves. Why?!...
Because ZM2 sides with glass are always an issue, unfortunately!
Not only that, the part with the glass must be separated from the rest, and put in a parent/child relationship in the hierarchy:
fig1.jpg
There is another problem, even if this does not occur with a non-standard 3D mesh. If the model has an extra heavy, about 10,000 polygons, this will not be seen through the glass...
.
Sometimes we are lucky, and in this case moving the 3D mesh parent also will move the 3D mesh child.
fig2.jpg
Unfortunately, instead of seeking the 3rd 3D mesh, we should look for the 4th! XD
.
Our hierarchy will therefore be made necessarily so:
fig3.jpg
Why 3D doors are not within their dummy? ...
Because otherwise the program would rotate them and they would move at the same time.
Why then the doors dummies are the same?
Because else peds would not know where to go! :)
It is important that the doors dummies are positioned correctly on the basis of 3D doors, otherwise peds have also problems to enter in the vehicle...
Where do they place the Axes of 3D doors? At the center, "Reset to the World."
This is because the scripts of movement start from there, and the place still Axes 3D doors of the center.
.
Manage the movement of 3D doors is simple. I added the effect of the movement, instead of moving only:

:MB_SL_R_261095F: get_car [email protected] door 5 angle_to [email protected]   not [email protected] == 0.0else_jump @MB_SL_R_514  // Actor is in car?0AA6: call_method 5878048 struct [email protected] num_params 3 pop 0 0.0 0.0 0.0 [email protected] += 480A8C: write_memory [email protected] size 4 value 0.1 virtual_protect 0 // transverse +0.1 [email protected] += 40A8C: write_memory [email protected] size 4 value -0.1 virtual_protect 0 // lateral -1.0 meterwait 10A8C: write_memory [email protected] size 4 value -0.3 virtual_protect 0 // lateral -1.0 meterwait 10A8C: write_memory [email protected] size 4 value -0.5 virtual_protect 0 // lateral -1.0 meterwait 10A8C: write_memory [email protected] size 4 value -0.7 virtual_protect 0 // lateral -1.0 meterwait 10A8C: write_memory [email protected] size 4 value -1.0 virtual_protect 0 // lateral -1.0 [email protected] += 40A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // vertical [email protected] -= 56//----------------:MB_SL_R_262wait 0095F: get_car [email protected] door 5 angle_to [email protected]   [email protected] == 0.0else_jump @MB_SL_R_2620AA6: call_method 5878048 struct [email protected] num_params 3 pop 0 0.0 0.0 0.0 [email protected] += 520A8C: write_memory [email protected] size 4 value -0.7 virtual_protect 0 // lateral 0 meterwait 10A8C: write_memory [email protected] size 4 value -0.5 virtual_protect 0 // lateral 0 meterwait 10A8C: write_memory [email protected] size 4 value -0.3 virtual_protect 0 // lateral 0 meterwait 10A8C: write_memory [email protected] size 4 value -0.1 virtual_protect 0 // lateral 0 meterwait 10A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // lateral 0 [email protected] -= 40A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // transverse 0 [email protected] += 80A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // vertical [email protected] -= 56

When the door is opened, the angle is not more than zero, and the door is moved.
When closed, the angle returns to zero, and the door reverses.
This happens as a result, and no matter whether the ped goes up or down.
The control:

else_jump @MB_SL_R_514  // Actor is in car?

only it serves to open the door. Especially if the car exploded when everyone is still inside! XD
As shown the movement is simple to guess; transverse movement is in a single solution by 0.1 meters. That lateral is in 5 steep to 1.0 meters.
Vertical not there. Obviously this depends on the position and size of the doors.
To manage the correct offset:
fig4.jpg
.
It is appropriate to have two separate scripts, one for the left rear door and one for the right rear door.
For now I can only handle a 3D mesh, I hope to find soon the 4th 3D mesh!

{$CLEO .cs}thread 'MB_SLIDE_DOOR_R':MB_SL_R_19wait 0if and056D:   actor $PLAYER_ACTOR defined   Player.Defined($PLAYER_CHAR)else_jump @MB_SL_R_190A8D: [email protected] = read_memory 12010644 size 4 virtual_protect [email protected] += 40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect [email protected] = 0//----------------:MB_SL_R_910A8D: [email protected] = read_memory [email protected] size 1 virtual_protect [email protected] += 1if and  [email protected] >= 0  128 > [email protected]_jump @MB_SL_R_514005A: [email protected] += [email protected] // (int)if   Car.Model([email protected]) == #MOONBEAMelse_jump @MB_SL_R_514//=====================================0A97: [email protected] = car [email protected] [email protected] += 16120A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0if   not [email protected] == 0else_jump @[email protected] += 1520A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0if   not [email protected] == 0else_jump @[email protected] += 16 // 2° 3D mesh.//=====================================:MB_SL_R_261095F: get_car [email protected] door 5 angle_to [email protected]   not [email protected] == 0.0else_jump @MB_SL_R_5140AA6: call_method 5878048 struct [email protected] num_params 3 pop 0 0.0 0.0 0.0 [email protected] += 480A8C: write_memory [email protected] size 4 value 0.1 virtual_protect 0 // transverse +0.1 [email protected] += 40A8C: write_memory [email protected] size 4 value -0.1 virtual_protect 0 // lateral -1.0 meterwait 10A8C: write_memory [email protected] size 4 value -0.3 virtual_protect 0 // lateral -1.0 meterwait 10A8C: write_memory [email protected] size 4 value -0.5 virtual_protect 0 // lateral -1.0 meterwait 10A8C: write_memory [email protected] size 4 value -0.7 virtual_protect 0 // lateral -1.0 meterwait 10A8C: write_memory [email protected] size 4 value -1.0 virtual_protect 0 // lateral -1.0 [email protected] += 40A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // vertical [email protected] -= 56//----------------:MB_SL_R_262wait 0095F: get_car [email protected] door 5 angle_to [email protected]   [email protected] == 0.0else_jump @MB_SL_R_2620AA6: call_method 5878048 struct [email protected] num_params 3 pop 0 0.0 0.0 0.0 [email protected] += 520A8C: write_memory [email protected] size 4 value -0.7 virtual_protect 0 // lateral 0 meterwait 10A8C: write_memory [email protected] size 4 value -0.5 virtual_protect 0 // lateral 0 meterwait 10A8C: write_memory [email protected] size 4 value -0.3 virtual_protect 0 // lateral 0 meterwait 10A8C: write_memory [email protected] size 4 value -0.1 virtual_protect 0 // lateral 0 meterwait 10A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // lateral 0 [email protected] -= 40A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // transverse 0 [email protected] += 80A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // vertical [email protected] -= 56//=====================================:[email protected] += 256  [email protected] > 35584else_jump @MB_SL_R_91jump @MB_SL_R_19

Share this post


Link to post
Share on other sites
Lord Kiri

sliding doors will be very useful in my vehicle conversions but i dont understand anything said here xD :'(

Share this post


Link to post
Share on other sites
Automan

Nothing is a bit too much, I can just quote all! X( X( X(

Share this post


Link to post
Share on other sites
Nathan Ferdinand

You don't actually need those scripts to make the sliding doors work.

Izerli has those scripts to make everything work:

https://youtu.be/LKevmJ36vaI

Share this post


Link to post
Share on other sites
Automan

Thanks! :)

As I said there are four issues that are not taken into account in the other mod:
1) Sliding door of a single door.
2) With ZM2 must have the 3D door glasses separate.
3) Not must be the player to activate the door, but the Ped entering by car.
4) The displacement must not be instantaneous.
Unfortunately I can not see the video until December 31, and I do not know if the model shown satisfies these four points. :)

Share this post


Link to post
Share on other sites
Nathan Ferdinand

Let me explain how those things work:

 

BEFORE:

gta_sa2015-12-2912-07kpsrp.png

 

IN PROCESS:

gta_sa2015-12-2912-073wsyf.png

 

Explanation: glass is attached to the door, because the door part must be a single mesh, and damaged parts won't work with this. The glass is transparent.

 

AFTER:

gta_sa2015-12-2912-0699sy6.png

 

Later, I will send you an example model containing this sliding door method.

Share this post


Link to post
Share on other sites
Automan

Mmm ... Step 3 is not satisfied! :D

Share this post


Link to post
Share on other sites
ngr_ardiansyah

is it possible for koenigsegg style doors? (rotating while moving to side and forward)

Share this post


Link to post
Share on other sites
Automan

Yes, it is possible.
My master Wesser made a script for the sliding doors, but always open from Player.
The interesting thing is that it uses the component door_xx_ok, so if control passes to the opening program, intercepting when the rotation is the same as or different from zero as in my script, the doors will be moved and rotated.
No good for the only sliding doors, though, because they would always rotated.

Share this post


Link to post
Share on other sites
Automan

New method for all rear doors:

http://gtaforums.com/topic/899574-sareltut-sliding-doors/

 

For front doors, like koenigsegg, this opcode is needed:

opcodesearch.jpg

because as long as the player is not in the vehicle, the model is unavailable for manipulating its parts, with the current opcode....

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

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