Community Forum

Help...Trigger Will Not Fire

Forum Overview >> Farming Simulator 2011

CategoryFarming Simulator 2011
Created17.07.2011 01:36


Terry Taylor (Terry214) 17.07.2011 01:45
I need help with my trigger. I can not get it to fire. It seems to load with out any issues but the onCreate may be failing. I created the Trigger attribute with the following parameters in my i3d file:

Name: BarrierTWO
Attribute: onCreate
BarrierTWO.BarrierTWOOnCreate

Below is my lua file:

--BarrierTrigger

print("MapMOD: BarrierTWO loaded 1.01");

BarrierTWO = {};

function BarrierTWO:OnCreate(id)
print("BarrierTWO:OnCreate");
BarrierTWO:triggerLoad(id);
end;

BarrierTWOOnCreate = BarrierTWO.onCreate;

function BarrierTWO:triggerLoad(id)

addTrigger(id, "BarrierTWOCallback", self);

self.id = id;

self.trailerInTrigger = 0;
self.fruitTriggerId = 0;

self.fill = false;
self.printText = false;

self.ShowHud=false;
end;

function BarrierTWO:loadMap(name)
end;

function BarrierTWO:deleteMap()
end;

function BarrierTWO:delete()
end;

function BarrierTWO:mouseEvent(posX, posY, isDown, isUp, button)
end;

function BarrierTWO:keyEvent(unicode, sym, modifier, isDown)
end;

function BarrierTWO:update(dt)
if self.trailerInTrigger == 1 then
g_currentMission:addHelpButtonText(g_i18n:getText("BarrierTWO_STOPFILL"),InputBinding.BarrierTWO_FILL);
else
g_currentMission:addHelpButtonText(g_i18n:getText("BarrierTWO_STARTFILL"),InputBinding.BarrierTWO_FILL);
end;


end;

function BarrierTWO:draw()

end;

function BarrierTWO:BarrierTWOCallback(triggerId, otherId, onEnter, onLeave, onStay, otherShapeId)
if onEnter then
self.trailerInTrigger = 1;
self.fruitTriggerId = triggerId;
elseif onLeave then
self.trailerInTrigger = 0;
self.fruitTriggerId = 0;

elseif onStay then
self.trailerInTrigger = 1;
self.fruitTriggerId = triggerId;
end;
end;

addModEventListener(BarrierTWO);

Any suggestions are appreciated

Terry

Stefan Geiger - GIANTS Software 02.08.2011 09:18
You need to remove the : in your function declarations:
function BarrierTWO:OnCreate(id)

should be changed to:
function BarrierTWOOnCreate(id)


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