[Tutorial] Creating Custom Turrets

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

User avatar
Killjaeden
Posts: 5023
Joined: Sun, 3. Sep 06, 18:19

[Tutorial] Creating Custom Turrets

Post by Killjaeden » Tue, 29. Sep 09, 10:35

Custom Turret Creation Tutorial
Since this is a somewhat unattended/nonfamous/nondocumentated topic i decided to make a tutorial to share what i've learned about the creation of turrets in X3TC. It's (as almost everything) very similar to X3R so it can also be used to mod for X3R... if someone has the urge to ;)

I recommend to read this guide first.

I won't go into modelling stuff because it's too complicated to explain everything from scratch
so this is a tutorial for 'advanced' Modder.

You need to know:
-how to create a modfile
-how to create a new ship in X3editor (V1 or 2 doesn't matter)
-how to edit a ship-scenefile
-how to use a 3d-editor (3dsmax or gmax) and
that includes modeling,texturing, basic knowledge
-how to export with DBOX

so basically - if you are able to create your own ship in gmax and can make it
usable in TC this won't be very complicated for you.


What do you need:
-Original X3TC (for obvious reasons)
-already set up modding environment
(gmax/3dsmax, Dbox, X2BC, extracted gamefiles, X3editor, X3Modmanager)

What includes this tutorial:
-Basic Design Instruction (limitations)
-Preparing the model for export
-Preparing the turret to be usable
-Troubleshooting (not very advanced yet)


Download as PDF (in zip) (XDatabase, x1tp.com)
alternative download(rapidshare)

Ideas? Questions? Link broken? Please tell me.
Feedback& Suggestions are much appreciated.
Last edited by Killjaeden on Thu, 19. Jul 12, 14:33, edited 6 times in total.

User avatar
ScRaT_GER
Posts: 1958
Joined: Tue, 8. Jan 08, 19:19

Post by ScRaT_GER » Tue, 29. Sep 09, 15:46

Ah, decided to publish it finally?
Nice work - might help our modeller to build new turrets.

Thanks and greetings,
ScRaT

KNT79
Posts: 80
Joined: Thu, 10. Sep 09, 19:14

Post by KNT79 » Wed, 30. Sep 09, 19:19

That's great that you make this tutorial just when I need one :) Thank you!

I think the questions about turrets can be posted here too. I want to make stationary weapons that can fire beam in fixed direction only. I don't need the turret for that, it has to be just a hole in the hull which fires beam.
1. Can I make the turret fixed?
2. I don't need the turret model, can I tell the game to fire from the hole without putting the turret model there or have I to put some very basic model into the hole?
3. Can one make the "restricted" turrets, that cover some constrained angle less then 360 deg hemisphere?
NOT PEACE BUT A SWORD

User avatar
Killjaeden
Posts: 5023
Joined: Sun, 3. Sep 06, 18:19

Post by Killjaeden » Thu, 1. Oct 09, 12:36

Ah, decided to publish it finally?
I published it when it was complete (or at least i think it was).
Was a bit difficult to convince my self to finish this because i hate creating turrets (when there is something wrong it needs several massive trial&error-sessions most of the time :roll:).
The model i showed in the tutorial doesn't work yet (doesn't move) and i can't figure why *grrr*
So you have been warned, turrets suck :P
1. Can I make the turret fixed?
No. Only forwardguns are fixed (they still have the ability to shoot in a very limited angle.
You can make the turret model non-rotating, however the laser fires in that direction wherever the camera points at.
2. I don't need the turret model, can I tell the game to fire from the hole without putting the turret model there or have I to put some very basic model into the hole?
If you want to do that i would recommend to use a invisible_weapon (_dummy) instead...
But apart from that, yeah you can create whatever you want. You don't need a barrel, u can shoot out of nothing if you want :)
3. Can one make the "restricted" turrets, that cover some constrained angle less then 360 deg hemisphere?
The truth is: yes you can limit the angle BUT this leads to broken turrets.
If you move the camera to another angle then the turret the turret can only shoot where both hemispheres match. However this is NOT recommended because it's very messy and leads to some rotation-error under certain circumstances.
Image
XTC Mod Team Veteran. My current work:
Image

mace24de
Posts: 229
Joined: Sun, 15. Jan 06, 13:52

Post by mace24de » Thu, 1. Oct 09, 12:49

Hi,

can someone please reup the tutorial? The rapidshare link reached it's download limit.

Thanks in advance :)

User avatar
Killjaeden
Posts: 5023
Joined: Sun, 3. Sep 06, 18:19

Post by Killjaeden » Thu, 1. Oct 09, 14:12

:evil: ...
i'll upload it again somewhere else when i'm back, thx for the info

€Fixed
Image
XTC Mod Team Veteran. My current work:
Image

KNT79
Posts: 80
Joined: Thu, 10. Sep 09, 19:14

Post by KNT79 » Fri, 2. Oct 09, 12:30

Killjaeden wrote: No. Only forwardguns are fixed (they still have the ability to shoot in a very limited angle.
Thank's for answers.

Now the question is, how it is done technically that main (forward) guns of, say, Cerberus fire in limited angles? What's the difference between those forward turrets and others that fire in the whole hemisphere? How can I install the similar restricted turrets on sides or whereever I whant? Can I change the angle that is covered?
NOT PEACE BUT A SWORD

User avatar
Killjaeden
Posts: 5023
Joined: Sun, 3. Sep 06, 18:19

Post by Killjaeden » Fri, 2. Oct 09, 12:47

I think you got me wrong -
the limited angle is only on the front/mainguns.
Those you can control directly when you fly the ship.
There is no way around that.

If you add a front turret to the ship it has the same 360° then every other turret.
Can I change the angle that is covered?
No, it's all hardcoded.
Image
XTC Mod Team Veteran. My current work:
Image

KNT79
Posts: 80
Joined: Thu, 10. Sep 09, 19:14

Post by KNT79 » Fri, 2. Oct 09, 13:19

OK, I've got it now. As cameras are hardcoded the answer to my questions is mainly no.

EDIT. In fact, the fixed beam weapon cannot be made in "hardware", but can be made through "software" I think :wink: That is, by AI combat script, that fires the weapon only if the target is on the fire line, otherwise turns the ship appropriately.

As you can see, what I am trying to do is the capships combat in old 18 century ships style :) (beam weapons as fixed cannons).
Last edited by KNT79 on Fri, 2. Oct 09, 13:28, edited 1 time in total.
NOT PEACE BUT A SWORD

User avatar
Killjaeden
Posts: 5023
Joined: Sun, 3. Sep 06, 18:19

Post by Killjaeden » Fri, 2. Oct 09, 13:27

right - saddly but as i said in the tutorial - we have to wrap our ideas around that mechanism the game gives us.

There could be another way -
i didn't testet this but you could propably use dumbfire missiles for heavy cannons with no rotation. IIRC the missiles use the rotation of the weapondummy to launch. after that they use their normal behaviour. But if there is no 'cruise missile'-behaviour they fly directly in that path...

However this might only be a solution if the player should use this. AI can't handle this.
Image
XTC Mod Team Veteran. My current work:
Image

KNT79
Posts: 80
Joined: Thu, 10. Sep 09, 19:14

Post by KNT79 » Fri, 2. Oct 09, 13:31

I want the normal behaviour for missiles. Then I want the antimissile beam weapons that can cover some angles. Main beams have to fire in the fixed direction. That was my plan.
NOT PEACE BUT A SWORD

User avatar
Killjaeden
Posts: 5023
Joined: Sun, 3. Sep 06, 18:19

Post by Killjaeden » Fri, 2. Oct 09, 13:54

when mainbeamweapons are at the front you can easily do that by assigning them to the frontcockpit...

You can still have the usual missilebehaviour - but you use a missile instead of a lasergun (like the cannon is build into the ship, not exchangeable, ammunition (=missile)) of course you have to create your own missile for that. I bet you can make a missile that looks almost like a beamweapon.

That this doesn't make things easier is needless to say.
Image
XTC Mod Team Veteran. My current work:
Image

KNT79
Posts: 80
Joined: Thu, 10. Sep 09, 19:14

Post by KNT79 » Fri, 2. Oct 09, 14:01

Fool the engine that way looks like very possible "hardware" solution to the problem. Thank's for the idea.

I have one more question (I am new to X3 universe). Of course I can check this myself, but if you know please tell me the mechanism of missile launching. Are they launched from turrets like lasers?
NOT PEACE BUT A SWORD

J.M.
Posts: 62
Joined: Tue, 26. Aug 08, 23:40

Post by J.M. » Thu, 6. Oct 11, 21:43

in your tutorial it mentions LODs, what are these and are they necessary? also im in the process of making a top mounted turret that faces forward, is it possible for it to rotate 360 degrees horizontally? and can i get away with only two parts such as the base and the turret?
thanks and sorry for so many questions all at once

KrimeMinister
Posts: 17
Joined: Thu, 30. Jun 11, 16:31

Post by KrimeMinister » Thu, 19. Jul 12, 13:12

Hallo!

Ein Super Tut erstmal vorweg gesagt, sehr gut erklährt!
Bis zu einen ingame sichtbaren Geschützturm (für X3) bin ich mit hilfe des tutorials gekommen, nur mit der funktion bzw. dem schiessen hapert es aber noch gewaltig, geschweige denn bewegt sich das Geschütz bei bedienung und rumschauen mit der Maus.

die cockpit-position und die schussbahn werden im XModelViewer angezeigt wie auf den Bild weiter unten zu sehen ist.
An falschen Pfaden, Namen und index angaben dürfte es dann ja nich liegen, da konnte ich auch bei diverse male durchforsten in den dateien und im Editor nicht's ungewöhnliches finden. In der Components.txt und Dummys.txt habe ich die Einträge sorgfältig eingetragen, ggf. eine nummer erhöht und mit UTF-8 überspeichert ect.


Zu meinen Geschützturm: der besteht aus drei teilen: Sockel, Hülle und Kanone wobei die beiden letzt genannten rotieren sollten...den Eintrag in der dummies.txt also auf "scene;2". Von dem Turm soll später ein weiterer an die seite bzw. etwas schräg nach hinten an die Scheibe/des UFO's ran und drei an die unterseite (wovon ich aber noch eine etwas andere Version des Turms mache).

Wie muss die Cockpit-Kamera eigentlich korrekt ausgerichtet werden? Gibt's da einen genauen abstand der eingehalten werden sollte, den dummy weit genug weg vom Schiff und dem Turm selbst oder sowas? Den Kamera Dummy hab ich etwas hinter dem Geschütz geparkt, damit man dieses in der 1st Person Ansicht auch sieht. Ein in die Schiffs-scene hinzufügen einer invisible weapon oder einen normalen Laser ist bei einem beweglichen Geschützturm ja nicht von nöten oder?
Dafür habe ich ja ein kleines Objekt (flacher Zylinder) erstellt, diesen an die Mündung des Kanonen-Teils ausgerichtet, den Privot Punkt an's ende der öffnung geschoben und den Zylinder dann im Schematic Fenster mit der Gun verbunden, vor dem export der components.

Besetzen lässt sich das Ding ja wie gesagt, nur schiessen trotz installiertem Laser kann ich nich!

Hoffe du (oder jemand anderes) hat ein paar gute tipps für mich parrat!
Zur Ansicht hab ich mir mal die Mühe gemacht und ein paar bilder angehängt!




Schiff und Geschütze im XmodelViewer (Kamera diesmal etwas weiter vor)
Image

Der Turm und Rotation
Image

Sockel, Hülle und Kanone mit den Rotationspunkten
ImageImageImage

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”