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.
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.
#2
03/15/2004 (12:21 pm)
Hmm interesting ;)
#3
03/15/2004 (10:53 pm)
Nice work Paul and Howard. I found the first turret installment very easy and fun to use. Once I was able to untwist the nodes (thx Paul, dunno if you remember me emailing you)I used my own models. The impact rotation looks like a lot of fun, good idea!
#4
03/16/2004 (3:00 am)
Theres also some script cleanup and small editions from the Lore code that are going back into the Turret code that Paul provided and helped us out with over the months.
#5
--ishbuu
03/16/2004 (9:50 am)
YAY!! finally turrets to work with 1.2.0!! I'm sooooo happy, i'll try it out when i get home.--ishbuu
#6
I'll check it out, thanks in advance
03/27/2004 (4:07 am)
This may just save me some time coding ;)I'll check it out, thanks in advance
#7
i.e the shaking and what not
07/15/2004 (4:16 am)
awesome resource... was the network issues ever resolved?i.e the shaking and what not
#8
A question:
The AI turret tracks the player when within the specified radius - it then calls :
function AITurretData::fireGun(%this,%turret)
{
// fire gun
%turret.fire(0);
echo("FIRING NOW: at " @ $Sim::Time);
// setup next fire time
%this.setupNextFire(%turret,%this.fireRate,%this.fireRateVariance);
}
periodically as it should..
My problem is that, although %turret.fire(0) is called, I don
08/12/2004 (4:31 am)
Excellent resource.A question:
The AI turret tracks the player when within the specified radius - it then calls :
function AITurretData::fireGun(%this,%turret)
{
// fire gun
%turret.fire(0);
echo("FIRING NOW: at " @ $Sim::Time);
// setup next fire time
%this.setupNextFire(%turret,%this.fireRate,%this.fireRateVariance);
}
periodically as it should..
My problem is that, although %turret.fire(0) is called, I don
#9
08/12/2004 (9:43 am)
I just found the reason - I missed the changes to the shapeBase.cs file - when I added those changes then the turret fires!
#10
Add Turrets to Vehicles
Good luck.
10/08/2004 (7:42 am)
Just a quick addition because someone was having trouble mounting turrets to vehicles, I outlined it here:Add Turrets to Vehicles
Good luck.
#11
01/04/2005 (11:02 am)
Does it work with version 1.3 of Torque?
#12
but maybe there is something wrong in the file"vehicle.cc"
[
static U32 sDirtySetMask = PlayerObjectType |
// phdana turrets ->
TurretObjectType |
// <- phdana turrets
VehicleObjectType;
]
i can't find the"static U32 sDirtySetMask "in the 1.3's engine/game/vehicles/vehicle.cc" file.
02/19/2005 (12:33 am)
i'm trying it in 1.3but maybe there is something wrong in the file"vehicle.cc"
[
static U32 sDirtySetMask = PlayerObjectType |
// phdana turrets ->
TurretObjectType |
// <- phdana turrets
VehicleObjectType;
]
i can't find the"static U32 sDirtySetMask "in the 1.3's engine/game/vehicles/vehicle.cc" file.
#13
I haven't had a whole lot of time to incorporate this into 1.3 . The game i'm working on right now has no need for this resource.
02/28/2005 (11:01 am)
"Removed setDirtyState because it is no longer needed." From the change log for 1.3 I haven't had a whole lot of time to incorporate this into 1.3 . The game i'm working on right now has no need for this resource.
#14
player.cc
C:\Torque\SDK\engine\game\player.cc(1553) : error C2065: 'mJetting' : undeclared identifier
Error executing cl.exe.
03/10/2005 (2:18 am)
what about this errorplayer.cc
C:\Torque\SDK\engine\game\player.cc(1553) : error C2065: 'mJetting' : undeclared identifier
Error executing cl.exe.
#15
That error (should) have nothing to do with this resource but the jetting resource.
By the way, I keep on getting the undeclared identifier error in gameBase.h, :(
03/14/2005 (2:13 pm)
@Moussa:That error (should) have nothing to do with this resource but the jetting resource.
By the way, I keep on getting the undeclared identifier error in gameBase.h, :(
#16
06/09/2005 (12:26 pm)
hmm..... 10 player.cc errors left : / plz let me know if anybody has implented these turrets in 1.30
#17
edit: I'll try to get this in 1.3 and let you know if I can.. okay I got it in 1.3, with 0 build errors and can get into turrets but I'm using the vehicle resource. Oh and the AI turrets don't fire.
06/26/2005 (9:38 am)
take out the line about mjetting that was in the phdana jetpack resource it got into this code also.edit: I'll try to get this in 1.3 and let you know if I can.. okay I got it in 1.3, with 0 build errors and can get into turrets but I'm using the vehicle resource. Oh and the AI turrets don't fire.
#18
07/12/2005 (8:09 am)
@master Treb, can you give it to me? or tell me how you did it?
#19
08/04/2005 (3:39 pm)
what the implemented vehicle resource or the source I don't know how I would go about the source though :(.
#20
I downloaded this and got it working in 1.3 last night. A small error in gamebase.h modification. Change should be made under 'class gamebase : public scene object', not 'struct gamebase'. For me, that brought down 67 build errors to 0. Also, turrets use rifle info to fire. If you don't have a rifle installed, change this to a weapon you do have in genericaiturret.cs and genericturret.cs.
Thanks Paul/Brian. Excellent work.
08/16/2005 (5:29 am)
@Vincent, did you get it working?I downloaded this and got it working in 1.3 last night. A small error in gamebase.h modification. Change should be made under 'class gamebase : public scene object', not 'struct gamebase'. For me, that brought down 67 build errors to 0. Also, turrets use rifle info to fire. If you don't have a rifle installed, change this to a weapon you do have in genericaiturret.cs and genericturret.cs.
Thanks Paul/Brian. Excellent work.

Associate Paul Dana
I have some improvements to the Turret and AITurret class that I will roll into this version when they are finalized. They include:
1) AI Turret aim bug - MathUtils::getAnglesFromVector() is slightly flawed.
2) Damage Emitters - turrets have their own damage emitters similar to a vehicle for smoke, flame & sparks.
3) Impact Rotation - you can apply an impulse to a Turret. This will not MOVE the turret in anyway (the assumption is that turrets are imobile with respect to where they are placed or what they are mounted on) but it will cause the turret to ROTATE with the impact. This makes shooting at them more fun and provides some feedback to the
player that they have hit the turret.