AiPlayer and the World Editor
by Bill Koons · in Torque Game Engine · 03/16/2005 (4:04 pm) · 4 replies
Does anyone know what needs to be done so that an AiPlayer can be added from the world editor (F4 - World Editor Creator)? I can currently spawn AI from script, but I'd like to be able to place them in the world editor if possible.
About the author
#2
In your AiPlayer datablock definition (playerData), add this field:
Now, add these lines to the script where your AiPlayer datablocks are being defined:
Save everything, open Torque, bring up the World Editor Creator and expand the Shape list. You'll see "AiPlayer" in there, and all PlayerData datablocks where you added the category field will be listed there. Pick one of them and an AiPlayer will be added.
The category field is very usefull to add specialized objects to the editor.
03/17/2005 (12:56 pm)
It's very easy, actually.In your AiPlayer datablock definition (playerData), add this field:
category = "AiPlayer";
Now, add these lines to the script where your AiPlayer datablocks are being defined:
function PlayerData::create(%data)
{
// The mission editor invokes this method when it wants to create
// an object of the given datablock type.
%obj = new AiPlayer() {
dataBlock = %data;
};
return %obj;
}Save everything, open Torque, bring up the World Editor Creator and expand the Shape list. You'll see "AiPlayer" in there, and all PlayerData datablocks where you added the category field will be listed there. Pick one of them and an AiPlayer will be added.
The category field is very usefull to add specialized objects to the editor.
#3
%obj = new somthinggoeshere() {
I don't know what to put for the new statement. I tired Misc thinking that it will show up under the Shapes/Misc. What should I use here?
03/18/2005 (3:31 pm)
I'm tyring to do the same for simple objects like a barrel or box. The only part that i'm getting stuck in is in the following line.%obj = new somthinggoeshere() {
I don't know what to put for the new statement. I tired Misc thinking that it will show up under the Shapes/Misc. What should I use here?
#4
03/18/2005 (9:42 pm)
Manoel: Thanks so much. Worked great!
Torque Owner Dracola