Adding explosions to flak weapons

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

Post Reply
Brokkoli
Posts: 15
Joined: Fri, 11. Oct 13, 21:50

Adding explosions to flak weapons

Post by Brokkoli » Fri, 30. May 14, 17:02

As the titel says, I want to add a damaging explosion to weapons with the "flak"-flag when the projectile explodes. The LIFE mod has explosions, so I know how to create those. I have found the command in the script editor to check for the "flak"-flag on a weapon. Now what I don't know is where and when to create the explosions.
Can I get the lifetime and trajectory of a fired projectile in the script editor? Or does anyone have an idea how to solve the when and where question?

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24950
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Sun, 1. Jun 14, 18:05

You do not create or add explosions with the Script Editor. The Script Editor is a tool to write and edit AI scripts.

To add/change explosion effects you need to edit the respective mod files. This post by Matterom and this one by Syklon hold some information about this.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Brokkoli
Posts: 15
Joined: Fri, 11. Oct 13, 21:50

Post by Brokkoli » Sun, 1. Jun 14, 22:48

Let me rephrase my request: I want to add damage to an existing visual effect. That is what the LIFE mod did with ship explosions, and it did it with a script file. It basically checks which ships are close to the explosion and then applies damage to them based on distance.
I'm am unsure if doing explosion damage in a script file is perfomant enough to use for weapons, but I know of no other way to do it.

I know the basics of modding the TBullets and how effetcs and sounds are done. I had a look at CMOD and copied some of it's graphics and sound into my game. From this I know that the special kickback-effect of the CIG for example is not in the TBullets but in some other file. I have no idea if it is possible to edit this.

I have looked at the links you posted X2-Illuminatus but I have found no helpful information there.

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24950
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Tue, 3. Jun 14, 22:08

I'm am unsure if doing explosion damage in a script file is perfomant enough to use for weapons, but I know of no other way to do it.
It isn't. Whereby the real problem is that you cannot find out, if a ship is hit by a specific weapon type or not. And you also cannot bind a script to a bullet.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Brokkoli
Posts: 15
Joined: Fri, 11. Oct 13, 21:50

Post by Brokkoli » Wed, 4. Jun 14, 00:53

I was afraid of that... it would be such a simple idea to implement if we had access to that part of the code :(

But I think it would be possible to do a not realible, very complicated version with scripting, but just for turrets. Turret scripts like SMART have access to when a turret is firing and at what. Then you can calculate the distance and with the projectile speed estimate when the projectile should hit. Then you check if the target has taken the specific damage of that bullet (not sure if this part would work reliably). If no damage, apply damage to all things in the vicinity of the bullet when its lifetime runs out.

Soooo... it would work in principle for turrets, but it would not be perfomant. And also, distance checks are not a good way to do hit detection. But then again, bounce does some good hitdetection on large objects so it must be possible with scripting...

User avatar
JSDD
Posts: 1378
Joined: Fri, 21. Mar 14, 20:51
x3tc

Post by JSDD » Wed, 4. Jun 14, 09:42

Brokkoli wrote:But I think it would be possible to do a not realible, very complicated version with scripting, but just for turrets. Turret scripts like SMART have access to when a turret is firing and at what. Then you can calculate the distance and with the projectile speed estimate when the projectile should hit. Then you check if the target has taken the specific damage of that bullet (not sure if this part would work reliably). If no damage, apply damage to all things in the vicinity of the bullet when its lifetime runs out.
... do you have a clue how much performance it would cost ??
... assuming there are 20 ships fighting with 2 turrets (in average), the average firerate is about 4 rounds per second, for each shot a calculation of about 5 instructions are needed

=> 20 x 2 x 4 / s x 5 = 800 script-lines / second !!!

ps: ... bullets are not controllable via scripts, that´s hardcoded ... you would have to "simulate" shots / lasers etc. another way

=> 4 short: NOT POSSIBLE !!
To err is human. To really foul things up you need a computer.
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.


Mission Director Beispiele

Post Reply

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