Create trigger on the fly
by Michael S · in Torque Game Builder · 10/15/2006 (7:06 pm) · 7 replies
How to create trigger on the fly?
i've tried this but it's not work
function flower::onlevelloaded(%this)
{ $flower=%this;
%this.setusemouseevents(true);
%flowtrigger= new t2dtrigger()
{
sceneGraph = %this;
class = "flowertrigger";
layer = 0;
size = "32 32";
EnterCallback = "true";
StayCallback = "false";
LeaveCallback = "true";
};
%flowtrigger.setposition(%this.getposition());
}
function flowertrigger::onEnter(%this,%object)
{
if (object.class $="bee")
{error("xxxxx");}
}
it doesn't write xxxxx if mybee enter the trigger.
but if i create flowertrigger on the level builder it works
thanks
i've tried this but it's not work
function flower::onlevelloaded(%this)
{ $flower=%this;
%this.setusemouseevents(true);
%flowtrigger= new t2dtrigger()
{
sceneGraph = %this;
class = "flowertrigger";
layer = 0;
size = "32 32";
EnterCallback = "true";
StayCallback = "false";
LeaveCallback = "true";
};
%flowtrigger.setposition(%this.getposition());
}
function flowertrigger::onEnter(%this,%object)
{
if (object.class $="bee")
{error("xxxxx");}
}
it doesn't write xxxxx if mybee enter the trigger.
but if i create flowertrigger on the level builder it works
thanks
#3
10/16/2006 (6:42 am)
Create a trigger in level builder and save the level. Exit TGB. Open the .t2d file in Torsion or whatever text editor you're using.
#4
10/18/2006 (6:57 am)
Wow thanks a lot thats work
#5
10/18/2006 (9:28 am)
Sweet, glad you got it working!
#6
10/20/2006 (11:29 am)
Just a quick note: make sure you remove mountID field from any 'new' blocks you copy from level files.
#7
(Check the levelName.t2d file, to see how the level editor creates items.)
Thank you!
04/27/2009 (10:33 am)
This is a fantastic tip!(Check the levelName.t2d file, to see how the level editor creates items.)
Thank you!
Torque Owner Ben R Vesco