GTA MOD FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.
GTA MOD FORUM

製作日記から質問までMODに関する話題ならなんでもOKです


You are not connected. Please login or register

[TUT|WIP] Sliding Doors (with ZM2)

2 posters

Go down  メッセージ [Page 1 of 1]

Automan

Automan

Hello everyone!
I am Automan, I made the Misterix mod, Gundam and other.
I should contact Mr Albreht , in order to complete my tutorial. Can someone help me? Many thanks!

vvvvvvvvvvvvv

For this tutorial I based on a Cleo script Albreht:

With Cleo script we can only handle rotation doors.
They are considered doors also bonnet and boot, more precisely defined components.
Code:

08A6: set_car 0@ componentA 4 rotation_to 0.0 // close, 0°
08A6: set_car 0@ 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:
Code:

0AA6: call_method 5878048 struct 31@ num_params 3 pop 0 0.0 0.0 0.0
The component 31@ must look for it, and honestly this part of me is still obscure:
Code:

0A97: 31@ = car 26@ struct
31@ += 1612
0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0
if
   not 31@ == 0
else_jump @MB_SL_R_514 // Actor is in car?
31@ += 152
0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0
if
   not 31@ == 0
else_jump @MB_SL_R_514 // Actor is in car?
31@ += 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:
link: http://postimg.org/image/mqczxolzx/
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.
link: http://postimg.org/image/gnshyzs41/
Unfortunately, instead of seeking the 3rd 3D mesh, we should look for the 4th!

Our hierarchy will therefore be made necessarily so:
link: http://postimg.org/image/6g4tdwxif/
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! Smile
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:
Code:

:MB_SL_R_261
095F: get_car 26@ door 5 angle_to 12@
if
   not 12@ == 0.0
else_jump @MB_SL_R_514  // Actor is in car?

0AA6: call_method 5878048 struct 31@ num_params 3 pop 0 0.0 0.0 0.0  
31@ += 48
0A8C: write_memory 31@ size 4 value 0.1 virtual_protect 0 // transverse +0.1 meter
31@ += 4

0A8C: write_memory 31@ size 4 value -0.1 virtual_protect 0 // lateral -1.0 meter
wait 1
0A8C: write_memory 31@ size 4 value -0.3 virtual_protect 0 // lateral -1.0 meter
wait 1
0A8C: write_memory 31@ size 4 value -0.5 virtual_protect 0 // lateral -1.0 meter
wait 1
0A8C: write_memory 31@ size 4 value -0.7 virtual_protect 0 // lateral -1.0 meter
wait 1
0A8C: write_memory 31@ size 4 value -1.0 virtual_protect 0 // lateral -1.0 meter

31@ += 4
0A8C: write_memory 31@ size 4 value 0.0 virtual_protect 0 // vertical NOT
31@ -= 56

//----------------

:MB_SL_R_262
wait 0
095F: get_car 26@ door 5 angle_to 12@
if
   12@ == 0.0
else_jump @MB_SL_R_262

0AA6: call_method 5878048 struct 31@ num_params 3 pop 0 0.0 0.0 0.0  
31@ += 52

0A8C: write_memory 31@ size 4 value -0.7 virtual_protect 0 // lateral 0 meter
wait 1
0A8C: write_memory 31@ size 4 value -0.5 virtual_protect 0 // lateral 0 meter
wait 1
0A8C: write_memory 31@ size 4 value -0.3 virtual_protect 0 // lateral 0 meter
wait 1
0A8C: write_memory 31@ size 4 value -0.1 virtual_protect 0 // lateral 0 meter
wait 1
0A8C: write_memory 31@ size 4 value 0.0 virtual_protect 0 // lateral 0 meter

31@ -= 4
0A8C: write_memory 31@ size 4 value 0.0 virtual_protect 0 // transverse 0 meter

31@ += 8
0A8C: write_memory 31@ size 4 value 0.0 virtual_protect 0 // vertical NOT
31@ -= 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:
Code:

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:
link: http://postimg.org/image/e1ug3zvq5/

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 first 3D mesh, I hope to find soon the 4th 3D mesh in structure of the memory game!
Code:

{$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: 27@ = read_memory 12010644 size 4 virtual_protect 0
27@ += 4
0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0
28@ = 0

//----------------

:MB_SL_R_91
0A8D: 26@ = read_memory 27@ size 1 virtual_protect 0
27@ += 1
if and
  26@ >= 0
  128 > 26@
else_jump @MB_SL_R_514

005A: 26@ += 28@ // (int)
if
   Car.Model(26@) == #MOONBEAM
else_jump @MB_SL_R_514

//=====================================

0A97: 31@ = car 26@ struct
31@ += 1612
0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0

if
   not 31@ == 0
else_jump @MB_SL_R_514
31@ += 152
0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0

if
   not 31@ == 0
else_jump @MB_SL_R_514
31@ += 16 // 2° 3D mesh.

//=====================================

:MB_SL_R_261
095F: get_car 26@ door 5 angle_to 12@
if
   not 12@ == 0.0
else_jump @MB_SL_R_514

0AA6: call_method 5878048 struct 31@ num_params 3 pop 0 0.0 0.0 0.0  
31@ += 48
0A8C: write_memory 31@ size 4 value 0.1 virtual_protect 0 // transverse +0.1 meter
31@ += 4

0A8C: write_memory 31@ size 4 value -0.1 virtual_protect 0 // lateral -1.0 meter
wait 1
0A8C: write_memory 31@ size 4 value -0.3 virtual_protect 0 // lateral -1.0 meter
wait 1
0A8C: write_memory 31@ size 4 value -0.5 virtual_protect 0 // lateral -1.0 meter
wait 1
0A8C: write_memory 31@ size 4 value -0.7 virtual_protect 0 // lateral -1.0 meter
wait 1
0A8C: write_memory 31@ size 4 value -1.0 virtual_protect 0 // lateral -1.0 meter

31@ += 4
0A8C: write_memory 31@ size 4 value 0.0 virtual_protect 0 // vertical NOT
31@ -= 56

//----------------

:MB_SL_R_262
wait 0
095F: get_car 26@ door 5 angle_to 12@
if
   12@ == 0.0
else_jump @MB_SL_R_262

0AA6: call_method 5878048 struct 31@ num_params 3 pop 0 0.0 0.0 0.0  
31@ += 52

0A8C: write_memory 31@ size 4 value -0.7 virtual_protect 0 // lateral 0 meter
wait 1
0A8C: write_memory 31@ size 4 value -0.5 virtual_protect 0 // lateral 0 meter
wait 1
0A8C: write_memory 31@ size 4 value -0.3 virtual_protect 0 // lateral 0 meter
wait 1
0A8C: write_memory 31@ size 4 value -0.1 virtual_protect 0 // lateral 0 meter
wait 1
0A8C: write_memory 31@ size 4 value 0.0 virtual_protect 0 // lateral 0 meter

31@ -= 4
0A8C: write_memory 31@ size 4 value 0.0 virtual_protect 0 // transverse 0 meter

31@ += 8
0A8C: write_memory 31@ size 4 value 0.0 virtual_protect 0 // vertical NOT
31@ -= 56

//=====================================

:MB_SL_R_514
28@ += 256
  28@ > 35584
else_jump @MB_SL_R_91
jump @MB_SL_R_19

http://www.gtanetwork.it

Ninja Panda

Ninja Panda

It's great Very Happy
Can you upload the sample?

http://ninjamod.web.fc2.com/

Automan

Automan

Certainly, it is a pleasure! Very Happy
I hope to resolve soon the possibility to have two sliding doors. Smile

New members are not allowed to post external links or emails for 7 days. Please contact the forum administrator for more information.
Crying or Very sad

Screen:
s27.postimg.org/to7a0qqoj/Screen_Sliding_Door.jpg

Download:
vvv. mediafire.com/download/mg769hbkujcucm9/GTASA_Sliding_Doors_Tool-tutorial.rar

http://www.gtanetwork.it

Ninja Panda

Ninja Panda

I'm sorry slow reply Sad
thank you for this tutorial, since i have the original file, I'll upload it.
http://www.mediafire.com/download/p14pyznnm8i8tbt/Slide_Door%5Brel20130212%5D.zip

http://ninjamod.web.fc2.com/

Automan

Automan

Very thanks! Smile

http://www.gtanetwork.it

Automan

Automan

Hi! Smile
New version, simpler but fully functional! Smile

-Video:
https://www.youtube.com/watch?v=Pqx8vlfgfw4

-Script:
Code:

{$CLEO .cs}
thread 'SlidoorL'
0000: NOP

:SR_start
wait 0
if
Actor.DrivingVehicleType($PLAYER_ACTOR, #CABBIE)
jf @SR_start

03C0: 0@ = actor $PLAYER_ACTOR car
095F: get_car 0@ door 4 angle_to 12@

wait 0
if
   not 12@ == 0.0
else_jump @SR_start
:SR_open_enter1

095F: get_car 0@ door 4 angle_to 12@
12@ *= 10
0085: 13@ = 12@ // (int)

wait 0
if
   13@ > 8
else_jump @SR_open_enter1

073C: car 0@ damage_component 4
:SR_open_enter2

095F: get_car 0@ door 4 angle_to 12@
wait 0
if
   0.8 > 12@
else_jump @SR_open_enter2
:SR_open_enter3

095F: get_car 0@ door 4 angle_to 12@

wait 0
if
   12@ == 0.0
else_jump @SR_open_enter3

068A: set_car 0@ repair_componentA 4
jump @SR_start

0A93: end_custom_thread

Code:

{$CLEO .cs}
thread 'SlidoorR'
0000: NOP

:SR_start
wait 0
if
Actor.DrivingVehicleType($PLAYER_ACTOR, #CABBIE)
jf @SR_start

03C0: 0@ = actor $PLAYER_ACTOR car
095F: get_car 0@ door 5 angle_to 12@

wait 0
if
   not 12@ == 0.0
else_jump @SR_start
:SR_open_enter1

095F: get_car 0@ door 5 angle_to 12@
12@ *= 10
0085: 13@ = 12@ // (int)

wait 0
if
   13@ > 8
else_jump @SR_open_enter1

073C: car 0@ damage_component 5
:SR_open_enter2
095F: get_car 0@ door 5 angle_to 12@

wait 0
if
   0.8 > 12@
else_jump @SR_open_enter2
:SR_open_enter3

095F: get_car 0@ door 5 angle_to 12@

wait 0
if
   12@ == 0.0
else_jump @SR_open_enter3

068A: set_car 0@ repair_componentA 5
jump @SR_start

0A93: end_custom_thread

-ZModeler2 Screen:
https://2img.net/h/s26.postimg.cc/qj7diwc8p/Slidoor_ZM2a.jpg

https://2img.net/h/s26.postimg.cc/t1t2jkxyx/Slidoor_ZM2b.jpg

https://2img.net/h/s26.postimg.cc/98lk4m9yx/Slidoor_ZM2c.jpg

-Download Test:
http://www.mediafire.com/file/39laedra232vu8s/GTAsaSlidingDoors.rar

http://www.gtanetwork.it

Sponsored content



トップに戻る  メッセージ [Page 1 of 1]

Permissions in this forum:
返信投稿: 不可