A real simple AI pack example
by Gary Haussmann · 02/10/2006 (3:11 pm) · 6 comments
If you've read some of Phil's posts about his AI Pack, one of the key concepts he mentions in
this post is that a person should be able to setup a lot of situations by simply placing a few objects and setting a few data fields. They should not be required to hack up a bunch of script functions and C++ code, although scripting may be required for a funky or unusual type of AI behavior. In this vein, I've been getting the basic triggers to work and itegrating them into the editor for (hopefully) easy use.
Here I present the simplest possible example, and the one that will probably be used in many places: if the player enters a specific area, NPC baddies spawn. Again, you should be able to do this without writing up additional script code or modifying script files.
So we start by slapping down two trigger objects. One is the volume trigger, that goes off when it is entered, exited, or occupied. Here we have the volume trigger "spawntest" setup right on top of the firepit, which will activate its target "spawnhere" when entered.

The second trigger objects is "spawnhere" which will spawn AIPlayers. When triggered, "spawnhere" will spawn three AI NPCs with a interval of 5 seconds between each spawn, indicated by the "MaxActivation" and "TriggerDelay" fields. You can also see other fields like "monsterType" and "brainFactory" which let you select which AIPlayer datablock and AIBrain to use.

After you enter the volume trigger, the spawner will spew forth three AI DefaultMonsters. At this point the spawner has hit its max activation and so no more orcs will spawn.

Lets say the spawner didn't work quite right and you wanted to tweak the timing or activation values. If we wanted to be annoying we could force you to save and restart the mission to try out your new settings, but luckily there is a reset button in the AI menu that will reset the triggers. After resetting you can walk on the firepit and three more DefaultMonsters will spawn.

So there you can see that the most basic triggers are working. There are a lot of bits that need polishing; for example, some sort of visual animation or feedback indicating when a trigger goes off would be extremely helpful methinks. But at this point I figured I had enough screenshots to justify a blog post :P
this post is that a person should be able to setup a lot of situations by simply placing a few objects and setting a few data fields. They should not be required to hack up a bunch of script functions and C++ code, although scripting may be required for a funky or unusual type of AI behavior. In this vein, I've been getting the basic triggers to work and itegrating them into the editor for (hopefully) easy use.
Here I present the simplest possible example, and the one that will probably be used in many places: if the player enters a specific area, NPC baddies spawn. Again, you should be able to do this without writing up additional script code or modifying script files.
So we start by slapping down two trigger objects. One is the volume trigger, that goes off when it is entered, exited, or occupied. Here we have the volume trigger "spawntest" setup right on top of the firepit, which will activate its target "spawnhere" when entered.

The second trigger objects is "spawnhere" which will spawn AIPlayers. When triggered, "spawnhere" will spawn three AI NPCs with a interval of 5 seconds between each spawn, indicated by the "MaxActivation" and "TriggerDelay" fields. You can also see other fields like "monsterType" and "brainFactory" which let you select which AIPlayer datablock and AIBrain to use.

After you enter the volume trigger, the spawner will spew forth three AI DefaultMonsters. At this point the spawner has hit its max activation and so no more orcs will spawn.

Lets say the spawner didn't work quite right and you wanted to tweak the timing or activation values. If we wanted to be annoying we could force you to save and restart the mission to try out your new settings, but luckily there is a reset button in the AI menu that will reset the triggers. After resetting you can walk on the firepit and three more DefaultMonsters will spawn.

So there you can see that the most basic triggers are working. There are a lot of bits that need polishing; for example, some sort of visual animation or feedback indicating when a trigger goes off would be extremely helpful methinks. But at this point I figured I had enough screenshots to justify a blog post :P
About the author

Torque 3D Owner dsfsd