[X3 Script] Lasertower Array [2.0.01 compatible Upgrade]

The place to discuss scripting and game modifications for X³: Reunion.

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

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 11521
Joined: Sun, 15. Feb 04, 21:12
x4

[X3 Script] Lasertower Array [2.0.01 compatible Upgrade]

Post by euclid » Thu, 12. Jan 06, 19:13

Lasertower Array (download)
=====================

New Version - 2.0.01 compatible !!!

New features:

#1 Lasertowers now come automatically with 125 MJ shields: As part of the 2.0.01 Update all purchased or produced Lasertowers have 125 MJ shields. There is no need anymore to upgrade the shields from 25 MJ to 125 MJ.

#2 Remote placement: You do not need to be in the same sector anymore. The position of the Lasertowerarray is no longer determined by the player's ship. Instead just select a sector and within a position using numpad 2,4,6,8.

#3 Names for yout LT's are generated: As an additional user input a 'name' is requirered. All 30 Lasertowers are then named as 'name'0 to 'name'29.




Installation:

Copy the setup.lasertowerarray.xml and the lasertowerarray.xml into the 'scripts' folder of your 'X3' folder, and copy the 447003.xml into the 't' folder.



Usage:

You'll find a new ship special command. Click that then select sector/position, radius in metres of the circle of lasertowers (3000 is a good value, don't make it too small), select the orientation (0 for xy plane, 1 for yz plane and 2 for xz plane) and finally choose a name (for example 'Laser Southgate' will name your LT's 'Laser Southgate0' to 'Laser Southgate29').



Enjoy !


Cheers Euclid
Last edited by euclid on Fri, 10. Nov 06, 18:33, edited 5 times in total.

Skillers
Posts: 539
Joined: Sun, 24. Apr 05, 16:12
x3tc

Post by Skillers » Thu, 12. Jan 06, 19:20

Cool. Would be really good if you could select an object as the centre of the ring, like a station, though I guess you can get roung that by moving really close to the station then running it (just don't crash).

I can't wait to be able to afford building a tunnel out of an important gate...
"Warning, cargo bay now contains; Gate, Home of Light"

User avatar
bengoin
Posts: 161
Joined: Thu, 31. Mar 05, 23:45
x3tc

Post by bengoin » Thu, 12. Jan 06, 21:51

looking forward to this

bendyspex
Posts: 708
Joined: Tue, 13. Apr 04, 10:39
x3

Post by bendyspex » Thu, 12. Jan 06, 22:15

Sounds great, this will help a lot in protecting my stations and gates. Thanks

User avatar
bengoin
Posts: 161
Joined: Thu, 31. Mar 05, 23:45
x3tc

Post by bengoin » Thu, 12. Jan 06, 22:41

what would be a good number to add the the radius?

djssuk
Posts: 183
Joined: Thu, 11. Dec 03, 22:43
x3tc

Post by djssuk » Thu, 12. Jan 06, 22:59

Sounds great.

How about the player specifying the X number of lazer towers and then a point on the map, the radius then calculates X distance bewteewn each one? Just some ideas.

By the way, the link seems to fail at the moment. I will try later.

Thanks

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 11521
Joined: Sun, 15. Feb 04, 21:12
x4

Post by euclid » Thu, 12. Jan 06, 23:33

djssuk wrote: ......How about the player specifying the X number of lazer towers and then a point on the map, the radius then calculates X distance bewteewn each one? ..
Yes, initially I had a similar idea. I've spent the last night (5 bloody hours !!) to get a general placement script working.

But the trouble is that the script editor allows only integers between -999,999,999 and 1,410,065,407. You can imagine that basic maths like trigonometric functions, powers, roots etc. are next to impossible.

I've managed to get this working in the early morning hours but there was a big problem: the script puts a heavy load on the program (lag, freeze even ctd) and inserting wait states to fix that made the script to run too long. So I've decided to dump it.

The above script is fast and light - a good compromise IMO.
By the way, the link seems to fail at the moment. I will try later.
Yes, the upload has not yet arrived. Can't be long but if you want it right now then PM me your email and I'll send you the zip.

Cheers Euclid

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20600
Joined: Mon, 15. Nov 04, 00:26
x4

Post by Cycrow » Thu, 12. Jan 06, 23:40

euclid wrote:
djssuk wrote: ......How about the player specifying the X number of lazer towers and then a point on the map, the radius then calculates X distance bewteewn each one? ..
Yes, initially I had a similar idea. I've spent the last night (5 bloody hours !!) to get a general placement script working.

But the trouble is that the script editor allows only integers between -999,999,999 and 1,410,065,407. You can imagine that basic maths like trigonometric functions, powers, roots etc. are next to impossible.

I've managed to get this working in the early morning hours but there was a big problem: the script puts a heavy load on the program (lag, freeze even ctd) and inserting wait states to fix that made the script to run too long. So I've decided to dump it.

The above script is fast and light - a good compromise IMO.
By the way, the link seems to fail at the moment. I will try later.
Yes, the upload has not yet arrived. Can't be long but if you want it right now then PM me your email and I'll send you the zip.

Cheers Euclid
there are actually libriaries available to to do fixed point maths, theres the old X2 math library by reven, and AalaarDB has dont one for X3, there are also trigenomitry commands in the script engine, but it uses fixed point maths rather than floating points

as for the waits, e ven a wait of 1ms can help, as it adds an interupt point so other scripts can be run without blocking the game causing the freezeing

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 11521
Joined: Sun, 15. Feb 04, 21:12
x4

Post by euclid » Fri, 13. Jan 06, 01:37

Cycrow wrote: ...there are actually libriaries available to to do fixed point maths, theres the old X2 math library by reven, and AalaarDB has dont one for X3, there are also trigenomitry commands in the script engine, but it uses fixed point maths rather than floating points

as for the waits, e ven a wait of 1ms can help, as it adds an interupt point so other scripts can be run without blocking the game causing the freezeing
Thanks for the info, Cycrow. Didn't know that 1ms can make that much of a difference. Will try that in my Fear-the-Sphere script (places LT's pseudo-uniformly on a sphere) which takes too much time to execute.

I know reven's libs and have downloaded AalaarDB's 3d-math lib. Also I have played with the built-in sine/cosine funtions but all this did not help very much. Guess it was my fault - first go in that direction :oops:

One big problem I have is the limited number rep (which makes, for example, a power series approximation very difficult). You not just have to check the upper rep limit but also the lower rep limit and that is time consuming.

A particular problem is to determine the plane perpendicular to a given direction. I've tried the buit-in trigs and then the 3d math lib functions. All results were to imprecise.

I'm working on a general solution for that.



BTW: the download link in my first post is now up and running . Big thanks again to ESD for hosting !


Cheers Euclid

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20600
Joined: Mon, 15. Nov 04, 00:26
x4

Post by Cycrow » Fri, 13. Jan 06, 01:44

yeah scripts work the same way as multithreading does
they appear to run simultaneous, but in actual fact, only 1 thread is being process at any given time.

so when u have a script running, no other scripts will get processed until that script has finished, and if it takes long to finish the game cant be updated which gives you the temporary freezing, to solve this, you have interrupts, which will alow the game engine to carry on updating without blocking, so when the script reaches an interupt, more of the game gets process then it returns back this scripts and continues

so even a short wait will allow other scripts and the game engine to inturupt when it needs to process something else, which prevents the freezing.

RRRoamer
Posts: 330
Joined: Sat, 21. Feb 04, 03:27
x4

Post by RRRoamer » Fri, 13. Jan 06, 03:30

Actually, to be more specific, scripts run the same way a coopertive multitasking does.
--RRRoamer

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 11521
Joined: Sun, 15. Feb 04, 21:12
x4

Post by euclid » Fri, 13. Jan 06, 04:43

In this case, wouldn't it be wise to use random waits rather than fixed values?

I think wait randomly between .... ms and ..... ms would reduce the probability to have no time gap at all.

This could happen if a large number of scripts are running using fixed wait states. Could explain some lag/freezing/ctd problems.

Cheers Euclid

ericbab
Posts: 68
Joined: Wed, 6. Jul 05, 16:19
x3

Post by ericbab » Fri, 13. Jan 06, 05:02

May, i Just State that you guys are GOds Among men, using the math leant yesterday, ToDAY!

BlueSwede
Posts: 243
Joined: Sat, 7. May 05, 19:05
x3tc

Post by BlueSwede » Fri, 13. Jan 06, 06:32

Exactly how does I check I have any scripts that use "command_special_23 with tid 523"?

I checked that I didn't have any text file 447003 in my t folder

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 11521
Joined: Sun, 15. Feb 04, 21:12
x4

Post by euclid » Fri, 13. Jan 06, 12:16

BlueSwede wrote:Exactly how does I check I have any scripts that use "command_special_23 with tid 523"?

I checked that I didn't have any text file 447003 in my t folder
Due to the list in the sticky these values are not yet been taken. So if you do not run any other (than in the com. script sticky) scripts then this should be fine.

Cheers Euclid

Post Reply

Return to “X³: Reunion - Scripts and Modding”