My First Hardcore Attempts At Scripting!

The place to discuss scripting and game modifications for X²: The Threat.

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

Lord Dakier
Posts: 3258
Joined: Fri, 8. Dec 06, 13:45
x4

My First Hardcore Attempts At Scripting!

Post by Lord Dakier »

So I always liked the idea behind Medusa. One problem, it was for X3. Thanks mainly to LV for allowing me the permissions to this, I am going to try and bring Medusa to X2 as my first time scripting. I'll be needing the support of my trusty X2 buddies however :D

So we have several files;
Scripts:
al.medusa.events
al.plugin.medusa
plugin.medusa.findships
plugin.medusa.single
setup.medusa
al.medusa.main
plugin.medusa.dummy.medusa
plugin.medusa.missile.array
plugin.medusa.uninstall *Lets hope we don't need to use that one :)*

T-files:
448815

Alrighty then my, what do people suggest the best way of starting this is. I presume there will be several compatability issues to crank out. Especially the hotkeys as I am 99.9% sure they won't work.

Hopefully when I get the hang of this scripting some of those requests could disappear from the request page :P

Lord D.
Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 »

Not envying you. First, you'll have to understand what the x3 scripts are trying to do. Second, you need to understand how to do those things in x2. You probably have already figured this out.

What is medusa?
Hello there!! (Jumping up and down)
Lord Dakier
Posts: 3258
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier »

Oh for god sakes lol.

Medusa is basically a giant missile barrage script. Let's say you have several enemies in M3's and down. By using Medusa it will launch a chosen amount of missiles on all the targets in the radius.

Video Link;
http://www.youtube.com/watch?v=0fb6Phui ... re=channel
User avatar
Shadow dream
Posts: 1840
Joined: Thu, 1. Mar 07, 11:39
x3tc

Post by Shadow dream »

O.O what the? if you wouldn't have to buy the missles I would say it's a cheat :D
looks interesting! But it's very over powered...!! you should think of something ;)

Shadow
Wahre Gentlemen behalten sogar umzingelt von Löwen ihren Leitsatz: Ladies first.
Wann lernt die Gesellschaft endlich, dass Geld erst die Probleme macht, die wir haben?
[ external image ]
Topic - Gallery - Forum - Freiheit
Lord Dakier
Posts: 3258
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier »

Funny enough I'm sure LV described it the same lol.

Should think of what?

Well while we discuss this I'm continuing my custom map. Basically the Khaak have conquered with an Iron fist and all the races have been cornered to the edge of the maps. With trade routes removed all races are lacking something or another. You'll have to push back the Khaak and reopen these trade routes. Once open you may want to find out what the Khaak are hiding in the middle of the Universe. The universe may of been a tad bit deadly before however, by the time I've finished I doubt you will be able to walk your way through now.
User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi »

Well, this is a hard task you've chosen, Lord_Dakier!

Can you give a link to this script? I wasn't able to find it.

Like Jonson27 said, you need to find the script commands that aren't available in X2 and find a way to replace them.
To complicate things, all of these predefined variables like [THIS], [PLAYERSHIP] and so on have to be overriden. [THIS] from a X3 script is not the same as [THIS] from a X2 script. I don't know why, but it's a fact. I already tried to converse a X3 script to X2, but I couldn't because of missing script commands :( .

And AFAIK, arrays are handled differently in X3. You have to rewrite all array stuff for X2.

But this script looks like fun!

Shadow Dream wrote:you should think of something
I think he means: you should think of some balancing to prevent the script from being a sort of cheat script.
--------------------------------

[ external image ]
Lord Dakier
Posts: 3258
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier »

Perhaps the enemy being able to use it as well :P

I dunno, what would you all suggest for balancing this?

The link for medusa is here;
http://forum.egosoft.com/viewtopic.php?t=218502

This is for both Reunion and TC. Some features like hotkeys for example I am certain will not work so obviously things we need to be changed. However the script already appears in my AL Plugin section which was cool. I dont think there are any side effects to having it installed as it did not crash or anything.

Wouldn't it be cool if the hotkey commands from X3 was also converted to X2 :P
User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi »

How did you get X2 to work with this? I can't launch X2 with this script -> CTD, as soon as I start the GE or a new game or load a savefile :?
--------------------------------

[ external image ]
Lord Dakier
Posts: 3258
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier »

I have no idea lol. I just thrown the appropriate files in their place after opening up the SPK format.
Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 »

Chris Gi wrote:Well, this is a hard task you've chosen, Lord_Dakier!

Can you give a link to this script? I wasn't able to find it.

Like Jonson27 said, you need to find the script commands that aren't available in X2 and find a way to replace them.
To complicate things, all of these predefined variables like [THIS], [PLAYERSHIP] and so on have to be overriden. [THIS] from a X3 script is not the same as [THIS] from a X2 script. I don't know why, but it's a fact. I already tried to converse a X3 script to X2, but I couldn't because of missing script commands :( .

And AFAIK, arrays are handled differently in X3. You have to rewrite all array stuff for X2.

But this script looks like fun!
*loosens his neck collar* ... *gulp* ... [THIS] is probably used a lot? All of the array stuff have to be rewritten? Anytime you reference an array element or create one or delete one, and so on?
Lord_Dakier wrote:Funny enough I'm sure LV described it the same lol.

Should think of what?

Well while we discuss this I'm continuing my custom map. Basically the Khaak have conquered with an Iron fist and all the races have been cornered to the edge of the maps. With trade routes removed all races are lacking something or another. You'll have to push back the Khaak and reopen these trade routes. Once open you may want to find out what the Khaak are hiding in the middle of the Universe. The universe may of been a tad bit deadly before however, by the time I've finished I doubt you will be able to walk your way through now.
Seriously, that actually sounds fun. With no jump drive it would be even harder as you'd have to cross paths with the bad guys. So what is your goal with this map?
Hello there!! (Jumping up and down)
Lord Dakier
Posts: 3258
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier »

Are you saying that I should get a printout of the script for example and then rewrite it all while only adding certain things that work for X2? Just incase people did not realise it, I am not sure if this can be fitted to anything lower than a M2 but I would make it so it can only fit an M1 and M2. I've been thinking how Medusa should have its faults. Im considering;
- It attacks all in a certain radius (Including Allies)
- It can only be used with certain missile type which costs loads!
- Enemies can use it
- It has a reuse limit
- Missiles do not specificially target enemies, only explode nearer to them
Are there any suggestions on this?


Basically the Khaak control the universe pretty much, All trade routes have been removed. The Khaak are very protective of the center of the galaxy. Your job is to push through their lines and find out why. Although trillions of lives have been lost finding out what is in that center could secure the campaign of eliminating the Khaak completely. Each of the main races have 3 sectors each. Xenon as deadly as they are control somewhat more but no where near as to what the Khaak own. The universe map has been changed completely and now it looks as if the gate builders wanted all these races to meet together in the center of the universe once the races had controlled of their local space. The Argon and Boron are closer together than they are to other races, as with the Paranid and Split and also the Teladi and Pirates. The Khaak are said to control masses of the Nividium resource and it is believed that they are thriving from this. Each race will have its advantage in one way or another. If you badly annoy a single race dont expect to walk back into their sectors as the entry sector gates are heavily fortified with lasertowers and soon to be sector security.

Lord D.
User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi »

Sounds like fun :) .
All of the array stuff have to be rewritten? Anytime you reference an array element or create one or delete one, and so on?
No, you misunderstood. I don't have any experience in X3 scripts, but it seems the way you build loops over arrays has changed. You just would need to change the loops itself, not the array elements and such.

Anyway, I wanted to test this, thus I rewrote the central script from scratch (plugin.medusa.missile.array). Judging by the video in the original post, the X2 version is not as effective as the X3 versions.
One of the main issues has to do with the position where fired missiles appear. This doesn't change relative to the ship. The "fire rate" has to be set at around 1 sec., depending on the missile velocity and the velocity of the firing ship. And often the missiles don't hit their target because of the speed of the target ship, missiles being shot down and so on. But it's very effective if the enemy is not attending you. I went into a pirate sector and fired this dummy medusa version. The pirate ships were busy hunting freighters and didn't mind my presence. This soon changed: almost every missile hit it's target, convincing the pirates that there's a real thread in their sector. I fired another round, and some smaller ships blew up, some Paranid pirate scum left it's ship, and the few ships surviving this double attack were no thread to my M6 ship.
When the pirate turned to attack me, the script was no longer very effective. Hardly any missile did reach it's target - the traditional way of fighting them did the trick much better.
--------------------------------

[ external image ]
Lord Dakier
Posts: 3258
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier »

How many missiles were launched at a round? I know LV said that the fire rate may need to be changed for X2.

Is it the fact that we need to make the missile target seeking smarter then?
User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi »

This script has a parameter - the amount of missiles can be set.

The fire rate has nothing to do with the amount of missiles. It's about how fast missiles can be fired.

Of course the missile target seeking can be made smarter - it depends on what you want.
--------------------------------

[ external image ]
Lord Dakier
Posts: 3258
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier »

Yeah I know about the parameter. Shame the hotkey won't work.

I did actually mean the fire rate of the missiles :P

So if I'm getting this correctly we have 3 choices;
- Make missiles smarter
- Make it so it fires more missiles
- Increase missile speed

Can't remember exactly but I think the missiles in X2 was smarter and quicker. Probably because the large variety of missile selection.
Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 »

Lord_Dakier wrote:Are you saying that I should get a printout of the script for example and then rewrite it all while only adding certain things that work for X2? Just incase people did not realise it, I am not sure if this can be fitted to anything lower than a M2 but I would make it so it can only fit an M1 and M2. I've been thinking how Medusa should have its faults. Im considering;
- It attacks all in a certain radius (Including Allies)
- It can only be used with certain missile type which costs loads!
- Enemies can use it
- It has a reuse limit
- Missiles do not specificially target enemies, only explode nearer to them
Are there any suggestions on this?


Basically the Khaak control the universe pretty much, All trade routes have been removed. The Khaak are very protective of the center of the galaxy. Your job is to push through their lines and find out why. Although trillions of lives have been lost finding out what is in that center could secure the campaign of eliminating the Khaak completely. Each of the main races have 3 sectors each. Xenon as deadly as they are control somewhat more but no where near as to what the Khaak own. The universe map has been changed completely and now it looks as if the gate builders wanted all these races to meet together in the center of the universe once the races had controlled of their local space. The Argon and Boron are closer together than they are to other races, as with the Paranid and Split and also the Teladi and Pirates. The Khaak are said to control masses of the Nividium resource and it is believed that they are thriving from this. Each race will have its advantage in one way or another. If you badly annoy a single race dont expect to walk back into their sectors as the entry sector gates are heavily fortified with lasertowers and soon to be sector security.

Lord D.
Lasertowers around gates eh? I haven't seen that in vanilla yet. I like how you've given a reward to those who battle the khaak - nvidium + trade routes + <whatever else>. Again, that inspires interest in me compared to the dull, tame activities in vanilla x2. I've mostly been scripting in order to make a public release of pse, but I'm about ready to start playing again...

I'm planning to mine some asteroids in the ore belt and in paranid sectors, build more complexes/loops, and see about maybe capturing more ships in pirate sectors with my eagle squadrons. And, btw, i've never used a jump drive in my game. If the jump drive was more expensive, I might consider using it, but I think it's too cheap and allows you to easily avoid the challenging dynamics present in sectors. For example, you don't have to consider whether you're passing through pirate or enemy sectors. You don't have to consider whether they're patrolled on an active basis or not. You don't have to do any mental calculation about distance - sometimes the shortest distance between one sector and another is actually not the shortest (it depends whether it's an enemy sector or not and whether it's defended). Broadly, if distance was removed from the equation, then we wouldn't need different engine speeds, we wouldn't have to worry about our angle of approach, we wouldn't have to worry about what is between us and our target, and so on. Removing space from the equation removes a lot of strategy and detail, imho. It also removes many chance opportunities between point A and point B. Otherwise, everyting becomes a matter of you picking a target, and to me that's too linear. When I get stuck into a pattern of what I want to do, the game eventually becomes too directed. It's the spontaneous and unexpected that it makes it worht playing for me. Like when I go through sectors to get to point B, I'll see things that I didn't expected - a khaak invasion, a driftint cargo pod, an enemy ship with a nice cargo manifest, etc. So in many ways, I want to ride the wave, I don't want to get too caught up in directing the wave myself. And moreso, I want to see all hte variety in the universe, and that means every little sector in 4 dimensions. So it has to be compensated for, imho, and that's why I feel it should be more expensive or more involved to use. I don't feel it should be this way for everyone, just like I don't feel everyone would want to play on the same kind of map I'd want to play on.

Blah, I full of air lol. Sorry for that long garbled thing.

If I get around to it, I'd like to give your map a try. I'd also like to try that economy/laser modification mod. I'm not interested in medusa though, but it's a good learning experience to port it to x2. Learning to script is a step by step process, and you're going to need a lot of help. Chris GI has helped me a lot on my journey to get it right, but I've spent a lot of my time on my own. You'll need to do that to trully get it. BUT it doesn't help that the script editor is CRAPTASTIC.

GL on finishing your map and porting the medusa script.
Hello there!! (Jumping up and down)
Lord Dakier
Posts: 3258
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier »

Well I have not been home all weekend but will have a crack on it then. Originally I was going to make it a super ship in the middle with no engines but only working lasers and your job is to save it and bring it back for repairs... might still do that actually but making the ship a bit closer. When I get home later on, I shall upload the map to photobucket and place a link here so you can see it. It no longer has that random sector placement feel of most maps but it is set out neater I find.

EDIT - Oh and Chris Gi is like a legend of a scripter. Im glad he is helping me bring Medusa into the game. Even though he has done most the work :P :D
Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 »

How's your work on the map going?

I was going to ask... Is it possible to be a vegetarian on your map? I mean.. depending on non-meat based food for fueling your stations. I think the boron, paranid and teladi are essentially non-meat based.

I'd need access to a crystal factory too. Depending on how your map is organized, I'm afraid that a TL would have to cross through a khaak owned sector.

Been thinking about trying it or giving that random-map generator a shot along with that economy/weapon rebalance mod.
Hello there!! (Jumping up and down)
Lord Dakier
Posts: 3258
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier »

To be honested I aint done much work with it. Untill my internet at home comes back on I cant use Argonopedia to create a working economy.
Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 »

Lord_Dakier wrote:To be honested I aint done much work with it. Untill my internet at home comes back on I cant use Argonopedia to create a working economy.
What is argonopedia?
Hello there!! (Jumping up and down)

Return to “X²: The Threat - Scripts and Modding”