GPGT Chapter 8 - Issues and Questions
by Edward F. Maurina III · in Torque Game Engine · 05/16/2006 (10:41 pm) · 10 replies
Hello All. This thread is dedicated to any questions or issues that you may find in this chapter.
If you have issues and questions for other chapters, please post them in the appropriate thread:
Chapters 1 & 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
GPGT Support Page
Appendix E. Maze Runner Lessons (Steps Only) - Covers Mac and Windows
OSX Executable - Use for GPGT Lesson Kit and MazeRunner
If you have issues and questions for other chapters, please post them in the appropriate thread:
Chapters 1 & 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
GPGT Support Page
Appendix E. Maze Runner Lessons (Steps Only) - Covers Mac and Windows
OSX Executable - Use for GPGT Lesson Kit and MazeRunner
About the author
Recent Threads
#2
08/14/2006 (8:11 pm)
No updates here, eh? Shall I go inspect the CVS version of the source to see if the parameter exists? I'll do that tomorrow and report back if anyone cares.
#3
Hi. It looks like this field has since been removed from the finalized version of 1.4. However, you can still modify underwater fog color by editing the code.
I can't be explicit since this is a public forum, but I can give hints:
1. Open game.cc and look at line 901, find this line.
2. You can hard-code your own values, or expose variables to the console which will allow you to modify this via script.
3. This color information is used on line 919:
If you are curious about how to add a variable that is visible via the console, please see (GameInit() in game.cc for an example).
I hope this helps. If it is NOT helpful or if you have trouble with this, please post back here.
Hall Of Worlds - For Gamers
EdM|GPGT
08/24/2006 (11:54 am)
@Josiah -Hi. It looks like this field has since been removed from the finalized version of 1.4. However, you can still modify underwater fog color by editing the code.
I can't be explicit since this is a public forum, but I can give hints:
1. Open game.cc and look at line 901, find this line.
if(addWaterFilter)
2. You can hard-code your own values, or expose variables to the console which will allow you to modify this via script.
3. This color information is used on line 919:
glColor4f(Xcolor.red, Xcolor.blue, Xcolor.blue, Xcolor.alpha);
If you are curious about how to add a variable that is visible via the console, please see (GameInit() in game.cc for an example).
I hope this helps. If it is NOT helpful or if you have trouble with this, please post back here.
Hall Of Worlds - For GamersEdM|GPGT
#4
your syntax with Trigger Callbacks conflict with Torque's syntax for these callbacks. Of course, I followed what the Torque Demo script files and TDN show. So, which one is the correct one? I've tried both your syntax and Torque's syntax but it seems I can't get my triggers to work -- But that's a different story. I just want to clarify what is really correct.
Here's one from TDN: http://tdn.garagegames.com/wiki/WorldBuilding/MissionEditor/Creating_Triggers
Just check your trigger.cs in "demo" mod.
10/19/2006 (1:16 am)
On 8.14.2 Trigger Scripting...your syntax with Trigger Callbacks conflict with Torque's syntax for these callbacks. Of course, I followed what the Torque Demo script files and TDN show. So, which one is the correct one? I've tried both your syntax and Torque's syntax but it seems I can't get my triggers to work -- But that's a different story. I just want to clarify what is really correct.
Here's one from TDN: http://tdn.garagegames.com/wiki/WorldBuilding/MissionEditor/Creating_Triggers
Just check your trigger.cs in "demo" mod.
#5
10/21/2006 (6:46 am)
Yes can u explain the triggers, I cant get them to work in the same sim group.
#6
Hi. Please try the following:
1. Take a peek at the trigger datablock and code in: "\MazeRunnerAdvanced\mazerunner\server\scripts\MazeRunner\teleporters.cs".
This code is used in MazeRunner Advanced sample and can be seen to be working. i.e. If you can run the game and teleport from marker to marker you can confirm that the trigger scripts are working. Then, if you peek at the datablock and scripts you should feel a little more confident that the syntax is good.
2. Go ahead and implement this very simple datablock (start with a virgin copy of FPS starter kit and put it in "starter.fps\server\scripts\triggers.cs":
3. Now, in the same file write this basic trigger code:
4. Now (after saving trigger.cs), run starter.fps and load the village mission.
5. Open the console (~).
6. Verify that datablock was instantiated by typing:
echo( isObject( TeleportTrigger ) );
If this prints 1 then the datablock was instantiated. If it prints 0, check for errors in your log during the load sequence.
7. Using the world editor, make a trigger object and use the "TeleportTrigger" datablock when initializing it.
8. Open the console and type: cls();
9. Close the console and walk you player into and out of the trigger area.
10. Open the console and you should see the messages from the enter and leave scripts.
I'm pretty sure you should be good to go with this example.
Hall Of Worlds - For Gamers
EdM|GPGT
10/27/2006 (6:25 pm)
@Matahari,Hi. Please try the following:
1. Take a peek at the trigger datablock and code in: "\MazeRunnerAdvanced\mazerunner\server\scripts\MazeRunner\teleporters.cs".
This code is used in MazeRunner Advanced sample and can be seen to be working. i.e. If you can run the game and teleport from marker to marker you can confirm that the trigger scripts are working. Then, if you peek at the datablock and scripts you should feel a little more confident that the syntax is good.
2. Go ahead and implement this very simple datablock (start with a virgin copy of FPS starter kit and put it in "starter.fps\server\scripts\triggers.cs":
datablock TriggerData(TeleportTrigger)
{
category = "TeleportTriggers";
tickPeriodMS = 100;
};3. Now, in the same file write this basic trigger code:
function TeleportTrigger::onEnterTrigger(%DB , %Trigger , %Obj)
{
echo( %Obj , " just entered trigger: ", %Trigger );
}
function TeleportTrigger::onLeaveTrigger(%DB , %Trigger , %Obj)
{
echo( %Obj , " just left trigger: ", %Trigger );
}4. Now (after saving trigger.cs), run starter.fps and load the village mission.
5. Open the console (~).
6. Verify that datablock was instantiated by typing:
echo( isObject( TeleportTrigger ) );
If this prints 1 then the datablock was instantiated. If it prints 0, check for errors in your log during the load sequence.
7. Using the world editor, make a trigger object and use the "TeleportTrigger" datablock when initializing it.
8. Open the console and type: cls();
9. Close the console and walk you player into and out of the trigger area.
10. Open the console and you should see the messages from the enter and leave scripts.
I'm pretty sure you should be good to go with this example.
Hall Of Worlds - For GamersEdM|GPGT
#7
Well, although it pains me to admit it, my example for this in the book is wrong.
Let me straighten out the documentation error here. (I'll also put this in the errata doc over the weekend).
What you're talking about is the group trigger mechanism.
The purpose of a group trigger is to allow you associate objects with a trigger so that you can send those obects messages whenever a shapebase derived object walks into, out of, or stays in 'their' trigger zone.
So, how does this work?
Follow these directions to see:
0. Start with a virgin copy of FPS starter kit.
1. Open "starter.fps\server\scripts\triggers.cs" and write this code:
2. Next, in the same file, write these scripts:
3. Now (after saving trigger.cs), run starter.fps and load the village mission.
4. Open the console (~).
5. Verify that datablock was instantiated by typing:
echo( isObject( TrapTrigger ) );
6. Start up the world editor.
7. Create a simGroup.
8. Create a trigger and make sure it is stored in the simgroup.
9. Create any objects you want to be triggered by the trigger object and make sure that they too are stored in the same simgroup.
10. Stop. At this point, you should have a simGroup containing a single trigger and one or more objects.
11. Open the console and type: cls();
12. Close the console and walk you player into and out of the trigger area.
13. Open the console and you should see the messages from the ShapeBase:: scripts you just wrote.
I hope this helps, and I'm really sorry to have goofed up the documentation of this feature.
Hall Of Worlds - For Gamers
EdM|GPGT
10/27/2006 (6:59 pm)
@mbWell, although it pains me to admit it, my example for this in the book is wrong.
Let me straighten out the documentation error here. (I'll also put this in the errata doc over the weekend).
What you're talking about is the group trigger mechanism.
The purpose of a group trigger is to allow you associate objects with a trigger so that you can send those obects messages whenever a shapebase derived object walks into, out of, or stays in 'their' trigger zone.
So, how does this work?
Follow these directions to see:
0. Start with a virgin copy of FPS starter kit.
1. Open "starter.fps\server\scripts\triggers.cs" and write this code:
datablock TriggerData( trapTrigger )
{
category = "TeleportTriggers";
tickPeriodMS = 100;
};2. Next, in the same file, write these scripts:
function ShapeBase::onTrigger( %this , %triggerID, %triggerStatus)
{
if( %triggerStatus )
{
echo( "Something entered the trigger I am associated with" );
}
else
{
echo( "Something left the trigger I am associated with" );
}
}
function ShapeBase::onTriggerTick( %this , %triggerID )
{
echo( "Something is still in the trigger I am associated with" );
}
function SimGroup::onTrigger(%this, %triggerId, %triggerStatus )
{
for ( %count = 0 ; %count < %this.getCount() ; %count++ )
{
%this.getObject( %count ).onTrigger( %triggerId , %triggerStatus );
}
}
function SimGroup::onTriggerTick(%this, %triggerId)
{
for ( %count = 0 ; %count < %this.getCount() ; %count ++ )
{
%this.getObject( %count ).onTriggerTick( %triggerId );
}
}3. Now (after saving trigger.cs), run starter.fps and load the village mission.
4. Open the console (~).
5. Verify that datablock was instantiated by typing:
echo( isObject( TrapTrigger ) );
6. Start up the world editor.
7. Create a simGroup.
8. Create a trigger and make sure it is stored in the simgroup.
9. Create any objects you want to be triggered by the trigger object and make sure that they too are stored in the same simgroup.
10. Stop. At this point, you should have a simGroup containing a single trigger and one or more objects.
11. Open the console and type: cls();
12. Close the console and walk you player into and out of the trigger area.
13. Open the console and you should see the messages from the ShapeBase:: scripts you just wrote.
I hope this helps, and I'm really sorry to have goofed up the documentation of this feature.
Hall Of Worlds - For GamersEdM|GPGT
#8
Great book btw its helped me a lot!
11/02/2006 (11:24 am)
Thank you Edward, I'll try this out later. This will come in handy in my project.Great book btw its helped me a lot!
#9
"In versions prior to 1.4, only players and vehicles tripped a trigger. Now items do also"
so , with triggers works with items.
but is not working , are you sure about that ??
the problem is in this post
www.garagegames.com/mg/forums/result.thread.php?qt=74773
05/02/2008 (9:23 am)
I am following the GameProgrammersGuideToTorque.pdf in the page 338 says :"In versions prior to 1.4, only players and vehicles tripped a trigger. Now items do also"
so , with triggers works with items.
but is not working , are you sure about that ??
the problem is in this post
www.garagegames.com/mg/forums/result.thread.php?qt=74773
#10
"In versions prior to 1.4, only players and vehicles tripped a trigger. Now items do also"
so , with triggers works with items.
but is not working , are you sure about that ??
the problem is in this post
www.garagegames.com/mg/forums/result.thread.php?qt=74773
05/02/2008 (12:56 pm)
I am following the GameProgrammersGuideToTorque.pdf in the page 338 says :"In versions prior to 1.4, only players and vehicles tripped a trigger. Now items do also"
so , with triggers works with items.
but is not working , are you sure about that ??
the problem is in this post
www.garagegames.com/mg/forums/result.thread.php?qt=74773
Torque Owner Joe O
Average Joe Software
"a color vector is now exposed under the name underwaterFog and can be modified from the Inpsector and from scripts."