Game Development Community

ObjectBuilderGui

by Ace · in Torque Game Engine · 07/29/2004 (5:12 am) · 9 replies

Heh. no forum for GUI.

I have been playing with the mission editor GUI, what i have done is added AI back into the mission editor along with sub fields aiSpider and aiplayer. that was cool to figure out.

When you click on the aispider the object builder GUI popup appears and lets you pick the data block you want, it builds a spider from PlayerData SpiderBody and drops it to the ground, cool it will save and be in the map next time you run it.

My question is: why is it just a spider and not and aispider, i must be missing something, i should beable to build an "aiplayer" this way too right? back to looking.

#1
07/29/2004 (5:26 am)
Not exactly sure what you mean, the objects are usually labeled in respect to the category variable set in the datablock.
#2
07/29/2004 (5:50 am)
So i should beable to spawn an AI this way?

It appears to be just spwaning the shape of the spider. Could it be because of where i put the AI object? Ill try it as a New object and see what happens.
#3
07/29/2004 (7:17 am)
Look for the function that gets called to create the object (::create()), thats the thing thats getting called to create one of whatever it is.

objectbuilder.cs i believe
#4
07/29/2004 (8:20 am)
Thanks its objectBuilderGui.gui and i have this in it:

//ace AI
function ObjectBuilderGui::buildAISpider(%this)
{
   %this.className = "AISpider";
   %this.addField("dataBlock", "TypeDataBlock", "Data block", "PlayerData SpiderBody");
   %this.process();
  
  
}

function ObjectBuilderGui::buildAIPlayer(%this)
{
   %this.className = "AIPlayer";
   %this.addField("dataBlock", "TypeDataBlock", "Data block", "PlayerData PlayerBody");
   %this.process();
}
//endace

Do i need to addfeilds?


this.addField("setScanningPlayers(true)");
#5
07/29/2004 (4:02 pm)
Maybe these lines
%this.addField("dataBlock", "TypeDataBlock", "Data block", "PlayerData SpiderBody");
and
%this.addField("dataBlock", "TypeDataBlock", "Data block", "PlayerData PlayerBody"
should be
%this.addField("dataBlock", "TypeDataBlock", "Data block", "AIPlayerData SpiderBody");

 %this.addField("dataBlock", "TypeDataBlock", "Data block", "AIPlayerData PlayerBody");
and yes you would have to turn on scanning or something similar to tell it to do something
#6
07/30/2004 (1:52 pm)
Ill try to give you a better idea what s going on here.
in EditorGui.cs
This creates the buttons in the editor
function Creator::init( %this )
{
   %this.clear();

   $InstantGroup = "MissionGroup";
//ace
     // *** OBJECTS - do the objects now...
                  
		     %objGroup[0] = "AISpider";
                    

		     %AISpider_Item[0] = "AISpider";
		   


		     // objects group
		     %base = %this.addGroup(0, "AI");

		     // create 'em
		     for(%i = 0; %objGroup[%i] !$= ""; %i++)
		     {
		        %grp = %this.addGroup(%base, %objGroup[%i]);

		        %groupTag = "%" @ %objGroup[%i] @ "_Item";

		        %done = false;
		        for(%j = 0; !%done; %j++)
		        {
		           eval("%itemTag = " @ %groupTag @ %j @ ";");
		           if(%itemTag $= "")
		              %done = true;
		           else
		              %this.addItem(%grp, %itemTag, "ObjectBuilderGui.build" @ %itemTag @ "();");
		        }
	}



   //endace AI gui
   // ---------- INTERIORS

When you click on the AISpider button you get sent to the object builder in ObjectBuilderGui.gui

//ace AI
function ObjectBuilderGui::buildAISpider(%this)
{
   %this.className = "AISpider";
   %this.addField("dataBlock", "TypeDataBlock", "Data block", "PlayerData SpiderBody");  
   %this.process();
 
}


//endace

This is where i get lost, the buttons work fine, when you click the aispider button the objectBuilder pops up with the the datablock feild as SpiderBody . It shows all of the playerdata datablocks in the dropdown and places a spider/model on the ground when told to, or a orc/model and even a Demoplayer/model, but i can get any of them to any thing but spawn to the ground.

maybe i see why they took AI out of the mission editor. I tried about every thing.
#7
07/30/2004 (2:06 pm)
I think you will need to edit engine/game/collision/convex.h,
to get this to work.

change

TSStaticConvexType
to
//ace
TSStaticConvexType,
AIConvexType,
Shape3dsConvexType
//endace

Hopfully some will find this worthwhile to look into.
#8
07/30/2004 (2:10 pm)
Ace:
Anthony is correct that Should read AIPlayerData or whatever the datablock class name is for that object.
if you really examine that object you are spawning currently
You will note that like the code states it is merely a PlayerData object Not an AIPlayerData.

that Should fix the problem.

actually I've been away from this awhile now but
i'm pretty sure that just setting the classname will not override the datablock choices.
and it might / should be legal to assign that datablock.
#9
07/30/2004 (3:02 pm)
Sorry i ment to say i tried that.

when i change PlayerData SpiderBody to AIPlayerData SpiderBody, i lose whats in th dropdown so thats not it, neither is AISpiderData.

you have to remember the default aiplayer uses the player to create an aiplayer, same as the aispider , it uses a spider player. The spider.cs is an exact copy of the player.cs only making calls to spider instaed of player.

I think maybe i dont know how to add the ai stuff.

this gets called in aispider.cs when the aimanager gets called
%player.setScanningPlayers(true);

how can that be added to the feild?
%this.addField("setScanningPlayers(true)");

Do i have to re think my data blocks?