[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: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

[X3 Script] Lasertower Array [2.0.01 compatible Upgrade]

Post by euclid » Thu, 12. Jan 06, 18: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, 17:33, edited 5 times in total.

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

Post by Skillers » Thu, 12. Jan 06, 18: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: 168
Joined: Thu, 31. Mar 05, 23:45
x3tc

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

looking forward to this

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

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

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

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

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

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

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

Post by djssuk » Thu, 12. Jan 06, 21: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: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Post by euclid » Thu, 12. Jan 06, 22: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: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Thu, 12. Jan 06, 22: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: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Post by euclid » Fri, 13. Jan 06, 00: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: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Fri, 13. Jan 06, 00: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: 332
Joined: Sat, 21. Feb 04, 02:27
x4

Post by RRRoamer » Fri, 13. Jan 06, 02: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: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Post by euclid » Fri, 13. Jan 06, 03: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, 04:02

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

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

Post by BlueSwede » Fri, 13. Jan 06, 05: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: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Post by euclid » Fri, 13. Jan 06, 11: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

Tritous
Posts: 899
Joined: Sat, 15. Jan 05, 17:20
x3tc

hmmmm

Post by Tritous » Sun, 22. Jan 06, 00:21

a few comments (as always from me lol) ...

firstly...hell yeah!!!!! finally a use for lasertowers...

secondly it would be much much much more appropriate to take lasertowers from the ship's cargo, otherwise I think there are ways of getting delivery services and stuff. what I read makes it sound like you just subtract the money and spawn them. perhaps that's the best way of doing it as far as shields are involved, but definately using lasertowers in cargo is the best way.

thirdly...would love to be able to do it remotely using my ships. I should be able to get a demeter superfreighter to jump into a sector and rapidly deploy 4 rings of lasertowers of different radiae then have if jump back to my lasertower complex. a Paranid SF can hold about 150 laswertowers at max, closer to 100 if you have JD fuel and a load of 125MW shield (hint hint).

still, I may get this script anyway, although in its current form it's a type of cheating. sick of losing nemesis' in ianamus zura. the teladi shipyard keeps spawning pirates, and the 3 M6s there are struggling. the three I have holding the xenon in nearby seem to be doing far better lol. damn pirate teladi.
Give a man a fire, he'll stay warm for a day
Set a man on fire, he'll stay warm for the rest of his life ;)

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

Re: hmmmm

Post by euclid » Sun, 22. Jan 06, 13:48

Tritous wrote: ...... it would be much much much more appropriate to take lasertowers from the ship's cargo....
That's possible but would restrict the application of the script. How players would have 30, 60, 90, etc. LT's available? How long would it take to collect/produce them?
..would love to be able to do it remotely using my ships.......
I've chosen the player ship method to make thing not too easy. A remote deployment, athough possible without problem, would have a slight taste of cheating IMO. Provided you have the necessary cash you could overwhelm the X3 universe with LT arrays in a few minutes.
......a Paranid SF can hold about 150 laswertowers at max, closer to 100 if you have JD fuel and a load of 125MW shield (hint hint).....
That's the combination of your first two points. Besides my responses above there is a severe risk that your SF get attacked and destroyed while moving into position - a very expensive loss.
......in its current form it's a type of cheating.....
You pay for them and for the upgrades. You can see it as a kind of delivery, deploy and upgrade service where you have to be present personally (like placing a station). Not really a cheat IMO.


However, fell free to adjust the script to your personal needs. After all it's about fun :grin:


Cheers Euclid

User avatar
Trevelvis
Posts: 1042
Joined: Sun, 4. Apr 04, 15:20
xr

Post by Trevelvis » Sun, 22. Jan 06, 14:16

Is there anyway there can be a bit in the script that allows you to pick up the lasertowers later as I used this script for a Border control mission and it worked great but afterwards it was a real pain manually picking them up also the mission I did it with I only got paided 6.7 million so it wouldnt be fianancally viable to leave them . Thanks

Tritous
Posts: 899
Joined: Sat, 15. Jan 05, 17:20
x3tc

hmmm

Post by Tritous » Sun, 22. Jan 06, 14:17

as for getting hold of them...in my old game I have a megacomplex of 280 stations. it includes 6 lasertower fabs, and currently I get half a dozen every 20 minutes. in total I have about 600 and can't get rid of the things fast enough lol. the fab also produces about 6 125mw shields every 2 hours....among a LOT of other things. surely that's the best way of making a non cheat script since you need to get the towers to deploy. what the script would be doing then would be helping you transport the towers into an organised array. (from a scripting point of view you could say it was destroying 30 laser towers in the cargo then respawning 30 into space)

lasertowers are hard to get unless you make them yourself. if you do, there is no limit to how many and how fast you can make them. ore mines and SPPs are not hard to get for support....the limit is how fast I can get rid of and deploy the things lol
Give a man a fire, he'll stay warm for a day
Set a man on fire, he'll stay warm for the rest of his life ;)

User avatar
Malakie
Posts: 1061
Joined: Tue, 13. Apr 04, 23:08
x4

suggestion

Post by Malakie » Thu, 26. Jan 06, 01:55

Hi,

Is there any way to get this script to work with other ships instead of the ship I am in??

I did not understand that it only created the array around the ship my pilot is flying directly at first... I kept sending one of my ships to a location and telling it to deploy but it did not do anything... or so I thought. Imagine my surprise when I looked outside and saw over 100 laser towers pointed at me suddenly!! Thank god they were on my side! :o This is probably my funniest X3 moment to date).

And thank god for the retrieve deployed item command from another script (I think it is AalaardB's). I had to have one of my largest freighters retrieve all those towers.. imagine if I had to do it manually..

Anyhow, it would cool if there were some way to tell a different ship to do this so I could continue doing other things...

Malakie

Post Reply

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