Community Forum

Andding RailRoadCrossing to second train

Forum Overview >> Editor

CategoryEditor
Created21.03.2017 02:57


Anthony Queen (tqueen113) 21.03.2017 03:00
Hello all, I am trying to add 2 railroad crossings to the second train tracks I tried adding the crossing code form map01_trainSystem01.xml into the map01_trainSystem02.xml and it does not seem to work. any help I would be grateful.

Thanks!

Anthony Queen (tqueen113) 21.03.2017 03:06
Also I have 2 Railroad Crossings over both sets of tracks in different locations but only the first train will trigger them.

Thanks again.

Emil Drefers (Unknown) 21.03.2017 07:26
Hi,

please make sure that the values in the xml files (e.g. map01_trainSystem01.xml) match the hierarchy in the map.

Cheers,
Emil

Anthony Queen (tqueen113) 21.03.2017 11:56
Does the code need to go into the map01_trainSystem01.xml or map01_trainSystem02.xml to work?

Anthony Queen (tqueen113) 22.03.2017 03:57
I tried everything I can think of and cant get it to work :-(


Ted Fanning (wickedset) 22.03.2017 09:03
You can't add a single crossing to span 2 systems and get both trains to trigger it.

I've added 2 crossings on the map, at the same location, and an entry for each crossing in both systems xml file,

There maybe someone who could script a way to do this?

Anthony Queen (tqueen113) 22.03.2017 21:53
thanks, I have tried putting the crossings over each track but when I put the crossing in the train02 transform group it disappears and is not visible? have no clue there, I also have 5 crossings on track01 and they all work fine when I add them to the map01_trainSystem01.xml file. whenever I add anything to the map01_trainSystem02.xml I get a LUA callback error. and map wont load.

Anthony Queen (tqueen113) 22.03.2017 22:41
Error: index out of range
LUA call stack:
dataS/scripts/utils/Utils.lua (11) : printCallstack
dataS/scripts/utils/Utils.lua (65) : checkChildIndex
dataS/scripts/trainSystem/RailroadCrossing.lua (33) : indexToObject
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Index: 6
Error: index out of range
LUA call stack:
dataS/scripts/utils/Utils.lua (11) : printCallstack
dataS/scripts/utils/Utils.lua (56) : checkChildIndex
dataS/scripts/trainSystem/RailroadCrossing.lua (45) : indexToObject
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Index: 6|0|0
Warning (LUA): 'getRotation': Argument 1 has wrong type. Expected: Int. Actual: Nil
..\..\..\src\base\scripting\lua\LuaScriptSystem.cpp (640): expectedType == Value::VoidType
LUA call stack:
dataS/scripts/trainSystem/RailroadCrossing.lua (49) : getRotation
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Warning (LUA): 'getTranslation': Argument 1 has wrong type. Expected: Int. Actual: Nil
..\..\..\src\base\scripting\lua\LuaScriptSystem.cpp (640): expectedType == Value::VoidType
LUA call stack:
dataS/scripts/trainSystem/RailroadCrossing.lua (53) : getTranslation
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Warning (LUA): 'setTranslation': Argument 1 has wrong type. Expected: Int. Actual: Nil
..\..\..\src\base\scripting\lua\LuaScriptSystem.cpp (640): expectedType == Value::VoidType
LUA call stack:
dataS/scripts/trainSystem/RailroadCrossing.lua (58) : setTranslation
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Warning (LUA): 'setRotation': Argument 1 has wrong type. Expected: Int. Actual: Nil
..\..\..\src\base\scripting\lua\LuaScriptSystem.cpp (640): expectedType == Value::VoidType
LUA call stack:
dataS/scripts/trainSystem/RailroadCrossing.lua (59) : setRotation
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Error: index out of range
LUA call stack:
dataS/scripts/utils/Utils.lua (11) : printCallstack
dataS/scripts/utils/Utils.lua (56) : checkChildIndex
dataS/scripts/trainSystem/RailroadCrossing.lua (45) : indexToObject
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Index: 6|1|0
Warning (LUA): 'getRotation': Argument 1 has wrong type. Expected: Int. Actual: Nil
..\..\..\src\base\scripting\lua\LuaScriptSystem.cpp (640): expectedType == Value::VoidType
LUA call stack:
dataS/scripts/trainSystem/RailroadCrossing.lua (49) : getRotation
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Warning (LUA): 'getTranslation': Argument 1 has wrong type. Expected: Int. Actual: Nil
..\..\..\src\base\scripting\lua\LuaScriptSystem.cpp (640): expectedType == Value::VoidType
LUA call stack:
dataS/scripts/trainSystem/RailroadCrossing.lua (53) : getTranslation
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Warning (LUA): 'setTranslation': Argument 1 has wrong type. Expected: Int. Actual: Nil
..\..\..\src\base\scripting\lua\LuaScriptSystem.cpp (640): expectedType == Value::VoidType
LUA call stack:
dataS/scripts/trainSystem/RailroadCrossing.lua (58) : setTranslation
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Warning (LUA): 'setRotation': Argument 1 has wrong type. Expected: Int. Actual: Nil
..\..\..\src\base\scripting\lua\LuaScriptSystem.cpp (640): expectedType == Value::VoidType
LUA call stack:
dataS/scripts/trainSystem/RailroadCrossing.lua (59) : setRotation
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Error: index out of range
LUA call stack:
dataS/scripts/utils/Utils.lua (11) : printCallstack
dataS/scripts/utils/Utils.lua (56) : checkChildIndex
dataS/scripts/trainSystem/RailroadCrossing.lua (89) : indexToObject
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Index: 6|0|1
Error: index out of range
LUA call stack:
dataS/scripts/utils/Utils.lua (11) : printCallstack
dataS/scripts/utils/Utils.lua (56) : checkChildIndex
dataS/scripts/trainSystem/RailroadCrossing.lua (89) : indexToObject
dataS/scripts/trainSystem/TrainSystem.lua (107) : load
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Index: 6|1|1
Warning (LUA): 'getWorldTranslation': Argument 1 has wrong type. Expected: Int. Actual: Nil
..\..\..\src\base\scripting\lua\LuaScriptSystem.cpp (640): expectedType == Value::VoidType
LUA call stack:
dataS/scripts/trainSystem/TrainSystem.lua (119) : getWorldTranslation
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Warning (LUA): 'getParent': Argument 1 has wrong type. Expected: Int. Actual: Nil
..\..\..\src\base\scripting\lua\LuaScriptSystem.cpp (640): expectedType == Value::VoidType
LUA call stack:
dataS/scripts/trainSystem/TrainSystem.lua (120) : getParent
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Warning (LUA): 'localToWorld': Argument 1 has wrong type. Expected: Int. Actual: Nil
..\..\..\src\base\scripting\lua\LuaScriptSystem.cpp (640): expectedType == Value::VoidType
LUA call stack:
dataS/scripts/trainSystem/TrainSystem.lua (120) : localToWorld
dataS/scripts/OnCreateLoadedObjectsManager.lua (36) : load
dataS/scripts/missions/mission00.lua (568) : loadFromAttributesAndNodes
dataS/scripts/missions/mission00.lua (611) : loadVehiclesFinish
dataS/scripts/BaseMission.lua (793) : asyncCallbackFunction
dataS/scripts/vehicles/Vehicle.lua (776) : asyncCallbackFunction
dataS/scripts/utils/Utils.lua (1138) : asyncCallbackFunction
Error: Running LUA method 'loadSharedI3DFileFinished'.
dataS/scripts/trainSystem/TrainSystem.lua(121) : attempt to perform arithmetic on local 'x1' (a nil value)


Tony Price (brownthumb) 23.03.2017 05:58
I'll try to be of help, in the editor you have Scenegraph in Scenegraph you have
trainSystem, in trainSystem you have trainSystem01 and trainSystem02 in that order,
remember everything has to be in order to work, now you open trainSystem01 you have
trainSystem01,spline,railroadCrossing01 and 02 in that order, now when you add
crossings to trainSystem02 everything should be in that same order inside trainSystem02.
Now that being said since the original train system only had 2 crossings in 01 and
none in 02 and you are adding to 01 and putting into 02, the train system don't know
what to do with that extra info, so now you have to change the direction from where it
did get its info to where it can find it now. open your User Attribute window then click
on your trainSystem01 file, in user Attribute window you will see a box with xmlFile
in front of it, inside the box you will have this, $data/maps/map01_trainSystem01.xml,
change it to this, maps/map01_trainSystem01.xml, do the same for your trainSystem02 file.
it should read like this, maps/map01_trainSystem02.xml
hope that helps get you back on track.

copy this to your trainSystem02. xml file

<railroadObjects>
<railroadObject className="RailroadCrossing" index="1" startDistance="125" endDistance="125" >
<gate index="1|0|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5" />
<gate index="1|1|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5"/>
<signals index="1|0|1" alternatingLights="true" />
<signals index="1|1|1" alternatingLights="true" />
<crossingSound file="data/maps/sounds/trainCrossingBell.wav" radius="50" innerRadius="20" />
</railroadObject>
<railroadObject className="RailroadCrossing" index="2" startDistance="125" endDistance="125" >
<gate index="2|0|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5" />
<gate index="2|1|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5"/>
<signals index="2|0|1" alternatingLights="true" />
<signals index="2|1|1" alternatingLights="true" />
<crossingSound file="data/maps/sounds/trainCrossingBell.wav" radius="50" innerRadius="20" />
</railroadObject>
</railroadObjects>

Anthony Queen (tqueen113) 23.03.2017 12:11
Hi Tony
I have it set up just like you have it and it don't work. I have 5 crossings on System01 and all work fine. I cannot add a crossing to System02 transform group becouse it is invisible. when I move it into that group.

Code in Sytem01 xml
<railroadObjects>
<railroadObject className="RailroadCrossing" index="1" startDistance="125" endDistance="125" >
<gate index="1|0|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5" />
<gate index="1|1|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5"/>
<signals index="1|0|1" alternatingLights="true" />
<signals index="1|1|1" alternatingLights="true" />
<crossingSound file="data/maps/sounds/trainCrossingBell.wav" radius="50" innerRadius="20" />
</railroadObject>
<railroadObject className="RailroadCrossing" index="2" startDistance="125" endDistance="125" >
<gate index="2|0|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5" />
<gate index="2|1|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5"/>
<signals index="2|0|1" alternatingLights="true" />
<signals index="2|1|1" alternatingLights="true" />
<crossingSound file="data/maps/sounds/trainCrossingBell.wav" radius="50" innerRadius="20" />
</railroadObject>
<railroadObject className="RailroadCrossing" index="3" startDistance="125" endDistance="125" >
<gate index="3|0|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5" />
<gate index="3|1|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5"/>
<signals index="3|0|1" alternatingLights="true" />
<signals index="3|1|1" alternatingLights="true" />
<crossingSound file="data/maps/sounds/trainCrossingBell.wav" radius="50" innerRadius="20" />
</railroadObject>
<railroadObject className="RailroadCrossing" index="4" startDistance="125" endDistance="125" >
<gate index="4|0|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5" />
<gate index="4|1|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5"/>
<signals index="4|0|1" alternatingLights="true" />
<signals index="4|1|1" alternatingLights="true" />
<crossingSound file="data/maps/sounds/trainCrossingBell.wav" radius="50" innerRadius="20" />
</railroadObject>
<railroadObject className="RailroadCrossing" index="5" startDistance="125" endDistance="125" >
<gate index="5|0|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5" />
<gate index="5|1|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5"/>
<signals index="5|0|1" alternatingLights="true" />
<signals index="5|1|1" alternatingLights="true" />
<crossingSound file="data/maps/sounds/trainCrossingBell.wav" radius="50" innerRadius="20" />
</railroadObject>
<railroadObject className="RailroadCrossing" index="6" startDistance="125" endDistance="125" >
<gate index="6|0|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5" />
<gate index="6|1|0" startRot="0 0 0" endRot="90 0 0" duration="3" closingOffset="1.5"/>
<signals index="6|0|1" alternatingLights="true" />
<signals index="6|1|1" alternatingLights="true" />
<crossingSound file="data/maps/sounds/trainCrossingBell.wav" radius="50" innerRadius="20" />
</railroadObject>
</railroadObjects>
If I add this to System02 the game will crash and log will give that error code.

Thanks! Pulling my hair out!

Anthony Queen (tqueen113) 23.03.2017 12:54
Ok Tony I got it working, I don't care to tell you what I did wrong because it would be embarrassing! Thanks a ton man!!!


Note: Log in to post. Create a new account here.