Two simple questions
by Brandon Gamblin · in Torque Game Engine · 12/16/2004 (10:00 am) · 5 replies
I'm a seven-year veteran game programmer, but a total newb to TGE, so when I say that I'm having a little trouble with TGE, please understand that it's only because I don't completely understand this interface.
Some people have asked me to teach them how to add audio to a TGE game, and how to add multiple AI objects. I've read through several tutorials now (some really great ones), but none of them seem to talk about placing AI objects, or attaching event triggers (for audio).
I've found the following code in player.cs:
datablock AudioProfile(DeathCrySound)
{
fileName = "~/data/sound/orc_death.ogg";
description = AudioClose3d;
preload = true;
};
function Player::playDeathCry( %this )
{
%this.playAudio(0,DeathCrySound);
}
This seems fairly straightforward, and I can call up the sound from the console by saying "player_id.playDeathCry();". However, when I change something in the player.cs (i.e. get it to play a sound on armor collision or something), I don't see those changes in-game. If I shut down the engine, then restart it, I still don't see those changes (BTW, I also tried echoing info to the console on collision. Still, no dice).
Also, I can't seem to find where (I'm looking at the example FPS game now) the AI orc is created, or how to create more of them. In the creater menu, I don't see that actor listed, and I can't grep "orc" anywhere in the sample. Where is this actor added, and can I create more of them in the editor?
If you guys know of a tutorial I missed, I would greatly appreciate some help.
Thanks for your time.
Some people have asked me to teach them how to add audio to a TGE game, and how to add multiple AI objects. I've read through several tutorials now (some really great ones), but none of them seem to talk about placing AI objects, or attaching event triggers (for audio).
I've found the following code in player.cs:
datablock AudioProfile(DeathCrySound)
{
fileName = "~/data/sound/orc_death.ogg";
description = AudioClose3d;
preload = true;
};
function Player::playDeathCry( %this )
{
%this.playAudio(0,DeathCrySound);
}
This seems fairly straightforward, and I can call up the sound from the console by saying "player_id.playDeathCry();". However, when I change something in the player.cs (i.e. get it to play a sound on armor collision or something), I don't see those changes in-game. If I shut down the engine, then restart it, I still don't see those changes (BTW, I also tried echoing info to the console on collision. Still, no dice).
Also, I can't seem to find where (I'm looking at the example FPS game now) the AI orc is created, or how to create more of them. In the creater menu, I don't see that actor listed, and I can't grep "orc" anywhere in the sample. Where is this actor added, and can I create more of them in the editor?
If you guys know of a tutorial I missed, I would greatly appreciate some help.
Thanks for your time.
#2
Most likely you have an error in your script, and it isn't compiling, so instead the engine loads the last known working (compiled) version.
Check back in the early part of the console.log and it should give you an error report.
12/16/2004 (10:11 am)
Quote:However, when I change something in the player.cs (i.e. get it to play a sound on armor collision or something), I don't see those changes in-game.
Most likely you have an error in your script, and it isn't compiling, so instead the engine loads the last known working (compiled) version.
Check back in the early part of the console.log and it should give you an error report.
#3
Also, I figured out why my changes weren't showing up. I was changing demo/server/scripts/player.cs instead of starter.fps/server/scripts/player.cs
WOOT!
Thanks again!
12/16/2004 (10:35 am)
Sweet! Thanks Stephen! The "AI Beginning" told me exactly what I needed (specifically, where Kork came from, and how to alter him). Also, I figured out why my changes weren't showing up. I was changing demo/server/scripts/player.cs instead of starter.fps/server/scripts/player.cs
WOOT!
Thanks again!
#4
12/16/2004 (11:02 am)
Keep in mind, that is a re-write of the stock 1.3 AI code. I'd go with the resource, it's done well!
#5
BTW, thanks for the prompt reply!
12/16/2004 (11:15 am)
Oh, sure. For me, the most important part was finding out where Kork came from (where he was instantiated), so that I could create lots of little Korks. :)BTW, thanks for the prompt reply!
Torque 3D Owner Stephen Zepp
AI Beginning.
It's basicallly a ground-up re-write of the "stock" AIPlayer stuff.