Game Development Community

AI Bot Dynamic field

by Levi Putna · in Torque Game Engine · 06/12/2006 (9:47 pm) · 3 replies

I have created a small AI Bot that is added to the game on startup. The location the bot is added is represented by a marker that is visible in only when in F11 edit mode.

In my code I specify the weapon the bot uses. But I want to be able to specify the weapon each bot will using in its markers Dynamic field.

Can anybody help me out?

#1
06/12/2006 (10:36 pm)
Can you clarify? are you asking how to simply make a dynamic tag and put the weapon name in it.


or are you trying to ask how you can determine what weapon the bot will have when it's spawned?


if it's the first.

you can add a dynamic field just like this

%bot.weapon="my weapon";
#2
06/13/2006 (12:12 am)
Sorry that was a bad explanation, it has been a long day :)

I have created markers with this code.

datablock MissionMarkerData(AIbotfx)
{
   // Mission editor category, this datablock will show up in the
   // specified category under the "shapes" root category.
	category = "AIMarker";
   // Basic Item properties
	shapeFile = "~/data/shapes/player/player.dts";
};

when the game starts I am replacing all my markers with the bots.

The thing I want to be able to do is have a dynamic field on the marker, so that when the marker is replaced with the bot I can give the bots weapon the value in the markers dynamic field.

The problem is I do not know where to put the %bot.weapon="my weapon"; so that it is added to the marker when it is created.
#3
06/13/2006 (1:58 am)
I have tried
function MissionMarkerData::create(%data)
{
%data.weapon="my weapon";
}
and
function MissionMarkerData::onAdd(%this, %obj)
{
%this.weapon="my weapon";
}

But they don't work :(