Random Rotation of Products

EverTrainz

Electric Blue
Is there any tag to specify that a product can be placed on its loading point, on the traincar, at any 180º angle? I don't have my Trainz with me now, so can't confirm. Perhaps a future implementation? ;)
 
'Nother question. I'm going to make this as simple as possible.

I have Wagon X. I have commodity called 'Product A'. When Product A is loaded into Wagon X, there must be another mesh, called 'Attachment A', attached to Wagon X, via an attachment point. When Product A is unloaded, Attachment A disappears.

In Wagon X, there's another load called 'Product B'. When Product B is loaded into Wagon X, there must be yet another mesh, called 'Attachment B', attached to Wagon X. When Product B is unloaded, Attachment B should disappear along with Product B.

In Wagon X, all other commodities are normal (don't require another mesh).

Is there a script for this? I don't need to know the exact lines, but rather know if there are such possibilities.
 
Last edited:
1st question: Not that I'm aware of, but you can probably do it with script
2nd: I don't know if there's a premade script for this, but it is definitely possible. I did something similar for an old flatcar; I'll try to dig it up today.

Curtis
 
Thanks Curtis. You don't need to dig up old scripts; I was just wondering. I want to know what scripting can do, and how powerful it is. As for my needs, I want to learn it myself, rather than copy and paste.

By the way, is it possible to give ARN to the commodities itself? Texture-swapping can do this on traincars, but what about products (like truck trailers, crates, tractors, etc...).
 
OK, from kuid2:124060:15041:2 on the DLS....

What you'll basically do is hide / show meshes depending on the state of various queues. The car above switches between two different stake models depending on which queue is filled; you should be able to adapt that to more meshes and queues.

some code:
Code:
  float BeginLoad(LoadingReport report)
  {
        if (report.srcQueue.GetProductList()[0] == isCordwood)
        {
           SetMeshVisible("side_stakes",false,0.0);
           SetMeshVisible("end_stakes",true,0.0);
        }
        else
        {
           SetMeshVisible("side_stakes",true,0.0);
           SetMeshVisible("end_stakes",false,0.0);
        }
     return 5.0;
  }
This sets the states of the stake meshes during the load operation. You may want to do something during the unload operation, as well.
The return 5 line makes the load operation take 5 seconds; you can adjust to your preferences.

For products, I don't know if you can script them, and if so, what capabilities are available. You *might* be stuck with using the random mesh feature to switch between different models with different numbers, but play with it and let us know :)

Hope this helps, and good luck!
Curtis
 
Thanks for that code. Does the above method pre-render the attached mesh? That might bring down frames. It will most-likely be possible, considering members have scripted usable claw cranes.
 
No, as I recall, there's a minor performance penalty to having hidden meshes like this, but nowhere near the cost to actually render them.

Curtis
 
Hello Curtis,

Is said frame penalty the one that applies to all attached meshes, or is it one that arises specifically due to the setting of meshes invisible/visible?

 
No, as I understand it, meshes when hidden carry more of a penalty than nothing at all, but less than the mesh when it's visible.
 
Back
Top