Community Forum

Switching Discharge nodes.

Forum Overview >> Scripting

CategoryScripting
Created14.04.2019 02:51


Derek Fendelet (FondueFondont) 14.04.2019 02:51
Hey folks, looking for a little guidance here. I'm trying to set up a sprayer tender trailer that can carry both Herbicide and Fertilizer. I've managed to create a trailer that can do that. However, even though I can fill it with both products, and I have a discharge node assigned to each fillconfig, I can only draw the first fill type out of it. I'm wondering if there's a command to assign a keybind to toggle between them and to display the selected node in the F1 menu.

Thanks for any help you can offer.

Hans Moser (sperrgebiet) 16.04.2019 16:05
Have a look at the Giants Seed Runner 3755, specifically the <pipe> section.

<states num="3" unloading="2 3">
<state stateIndex="2" dischargeNodeIndex="1"/>
<state stateIndex="3" dischargeNodeIndex="2"/>
</states>

It works for solid goods, to switch the fillUnit with default key binding 0. Guess it will also work for liquids, but haven't tried it.

If you want a 2nd fillTrigger on the trailer you could do smth like:

function SecondFillTrigger:onLoad(savegame)
local spec = self[SecondFillTrigger.specName]
local triggerNode = I3DUtil.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.fillTriggerVehicle2#triggerNode"), self.i3dMappings)
if triggerNode ~= nil then
spec.fillUnitIndex2 = Utils.getNoNil(getXMLInt(self.xmlFile, "vehicle.fillTriggerVehicle2#fillUnitIndex"), 1)
spec.litersPerSecond2 = Utils.getNoNil(getXMLFloat(self.xmlFile, "vehicle.fillTriggerVehicle2#litersPerSecond"), 50)
spec.fillTrigger2 = FillTrigger:new(triggerNode, self, spec.fillUnitIndex2, spec.litersPerSecond2)
if self:getPropertyState() ~= Vehicle.PROPERTY_STATE_SHOP_CONFIG then
spec.fillTrigger2:finalize()
end
end
end

function SecondFillTrigger:onDelete()
local spec = self[SecondFillTrigger.specName]
if spec.fillTrigger2 ~= nil then
spec.fillTrigger2:delete()
spec.fillTrigger2 = nil
end
end

I added that to one of my mods to have two liquid fillTriggers on one trailer.

HTH
_Hans


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