Quantcast

Jump to content

» «
Photo

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

9 replies to this topic
Automan
  • Automan

    Grandfather Modder

  • Members
  • Joined: 13 Dec 2008
  • Italy

#1

Posted 10 December 2015 - 01:21 PM

For this tutorial I based on a script Albreht:
http://gtaforums.com...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] struct

[email protected] += 1612

0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0

if

   not [email protected] == 0

else_jump @MB_SL_R_514 // Actor is in car?

[email protected] += 152

0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0

if

   not [email protected] == 0

else_jump @MB_SL_R_514 // Actor is in car?

[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_261

095F: get_car [email protected] door 5 angle_to [email protected]

if

   not [email protected] == 0.0

else_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] += 48

0A8C: write_memory [email protected] size 4 value 0.1 virtual_protect 0 // transverse +0.1 meter

[email protected] += 4
0A8C: write_memory [email protected] size 4 value -0.1 virtual_protect 0 // lateral -1.0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -0.3 virtual_protect 0 // lateral -1.0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -0.5 virtual_protect 0 // lateral -1.0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -0.7 virtual_protect 0 // lateral -1.0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -1.0 virtual_protect 0 // lateral -1.0 meter
[email protected] += 4

0A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // vertical NOT

[email protected] -= 56
//----------------
:MB_SL_R_262

wait 0

095F: get_car [email protected] door 5 angle_to [email protected]

if

   [email protected] == 0.0

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

[email protected] += 52
0A8C: write_memory [email protected] size 4 value -0.7 virtual_protect 0 // lateral 0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -0.5 virtual_protect 0 // lateral 0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -0.3 virtual_protect 0 // lateral 0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -0.1 virtual_protect 0 // lateral 0 meter

wait 1

0A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // lateral 0 meter
[email protected] -= 4

0A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // transverse 0 meter
[email protected] += 8

0A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // vertical NOT

[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_19

wait 0

if and

056D:   actor $PLAYER_ACTOR defined

   Player.Defined($PLAYER_CHAR)

else_jump @MB_SL_R_19
0A8D: [email protected] = read_memory 12010644 size 4 virtual_protect 0

[email protected] += 4

0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0

[email protected] = 0
//----------------
:MB_SL_R_91

0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

[email protected] += 1

if and

  [email protected] >= 0

  128 > [email protected]

else_jump @MB_SL_R_514
005A: [email protected] += [email protected] // (int)

if

   Car.Model([email protected]) == #MOONBEAM

else_jump @MB_SL_R_514
//=====================================
0A97: [email protected] = car [email protected] struct

[email protected] += 1612

0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
if

   not [email protected] == 0

else_jump @MB_SL_R_514

[email protected] += 152

0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
if

   not [email protected] == 0

else_jump @MB_SL_R_514

[email protected] += 16 // 2° 3D mesh.
//=====================================
:MB_SL_R_261

095F: get_car [email protected] door 5 angle_to [email protected]

if

   not [email protected] == 0.0

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

[email protected] += 48

0A8C: write_memory [email protected] size 4 value 0.1 virtual_protect 0 // transverse +0.1 meter

[email protected] += 4
0A8C: write_memory [email protected] size 4 value -0.1 virtual_protect 0 // lateral -1.0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -0.3 virtual_protect 0 // lateral -1.0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -0.5 virtual_protect 0 // lateral -1.0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -0.7 virtual_protect 0 // lateral -1.0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -1.0 virtual_protect 0 // lateral -1.0 meter
[email protected] += 4

0A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // vertical NOT

[email protected] -= 56
//----------------
:MB_SL_R_262

wait 0

095F: get_car [email protected] door 5 angle_to [email protected]

if

   [email protected] == 0.0

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

[email protected] += 52
0A8C: write_memory [email protected] size 4 value -0.7 virtual_protect 0 // lateral 0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -0.5 virtual_protect 0 // lateral 0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -0.3 virtual_protect 0 // lateral 0 meter

wait 1

0A8C: write_memory [email protected] size 4 value -0.1 virtual_protect 0 // lateral 0 meter

wait 1

0A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // lateral 0 meter
[email protected] -= 4

0A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // transverse 0 meter
[email protected] += 8

0A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 0 // vertical NOT

[email protected] -= 56
//=====================================
:MB_SL_R_514

[email protected] += 256

  [email protected] > 35584

else_jump @MB_SL_R_91

jump @MB_SL_R_19

  • Norway-_-1999 likes this

Lord Kiri
  • Lord Kiri

    Best Ped Rigger

  • Members
  • Joined: 29 Mar 2015
  • Trinidad-and-Tobago

#2

Posted 19 December 2015 - 09:04 PM

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


Automan
  • Automan

    Grandfather Modder

  • Members
  • Joined: 13 Dec 2008
  • Italy

#3

Posted 20 December 2015 - 10:30 AM

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


Nathan Ferdinand
  • Nathan Ferdinand

    Go fast, go further.

  • Members
  • Joined: 06 Jun 2012
  • United-Kingdom

#4

Posted 29 December 2015 - 08:29 AM

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


Automan
  • Automan

    Grandfather Modder

  • Members
  • Joined: 13 Dec 2008
  • Italy

#5

Posted 29 December 2015 - 09:53 AM

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. :)


Nathan Ferdinand
  • Nathan Ferdinand

    Go fast, go further.

  • Members
  • Joined: 06 Jun 2012
  • United-Kingdom

#6

Posted 29 December 2015 - 03:44 PM

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.


Automan
  • Automan

    Grandfather Modder

  • Members
  • Joined: 13 Dec 2008
  • Italy

#7

Posted 29 December 2015 - 06:09 PM

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


ngr_ardiansyah
  • ngr_ardiansyah

    Trouble_makeR

  • Members
  • Joined: 30 Jan 2014
  • Indonesia

#8

Posted 11 January 2016 - 04:04 AM

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


Automan
  • Automan

    Grandfather Modder

  • Members
  • Joined: 13 Dec 2008
  • Italy

#9

Posted 11 January 2016 - 08:57 AM

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.


Automan
  • Automan

    Grandfather Modder

  • Members
  • Joined: 13 Dec 2008
  • Italy

#10

Posted 22 November 2017 - 07:35 PM

New method for all rear doors:

http://gtaforums.com...-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....





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users