Game Development Community


#1
06/28/2005 (3:35 am)
Go into the AIGuard.cs file and make sure it is enabled... It is not by default.
#2
06/28/2005 (7:25 am)
Did you enven try and figure out what was wrong? Go into AIGuard.cs there is a global variable called $AIGUARD_ISENABLED = false; or something like that. Set it to be enabled.
#3
06/28/2005 (7:34 am)
Well. Open the file... At the top there is a bunch of $... = @#$%^;

those are global variables. They are active everywhere for that guard.

%varName variables are only alive in the function they were used in.

Now. If you go and look at loadentities()

that is a function. That is what is begin called from startGame in the game.cs file (You did put that line in there right?) ... So when you start up... it calls loadEntities... So look through there..... It wlil say
if(I am enabled)
{
   spawn some gaurds;
}

so... if that global isnt set to let them spawn... you wont get any guards

echo is your friend... use echo statements
echo("Matt cant code yet");

to find what is being called...


EDIT: Echos show up in the console... you can also type htem in there to see what is going on.

You can call loadEntities() from there aswell, to control exactly when to spawn the guards.
#4
06/28/2005 (8:24 am)
Well, put in some echos... and see whats going on.. Make sure loadentities is being called.

make sure the marker is enabled

Check the console for errors.

Put echos in load entities to see how far its getting... What is stopping it from loading hte bots.
#5
06/28/2005 (9:58 am)
You did add AIGuard.cc and AIGuard.h to the source and compile, right ?
#6
06/28/2005 (10:12 am)
VC6 You have to add it to the folder then go into the ide and add it to the project itself... Just biulding it wont include the files.
#7
06/28/2005 (10:20 am)
Rightclick on the project.. choose add files to fodler or whatever. And then select the .h and .cc files. THey should add. Save the workspace. Build the exe.
#8
06/28/2005 (11:35 am)
Maybe I could expand on what Chris said so assuming your using vc++ the solution explorer on the right hand side open torquedemo go down to the file "game" open that. now right click on the folder "game go to add/add existing item" find AIguard.cc/.h select them both and click open. thats a noob killer if you don't add items to the solution explorer it doesn't read them when it builds even if they're in the file. oh and say if you made a new folder called AI you would need to do that on the solution explorer as well.

edit:

[]answer to different forum[
oh and I got land mines I'm having a little trouble with radius damage and explosions because I kind of have to add them manually because I'm using an item instead of a projectile.
]
#9
10/30/2005 (3:21 am)
Um, how do you add the files to the project in Eclipse???
I havin same issues, and i think its the "add the files to the project" statement that to us non-programmers is a killer.
???i gots no idea. I see the files on the left, which is (looks like) just a directory tree structure.

thanks in advance for the help
#10
12/24/2005 (6:46 pm)
Hi everyone, I see people are using the AIGuard resource quite a bit here and I've been doing the same thing. I got them to spawn and everything however, in my code I call the AIGuard::LoadEntities(); two times like this...


AIGuard::LoadEntities();
AIGuard::LoadEntities();


I call it two times so that two guards will appear at every one spot with an AIGuardMarker. But for some reason..........and probably a big reason.............the whole game freezes -- or to be more specific the torque game engine freezes. You can call it once to spawn all your AI's and have them respawn when they die but it won't let you spawn doubles or something. I suppose I can create two loops in the AIGuard::LoadEntities() function but that is not what I want because I want to call it again when the player moves into a triggered area to double the number of hateful enemies :( Anybody got a clue how to overcome this?

Also, I was wondering if anybody has a list of all callback functions for say StaticShapes, PlayerData ...etc... because I notice that for example StaticShapes have an ::onCollision() event or callback function but in the Advanced 3D Game Programming ALL in ONE book it doesn't have event/callback function lists for objects or datablocks. It helps to know because sometimes I want to handle a certain event that is happening to my objects in the game world without having to write code myself that might be roundabout or tedious to do what's already there.
#11
12/25/2005 (5:33 pm)
Greetings all :)

Being an extreeme newbie and all this is prolly simply answered :)

I have a network of guards spawned using AIGuard all of which react and chase if distance is set to 50 (didn't want them taking off after anything that moved) and they attack, and return and pick up health packs fine.

Is there a simple way, however, of making them lock onto and chase anyone who shoots them whilst outside their range of contact?

Currently they look around a bit, run to a health pack and go home if you stay outside the radius.

My ideal would be to have them chase if you get too close, or if they are shot.. lock onto the shooter and close them for a while and only let go again if the player runs out of range.

Regards and Merry Xmas to all.

Graham
#12
12/27/2005 (6:37 pm)
@Graham Evans:

Tricky one at first glance, and I don't know the AIGuard class, but it helps to know that whilst bots don't know who shot them, the projectile does.

So, check out the function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)

In this function call, which happens when anything that inherits the Armor datablock is damaged (might have changed in 1.4, just downloading it now), the parameter %sourceObject is the projectile or object that caused the damage.

In the projectile we have another variable called sourceObject, which is normally the player that fired the projectile. So, if you change the Armor::damage function, you can do something like:

if(%obj.getClassName() $= "MyAIClassName")
{
%obj.FindAndKill(%sourceObject.sourceObject);
}

Good luck, playing with AI is my favourite part of TGE.
#13
12/28/2005 (8:46 pm)
@ Sebastian,

Wonderful info, thanks:))

I will have a look at that, because that may well be the hook I need for a number of things... It hadn't occured to me the projectile might know who fired it:))

Thanks again, amd yes, I love playing with the AI.. I just wish that my C++ skills were current, I make far to many silly mistakes with format or commands and then wonder if the idea is sound, or its just my coding letting me down.. but I am getting there, slowly but surely:)

Regards, and thanks again.

Graham Evans