Jump to content
Oovee® Games
LetsRockAndRoll

Combining Addons using XML

Recommended Posts

Hi All,

 

I've been looking at ways to add custom items to my trucks. Unfortunately I don't have the skills or time to create and then texture 3d models. So I started poking around in the xml files and found this code block at the bottom of the <PhysicsModel> block of the xml file for the Kraz:

 

 <Model

Mesh="trucks/kraz_wheel.xml"
MeshType="Wheel"
Dir="(-1.0; 0; 0)"
ParentFrame="CabinBone"
Org="(1.331; 1.907; -0.634)"
/>
 
Curious as to what this code actually did I copied it into the <PhysicsModel> section of one of my own addons and changed the 'Mesh=' line to point to the mesh of a barrel.
 
########################################################
<?xml version="1.0"?>
<TruckAddon>
<GameData >
<InstallSocket Type="Zil165Platform" />
</GameData>
<PhysicsModel Mesh="Zil165/zil165_platform.xml">
<Body Mass="1000" ImpactType="Truck">
<Constraint Type="Fixed" />
  </Body>
 
<Model
Mesh="trucks/Barrel/barrel_fuel.xml"
MeshType="Model"
Dir="(1.0; 0; 0.2)"
Org="(1.95; -0.1; -0.45)"
/>
 
</PhysicsModel>
</TruckAddon>
 
##########################################################
 
When I added the Zil165Platform to my truck i got an error telling me that "Wheel" was the wrong mesh type and a mesh type of 'Model' was expected. I changed the MeshType to 'Model' and added the Zil165Platform again. Lo and behold the platform was added to the truck as normal and so was a barrel.
The barrel was however floating above the truck  :( After some messing around I found that The, Org= parameters work in the same way as the <offset=> tag and managed to get the barrel positioned correctly.

As a bonus i also found that the, Dir= parameters allow you to tilt and rotate the object.

 

To cut a long story short I now have a platform/carriage with 6 barrels and 3 crates that only uses 1 addon slot that didn't require any complex 3d modelling, UV mapping, or texturing.

 

platform.png

  • Like 6

Share this post


Link to post
Share on other sites

It also looks pretty good too, nice one! I wonder what other combos of items and add-ons you can make, Hmm, would you also be able to add, repair or fuel points to those? Make a variety of your own utility attachments with different values and aesthetics. 

Share this post


Link to post
Share on other sites

Many times I have added so addon models of vehicles and trailers. The question is about the collision, every time these models are without collision, I tried to modify the xml but without effect.

Share this post


Link to post
Share on other sites

It also looks pretty good too, nice one! I wonder what other combos of items and add-ons you can make, Hmm, would you also be able to add, repair or fuel points to those? Make a variety of your own utility attachments with different values and aesthetics. 

 

I added 'RepairsCapiacity="500", FuelCapacity="500"' to the Gamedata line of the platform/carriage in the pic. It's carrying barrels and crates so it doesn't feel like cheating  ;)

With regard to making different combo's. That depends on the meshes you have available. The barrel mesh is from a Russian ST mod site and the crate is from a free 3d model site. It should be easy enough to add a stack of spare wheels from existing meshes. I might give that a try later. 

Edited by LetsRockAndRoll

Share this post


Link to post
Share on other sites

Many times I have added so addon models of vehicles and trailers. The question is about the collision, every time these models are without collision, I tried to modify the xml but without effect.

 

This is true. I think the solution may be to create the items as models using the 'models' folders. I checked last night and found that models can have collision code added. Here's the xml for the fuel tank from Media/classes/models:

 

<ModelBrand>
<Occlusion Size="(12.0; 12.0)" Texture="occlusion_fuel_tank.tga" />
<PhysicsModel>
<Body Collisions="Dynamic" />
</PhysicsModel>
</ModelBrand>
 
As you can see, the <Body /> block has a collision statement. I'll give it a try today.
 
PS: I gave the above method a try and it made no difference. However, as the items are only props/eye candy I don't see it as a problem.
Edited by LetsRockAndRoll

Share this post


Link to post
Share on other sites

PS: I gave the above method a try and it made no difference. However, as the items are only props/eye candy I don't see it as a problem.

The truth of these things are mostly look, but I would add models which would be really handy collisions. I will continue figuring maybe he goes :)

Share this post


Link to post
Share on other sites

The only collision shape I know of is the Box:

<Shape>
     <Box HalfExtents="(0.1; 0.1; 0.1)" Translation="(0.8; 1.3; 0.5)" />
</Shape>

In the physicsmodel part.

Share this post


Link to post
Share on other sites

I'll try, but the models which are inserted from another file mesh and can not (at least I had a problem with it) add as Physicmodel.

Share this post


Link to post
Share on other sites

small question. From wich mod are all those meshes and the crane in the first picture. (link please)

 

The barrel is here: http://stmods.ru/mods/modeli_dlya_redaktora_kart_v1_by_eremchuk_yuriy_bypra/

 

The crane is here: http://stmods.ru/mods/kamaz_53212_v1_by_redpow/

 

The crates were downloaded from free 3d model sites I found with google.

Share this post


Link to post
Share on other sites

I've been messing with the, 'Dir' & 'Org' lines in the xml block that control the positioning of the object/mesh.

 

<Model
Mesh="trucks/Barrel/barrel_fuel.xml"
MeshType="Model"
Dir="(1.0; 0; 0.2)"
Org="(1.95; -0.1; -0.45)"
/>
 
As far as I can work out the 'Dir' parameters rotate the object around it's pivot point. The 'Org' parameters work in exactly the same way as those in the 'Offset=' parameters often seen in the <AddonSockets> xml block.

This allows you to position objects very accurately:

 

positioning.png

 

I was worried that adding all of the objects would have an impact on performance so I started up Fraps and ran the truck with and without it's load. There was no noticeable difference in fps. 

Share this post


Link to post
Share on other sites

I've been using this tutorial for my Baja tweak of SID's 66 chevy. I finally got it to carry logs! lol2015-01-27_00002.jpg

  • Like 2

Share this post


Link to post
Share on other sites

Lol, would look better with the forklift from Zidons Tatra attached.

 

PS: Thanks for calling my humble dabbling a tutorial.

Edited by LetsRockAndRoll
  • Like 1

Share this post


Link to post
Share on other sites

This actually helped me a lot. I was having trouble because I wanted to put 2 spares and a tool kit into the back, but adding more than one addon at a time had HUGE consequences on the handling. I'm sure there is something I'm doing wrong, but this is going to make it a lot easier for me to get this tweak on the road.

Share this post


Link to post
Share on other sites

I am trying to add a winch socket to a non vehicle item (large rock) that I have modded. What do I add to the xml to get it to show in game?

Your question was already answered here.

(You probably already know this, but just for people who want to write an answer for you, it has already been done :))

  • Like 1

Share this post


Link to post
Share on other sites
Guest NorB

Hello all!

Is there any way to change the direction of the addon socket?

I added simply the ural frontal exhaust to the uaz.xml, and its looking good ingame, but can't rotate the part to place it properly.
 
<AddonSockets>
           <UralExhaust Offset="(-4.0; 1.0; 0.0)" Direction="(0;3.0;0)" />

</AddonSockets>
        
Other question:

I want to rename the "Frontal Exhaust" to "Side Exhaust" and assign to the uaz.

I duplicated the files of the original exh. and modifed them.

 

in classes :

made uaz_exhaust.xml

        <InstallSocket Type="UazExhaust" />        

    <PhysicsModel Mesh="uaz_exhaust.xml">

also duplicated in the mesh folder the original ural_exhaust.xml to uaz_exhaust.xml

in the garage its listed as uaz_exhaust but cannot install.

Share this post


Link to post
Share on other sites

Just an educated guess: I saw Dir being used as attribute name for this property, not Direction.

 

For your second question, make sure you rename the xml element as well, so <UralExhaust Offset="(-4.0; 1.0; 0.0)" Direction="(0;3.0;0)" /> should actually be <UazExhaust Offset="(-4.0; 1.0; 0.0)" Direction="(0;3.0;0)" />.

Share this post


Link to post
Share on other sites
Guest NorB

I have 2 addonsockets in uaz.xml

i have both in the game in garage but only the original can be placed

other is showed this: uaz_exhaust.

 

<AddonSockets>
<UralExhaust Offset="(-4.0; 1.0; 0.0)" Direction="(0;3.0;0)"/>        
</AddonSockets>
            
<AddonSockets>
<UazExhaust Offset="(-4.0; 1.0; 0.0)" Direction="(0;3.0;0)"/>        
</AddonSockets>

how to rename the part?
and how to rotate it?

thx

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...