Game Development Community

Triggers not working by script?

by Martin Schultz · in Torque Game Engine Advanced · 04/22/2006 (9:26 am) · 1 replies

I have some trouble with creating a trigger in script (Using TSE MS 3 which is wonderful by the way!). I tried to create a trigger together with a static shape object in it's onAdd method. While this didn't work, I tried creating the trigger "by hand" within a seperate function call and it does not show up in the mission editor. Creating a trigger using the mission editor works out fine by the way.

This is the code I use:
datablock TriggerData(BaseStationTrigger)
{
   tickPeriodMS = 100;
};

function triggerTest()
{
	echo("triggerTest() called...");
	
	%xtest = new Trigger(testTrigger) {
		position = "134.139 263.45 85.3253";
		rotation = "1 0 0 0";
		scale = "1 1 1";
		dataBlock = "BaseStationTrigger";
		polyhedron = "-0.5 0.1 -0.7 1 0 0 0 -1 0 0 0 1";
	};	
	MissionCleanup.add(%xtest);
   
   echo("triggerTest() done!");
}

If you put this code in some location in the server folder, start the game, load a mission and open the console and type in triggerTest(); I would have expected to have a new trigger in the mission group when watching it using the mission editor - but nothing happens. No error message nothing. I'm right now clueless. Would love to have somebody try it too to see if it only doesn't work in my code.

Martin

#1
04/25/2006 (9:42 am)
I don't think the editor is showing the group "MissionCleanup" to you... I could be wrong though.