Make a specific area in game
by Ironbelly Studios · in General Discussion · 07/01/2008 (5:21 am) · 6 replies
Hello everybody..
I want to make a specific area in world.When player will enter in this specific area an item(simgroup) will be created dynamically.My problem is that how will detect that player has entered in this specific area.I need help... whatever..??
I want to make a specific area in world.When player will enter in this specific area an item(simgroup) will be created dynamically.My problem is that how will detect that player has entered in this specific area.I need help... whatever..??
About the author
#2
07/01/2008 (5:31 am)
I am using tge1.4...
#3
07/01/2008 (5:39 am)
You should look into creating a Physical area or zone i think they are called. essentially, creating a area on the map with a different set of rules. i misspelled it. But thats what your looking for.
#4
07/02/2008 (1:59 pm)
Looks like a use case for triggers. Here's an example from the Torque tutorials by Kevin Harris.datablock TriggerData( TempleOfEvilTrigger )
{
// tickPeriodMS is a value is used to control how often the console
// onTriggerTick callback is called while there are any objects
// in the trigger. The default value is 100 MS.
tickPeriodMS = 100;
};
function TempleOfEvilTrigger::onEnterTrigger( %this, %trigger, %obj )
{
echo( "The player has just entered the Temple of Evil! - Not the smartest move!");
// This method is called whenever an object enters the %trigger
// area, the object is passed as %obj. The default onEnterTrigger
// method (in the C++ code) invokes the ::onTrigger(%trigger,1) method on
// every object (whatever it's type) in the same group as the trigger.
Parent::onEnterTrigger( %this, %trigger, %obj );
}
function TempleOfEvilTrigger::onLeaveTrigger( %this, %trigger, %obj )
{
echo( "The player has just left the Temple of Evil! - The player lives to fight another day!");
// This method is called whenever an object leaves the %trigger
// area, the object is passed as %obj. The default onLeaveTrigger
// method (in the C++ code) invokes the ::onTrigger(%trigger,0) method on
// every object (whatever it's type) in the same group as the trigger.
Parent::onLeaveTrigger( %this, %trigger, %obj );
}
function TempleOfEvilTrigger::onTickTrigger( %this, %trigger )
{
echo( "The player is still in the Temple of Evil! - Calling all monsters!");
// This method is called every tickPerioMS, as long as any
// objects intersect the trigger. The default onTriggerTick
// method (in the C++ code) invokes the ::onTriggerTick(%trigger) method on
// every object (whatever it's type) in the same group as the trigger.
// You can iterate through the objects in the list by using these
// methods:
// %this.getNumObjects();
// %this.getObject(n);
Parent::onTickTrigger( %this, %trigger );
}
#5
07/02/2008 (2:01 pm)
Forgot: to use this, exec the code and then create a Trigger mission object with the editor and select the respective trigger profile.
#6
07/03/2008 (4:35 am)
Thanx for this concept. I have made specific area by these triggers... :)
Torque Owner Brian Wilson