simonjackson1964 Posted May 21, 2021 Share Posted May 21, 2021 I am probably trying to be too clever, but there must be a way of doing this... What I want to happen: My freight train pulls into the depot, and the cranes get to work unloading the containers, stacking them neatly alongside the roadway where a stream of trucks arrive one after the other and as soon as the train is unloaded the containers are loaded onto the trucks, and off they go, to the other end of the layout where the reverse happens. What actually happens - The story so far: The trucks are just pootling backwards and forwards at the moment because I haven't got to them yet, I want to get the bit that unloads the train working first... So the train arrives in the depot, and the three cranes get to work. I couldn't find a decent container crane that would do the whole of a twelve wagon freight train, so I have three cranes that handle four wagons each. So far, cranes 2 and three successfully pick up the first container on their bit of the train. Crane 1 goes a bit further. after picking up the container it selects one of ten "container floors", and places the container there. But herein lies the problem: If the floor already has one or two containers on it, the crane is supposed to stack the containers. It does so when I operate it manually. But when the event is triggered by the arrival of the train, the crane neatly drops the container inside the one already there! I know why it is doing it, I'm just wondering if there is a better solution than the one I have in mind. ================== When the train arrives it loads the object references of four containers into a list on each crane. The crane so far only gets the first one but it should be easy enough to get the other three. There is a pre-loaded list of ten tables in Crane 1, each table holds the object ID of the crane floor, and the number of containers already on that floor. If the number is 3, the floor won't be selected. So when the crane has finished lifting a container it generates a random index to find which floor to put the container on. What I think I might have to do is add a third item to the table to hold the ID of the floor, and put the id of the topmost container or the floor if empty into the "target" field. Is there something I'm missing, or have I just got to bite the bullet and code that? Link to comment Share on other sites More sharing options...
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
Already have an account? Sign in here.Sign In Now