0
djbozkosz

Tutorial by djbozkosz: Destructible Objects

Recommended Posts

Hi, I wrote a short :) tutorial, how to create valid destructible objects.

 

Requirements: Zmodeler, Mafia World Editor and some Hex Editor

 

screen08.jpg

 

At first, something about this objects:

 

These models have levels of destruction, which are stored in separate models with "_cn" suffix.

Eg: my_model.4ds - non destructed model

my_model_c1.4ds - first level of destructed model

my_model_c2.4ds - second level of destructed model

... to n as:

my_model_cn.4ds - n level of destructed model, where n is integer number greater than 0

 

In mission, model must be placed as Model Object and to it must be linked primitive collision(s) (eg. XTOOB) with material 41. Then, on hit event, the model will be changed to ..._c1 and its subobjects will be physical.

 

Practise:

1. In Zmodeler create repaired model (objects can be merged to one) and export it into models folder.

Note: If you're changing some old model, which can has lightmap (eg. xbarel 1.4ds, etc.), change name of old object in the model.

2. Then create destroyed object (1st level) with separated parts to own objects in the model. Export model to models folder with same name and suffix _c1. If you're creating more levels, objects through the models must have identical names.

Note: dummies in the _cn models aren't importamt.

3. Open mission in Mafia World Editor and insert new Model into scene2.bin file.

4. Create XTOOB colision and link (Parent value) to Model object. Set material to 41.

5. Save mission and close MWE.

6. Then, you have to specify physics properties into _cn models for every object. Every object in the model can have parameters string, which is located behind object name. Before text string is byte with legth of follow string (hex value), which you have to correctly calculate (look at picture).

 

Follow list describes physics parameters:

Physics parameters are bordered by ; character.

Standard physics have three parameters: M, N and I

M: mass in kilograms

N: type of physics - some unknown values, like: 15, 17, 22, etc...

I: sound (identical as in BScriptView for Physical Objects)

- 0: grenade

- 1: box

- 2: barrel

- 3: recycle bin

- 4: sign

- 5: paper box

- 6: wood

- 7: metal plate

- 8: small gun 1

- 9: small gun 2

- 10: wood plank

- 11: metallic thing

- 12: big gun

- 13: light on car

 

Example: ;M200N22I13; with length: 0C (in hex)

 

There are some extra parameters:

X: special

- 1G: glass

- 1H: hydrant

- 1EF: explosive with fire and light

These params are alone in the definition, eg: ;X1G; ;X1EF; etc.

X with value destribes resistance on next destruction level, eg: ;X200M50I2N22+;

+ as suffix is obligatory to link model to next _cn level. Objects in the _cn models must have identical names.

. (dot) have unknown function

Z: object will be solid - without physics

 

At the end, some expamples of physics definitions:

Model.object child       | raw hex data                               | length of string, string
@HQobr02.Box01           | 063B6E31355A3B                             | 06 ;n15Z;

busta_c1.Object01        | 103B583130304E31374D313030302E2B3B         | 10 ;X100N17M1000.+;
busta_c2.Box01           | 0B3B4D3130304E313749363B                   | 0B ;M100N17I6;
busta_c2.Object01        | 0A3B4D32304E313749363B                     | 0A ;M20N17I6;

dopravni5b.stozar        | 0A3B4D33354E323149343B                     | 0A ;M35N21I4;
dopravni5b.~~lamp1       | 0B564F4C422C307831392C4D                   | 0B VOLB,0x19,M

dopravni9B_c1.Cylinder01 | 0D3B4D31303030304E323249373B               | 0D ;M10000N22I7;
dopravni9B_c1.Mesh01     | 053B5831483B                               | 05 ;X1H;
dopravni9B_c1.Mesh02     | 0C3B4D3230304E32324931333B                 | 0C ;M200N22I13;

kos01_c1.odpadky01       | 0A3B4D33304E333349333B                     | 0A ;M30N33I3;

PHbox01.PHbox01          | 093B4D3135304E31353B                       | 09 ;M150N15;
PHbox01.Object01         | 053B5831473B                               | 05 ;X1G;
PHbox01.Object02         | 0A3B4D35304E313549313B                     | 0A ;M50N15I1;

popel01.popel01          | 0F3B583130304D3130304E323249323B           | 0F ;X100M100N22I2;
popel01_c1.popel01       | 0B3B4D3130304E323249323B                   | 0B ;M100N22I2;

xbarel 1_c1.barel 1      | 0F3B583230304D353049324E32322B3B           | 0F ;X200M50I2N22+;
xbarel 1_c2.barel 1      | 0A3B4D35304E323249323B                     | 0A ;M50N22I2;

Share this post


Link to post
Share on other sites

*sees a whole new future for Titanic Mod* ;D

 

This is not a little epic, this is awesome! (also your 4ds converter, great job! I hope textures won't crash using your tool)

Share this post


Link to post
Share on other sites

Hello, I have problem with sign. Material of collision is 41, code of object is ;M15N22I4; . But when I shoot to object, second part is still frozen in the air.

 

 

 

Screenshot:

 

2ia4ro6.jpg

 

 

Share this post


Link to post
Share on other sites

Hello, I have problem with sign. Material of collision is 41, code of object is ;M15N22I4; . But when I shoot to object, second part is still frozen in the air.

 

 

 

Is it one object or two separate ones? the pole and the sign.

 

 

Share this post


Link to post
Share on other sites

Is it one object or two separate ones? the pole and the sign.

 

It is one object. But when I shoot to part in the air, it falls down.

 

Share this post


Link to post
Share on other sites

Who can help me, please? :(

 

 

 

I would try to pm boz about it

 

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
0