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.
#22
09/11/2005 (3:42 pm)
I can't get the ai turrets to fire I did michael's fix but they still don't do anything I told them to fire rockets and my normal turrets work does anybody know whats up?
#23
Object(1958) Trigger-> gamebase -> sceneobject -> Netobject-> Simobject
09/11/2005 (3:44 pm)
oh and I get the console error aiturret(45) unknown command setOwnerObject(1958) Trigger-> gamebase -> sceneobject -> Netobject-> Simobject
#24
09/20/2005 (4:48 am)
If you use MilkShape to make the turret model,you must use the menu:[Tools->Zero Joints]at the end of work.And,the smalTurretGun's direction must be the Y-axis positive.
#25
10/06/2005 (1:27 pm)
I have a problem i was wondering if someone could help me out with. After merging and compiling the files with no errors, i placed a staticshape turret in my mission using the editor. The turret shows up fine but as i walk up to the turret i can not mount it. Also i have to place the barrel of the turret in the mission seperate from the turret itself. I thought the scripting mounted the barrel directly on the turret. Any help?
#26
10/07/2005 (4:20 pm)
You need to make the turret as a shape static shapes are only for the looks and not affected by any script.
#27
10/20/2005 (3:04 pm)
Can someone explain to me how to go from a static shape to a functional shape? I realize that static shapes are any properly made .dts files that are placed in the correct directory; i also realize that to be a shape you must declare a correct datablock, but i thought that this was already definined in the genericTurret.cs? Thanks for slowing it down for me...
#28
10/20/2005 (3:33 pm)
Make sure you are making it from shapes/turrets. If you can't find turrets in the shape directory something isn't being read make sure you exec'd everything if you did check the console ~ and look for errors that could be stopping it from reading. also make sure there is a DSO for all the new scripts if there is then they are being read if not then they aren't.
#29
-----------
Warning: (c:\game dev tools\torque stuff\sdk_dl\engine\console\consoleobject.cc @ 62) Couldn't find class rep for dynamic class: TurretData
starter.fps/server/scripts/genericTurret.cs (0): Unable to instantiate non-conobject class TurretData.
Loading compiled script starter.fps/server/scripts/genericAITurret.cs.
Warning: (c:\game dev tools\torque stuff\sdk_dl\engine\console\consoleobject.cc @ 62) Couldn't find class rep for dynamic class: AITurretData
starter.fps/server/scripts/genericAITurret.cs (0): Unable to instantiate non-conobject class AITurretData.
-----------
Can anyone help me with this?
TIA
10/28/2005 (7:59 pm)
I get these warnings in the torque console:-----------
Warning: (c:\game dev tools\torque stuff\sdk_dl\engine\console\consoleobject.cc @ 62) Couldn't find class rep for dynamic class: TurretData
starter.fps/server/scripts/genericTurret.cs (0): Unable to instantiate non-conobject class TurretData.
Loading compiled script starter.fps/server/scripts/genericAITurret.cs.
Warning: (c:\game dev tools\torque stuff\sdk_dl\engine\console\consoleobject.cc @ 62) Couldn't find class rep for dynamic class: AITurretData
starter.fps/server/scripts/genericAITurret.cs (0): Unable to instantiate non-conobject class AITurretData.
-----------
Can anyone help me with this?
TIA
#30
10/30/2005 (12:44 pm)
are you sure you got the source files in right?
#31
trigger.cc(80) : error C2248: 'Trigger::setOwner' : cannot access protected member declared in class 'Trigger'
trigger.h(72) : see declaration of 'Trigger::setOwner'
trigger.h(40) : see declaration of 'Trigger'
trigger.cc(134) : error C2248: 'Trigger::setOwner' : cannot access protected member declared in class 'Trigger'
trigger.h(72) : see declaration of 'Trigger::setOwner'
trigger.h(40) : see declaration of 'Trigger'
I trimmed the file paths to make it easier to read.
edit: if I can get this working I'll publish the minor changes I made
10/30/2005 (4:30 pm)
okay I almost have this working in 1.4 with a few minor changes I get these errors though that I don't know how to fixtrigger.cc(80) : error C2248: 'Trigger::setOwner' : cannot access protected member declared in class 'Trigger'
trigger.h(72) : see declaration of 'Trigger::setOwner'
trigger.h(40) : see declaration of 'Trigger'
trigger.cc(134) : error C2248: 'Trigger::setOwner' : cannot access protected member declared in class 'Trigger'
trigger.h(72) : see declaration of 'Trigger::setOwner'
trigger.h(40) : see declaration of 'Trigger'
I trimmed the file paths to make it easier to read.
edit: if I can get this working I'll publish the minor changes I made
#32
I noticed that the readme says
"Just copy these files as-is into the appropriate folder and make sure you add these files to the appropriate Makefile or Project file."
1.) How is the project file/makefile needed for this? The makefile that i used was the targets.torque.mk file. Here i added the turret.cc files, but i was wondering if i had to include the .h files anywhere also. Is this analogous to including the scripts inside of the game.cs file?
2.)I also have a general question about the engine itself, when can i compile a modified file, versus compiling the whole engine?
thanks for anyone that can help me.
11/03/2005 (1:17 pm)
Thank you for bearing with me, through my first real modification to the engine.I noticed that the readme says
"Just copy these files as-is into the appropriate folder and make sure you add these files to the appropriate Makefile or Project file."
1.) How is the project file/makefile needed for this? The makefile that i used was the targets.torque.mk file. Here i added the turret.cc files, but i was wondering if i had to include the .h files anywhere also. Is this analogous to including the scripts inside of the game.cs file?
2.)I also have a general question about the engine itself, when can i compile a modified file, versus compiling the whole engine?
thanks for anyone that can help me.
#33
Also as to what i added in the last post, do i need to create a datablock for the turret in order to make it non-static? I still have not been able to get the turret to show up anywhere but the static shape section, can someone possibly step me through how to make a functional shape, in general, not necessarily for the implementation of the turret? Thank you
11/10/2005 (2:07 pm)
*bump*Also as to what i added in the last post, do i need to create a datablock for the turret in order to make it non-static? I still have not been able to get the turret to show up anywhere but the static shape section, can someone possibly step me through how to make a functional shape, in general, not necessarily for the implementation of the turret? Thank you
#34
You need to add the files in engine\game\turrets\ to the torque project file. Then they will be there for you to add.
11/12/2005 (7:44 am)
sdsuEdCenter:You need to add the files in engine\game\turrets\ to the torque project file. Then they will be there for you to add.
#35
11/12/2005 (10:13 am)
does anybody know the answer to my errors right now I have them commented out but that makes it so I can't shoot and thats a problem.
#36
11/16/2005 (9:27 am)
If i had to guess, i'd say you place some of them functions in the same place. Make sure 'Trigger::setOwner is not in the protected part of the class. Make it public.
#37
11/16/2005 (5:39 pm)
i'm jumping up and down and tearing my hair out at the same time I swear I had tried that but it turns out I had moved it from the protedted section into the second protected section genius.I'll round up any changes I made (they could have just been copy paste errors by myself) and post them.
#38
11/16/2005 (5:46 pm)
Yay just got in to see the 3 ai turrets I had spawned owning my bots that were running around aimlessly I was laughing until they turned on me then I had to go make a rocket turret for myself :).
#39
Im trying to get this to work with 1.4
01/08/2006 (9:45 pm)
Master Treb can you send me your corrections ioudas@gmail.comIm trying to get this to work with 1.4
#40
01/09/2006 (4:20 pm)
I'm still actually not quite sure there were any problems needing fixing. the docs can be a bit vague in parts though, try to put it together as is and then if you have any errors I can see what I can do from there. 
Torque 3D Owner Michael Cozzolino
Big Monk Games
Use the above link for this resource if you are using the AI Turret. It solves the problem of the turret missing at some angles while you are above or below the turret level.