Game Development Community

dev|Pro Game Development Curriculum

Turret & AITurret classes, Version 1.20

by Brian Howard · 03/14/2004 (9:33 am) · 131 comments

Download Code File

Included in this archive are the original files and the files modified to work with 1.20 version. Most files did not have to be modified. Files that were modified were saved as a new file in an originalname_1_20.ext format. For example, trigger.cc had to be modified and the 1.20 code was saved as trigger_1_20.cc

I've maintained the same commenting format Paul used.

I've included the original turret_readme.txt file and an updated turret_readme_1_20.txt in the archive. The new readme file contains references for other fixes I found along the way. Please let me know if I missed a reference.

***I have not tested this on moving vehicles!

Hope the changes are helpful. I'll check back in, and do what I can to help out. This is my first posting, so let me know if there is a better way to communicate code updates.

About the author

Recent Blogs

#41
01/09/2006 (8:13 pm)
So is this resource working with TGE 1.4?
#42
01/10/2006 (7:55 am)
very probable I did poke around quite a bit, and it ended up working but I might have just corrected my own errors so I would say yes.
#43
01/10/2006 (3:00 pm)
So I'm guessing that you will update the resource or even post a new resource?
#44
01/10/2006 (3:37 pm)
I don't think your really understanding what I'm saying so I'll say it flat out. I believe this resource is working with torque 1.4.
#45
01/10/2006 (9:40 pm)
turret.cc
e:\test\sdk\engine\game\turrets\turret.cc(18) : error C2065: 'TurretObjectType' : undeclared identifier
trigger.cc
e:\test\sdk\engine\game\trigger.cc(517) : error C2039: 'potentialEnterObject' : is not a member of 'GameBase'
e:\test\sdk\engine\game\gamebase.h(143) : see declaration of 'GameBase'
Skipping... (no relevant changes detected)
#46
01/21/2006 (12:49 pm)
Why is there jetting code is in player.cc? Dont you have some "log" on what you changed in that file? I cant just replace the whole file

edit:

worked it out by looking for the "phdana" comments. To everybody else: Dont include the jetting/jetpack code in player.cc, it's not ment to be there for this resource (unless you want that to)

Works nicely, only the turrets try to attack my cars and not the players :P i have to look into that..

Thanks
#47
01/22/2006 (12:34 pm)
Robin try using getMountedObject(nodenumber).getposition() to find the position of the mounted player. when a player mounts a car he becomes the car so thats what the turret looks at.

might be wrong but worth a try.
#48
01/22/2006 (12:36 pm)
@greg I'll look what I did about those they look familiar
#49
01/22/2006 (2:13 pm)
@Master Treb
Thanks, but it's only attacking the cars.. even when there are no players in it. I can just stand next to it and watch. My cars cant be destroyed yet... maybe it takes the next target as soon as his current is destroyed?
#50
01/22/2006 (2:24 pm)
@greg did you put

// phdana turrets ->
virtual void potentialEnterObject(GameBase*);
// <- phdana turrets

after

/// Sets the client controling this object
/// @param client Client that is now controling this object
virtual void setControllingClient(GameConnection *client);
/// @}

in gamebase.h
#51
01/24/2006 (1:55 pm)
I just got the turret working in 1.4 with VS2005. When I did the test run and mounted onto the turret, the turret appeared to lift in the air. Is this action correct?
#52
01/24/2006 (3:47 pm)
yes thats the animation it runs activate i think its called
#53
01/25/2006 (6:52 am)
Thanks for the info Master Treb. I noticed that my turret can spin 360 degrees. However, it appears that it can only fire within a certain range. Do you know how to overcome this? And is there a way to restrict turret movement to only that valid range?

------Sometime Later------
Okay I was able to figure out how to restrict the turret movement. I had to add the following lines.

// turret specific stuff
minYaw = -180.0;
maxYaw = 180.0;
minPitch = -45.0;
maxPitch = 0.0;

These were added to "datablock TurretData(GenericTurret)" definition. I am now stuck trying to figure out why the turret will not fire in some ranges. If anyone has an idea that would be great help.
#54
01/26/2006 (12:53 pm)
Does anyone know how to customize a turret in 3DS Max? I followed the readme file and used the correct joint names. However my turret does not rotate pitch or yaw. Any suggestions would be greatly appreciated.
#55
01/26/2006 (5:32 pm)
Master Treb yes i did but i couldnt get it working past that so i put it away for a bit. So im going to try to do a fresh install on 1.4 this will be attempt 6
#56
01/26/2006 (5:59 pm)
I'm really busy currently with school (end of quarter) but if I find time I'll double check for any changes I may have made.
#57
03/18/2006 (11:50 pm)
So has anyone got this resource working for moving vehicles? And can anyone confirm that it works with TGE 1.4?
#58
03/19/2006 (1:17 pm)
I can confirm it working with 1.4. I don't know about mounted onto vehicles but I believe there are seperate resources detailing how to do that.

edit: though in objecttypes.h bit needs to be capitolized
#59
03/21/2006 (11:44 pm)
I have a problem with my FlyingVehicle when it fires projectiles they don't fire correctly in the trigger area of the AITurret. The problem goes away once I leave the trigger area. Does anybody have suggestions on how to fix this problem.
#60
05/16/2006 (7:33 am)
I resolve all problem....But this impossible .... uff....
Have this problem....
On mount on my turret....the visual is not frontal...but lateral...I test to rotate in milkshape my turret and all ok...But i would rotate in torque in all grade and my player see always frontal.....
And is possible to evitate a press the spacebar to dismount and press any key? THANKS...plese help me!!