X2 sector take over script!

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

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

blazer1121
Posts: 501
Joined: Tue, 26. Sep 06, 07:12

X2 sector take over script!

Post by blazer1121 »

I've managed to create a script that allows you to take control of a sector. At the moment you still have to run it in the script editor, but im hopeing to change that. Im in the process of tweaking it so that you need sertain stations in the sector to take control, trading dock, equipment dock etc etc. if anyone wants to test it tell me and ill see if i can put it on my site for download. Any suggestions hints help would be great :D
Pogi
Posts: 522
Joined: Thu, 13. Apr 06, 12:35
x2

Post by Pogi »

Go ahead and post it..I'll give it a shot. I like building in the Unknown Sector NW of G-Fune and would love to "call it my own" :)
blazer1121
Posts: 501
Joined: Tue, 26. Sep 06, 07:12

Post by blazer1121 »

I was just perfecting it the other day, and now it requires that you select a station in the sector that you want to take control of, you must select your own trading dock or equpiment dock in that sector. And to change the name of the sector, ill have to give you specific instructions on what to change in the script to change the name to your own, or youll end up with a bunch of "New beginings" lol ;)

If there is a way to make this script run automatically so that when you have the necessary stations built the sector automatically changes to your own, id be much obliged if someone could tell me, or if you can tie it into the ship command console under "special"

Ill see what i can do about getting it up
Legion400
Posts: 1380
Joined: Mon, 11. Oct 04, 22:47
x2

Post by Legion400 »

i was about to ask in here if someone could do a X2 version of the X3 Sector Takeover and looks like your my man :D

i will happily test it for you if you want

if this works soon the Argon will officially be wiped out in my non-plot game :fg: :skull:
My Roid Table: Special Thx to Greyhawk for hosting
http://gr3yh4wk.50megs.com/Files/Table% ... 20v1.2.rar
blazer1121
Posts: 501
Joined: Tue, 26. Sep 06, 07:12

Post by blazer1121 »

I have good news and bad news.

Good news first, I have managed to completely overhael the script so that now you can have any sort of trading dock or equipment dock, built to take control of a sector.

Bad news, the computer I was working on has been carted away for repairs.

Good news again, My personal computer will be back sometime this week with a new geforce 6600 FX in it, and I managed to save the script and i will be ablr to put it on my computer. :)

If anyone knows how I can tie, naming the sector and choosing the stations in the sector that you will use to take control of the sector, into the command console. I would be much obliged. At the mo you need to actually run it in script editor, and have to modify the script to choose the name you want for the sector.
Legion400
Posts: 1380
Joined: Mon, 11. Oct 04, 22:47
x2

Post by Legion400 »

oo goody, this will be fun.

So when you take over a sector, when you browse at it on the galaxy map, does it actually say race - playername?

I kno X2 is different to x3 but do u think u would be able to have the race that used to own the system try to take it back?
My Roid Table: Special Thx to Greyhawk for hosting
http://gr3yh4wk.50megs.com/Files/Table% ... 20v1.2.rar
User avatar
nirwin
Posts: 2879
Joined: Tue, 1. Nov 05, 23:07
x3tc

Post by nirwin »

Hello blazer 1121,

I'm glad to see someone taking this on for X2, because I still have to get round to playing X2 at some point, and sector takeover would be good.

I know there are some differences in scripting between X2 and X3, but quite a lot is the same, so feel free to look at our X3 version, and use whatever you can/want to/need to.

My methodology, is essentially to register a script that runs every second or so, and in that script:

Code: Select all

If the sector the player in does not belong to the player
 capturePossible = true
 capture = false
 Get a list of stations from the players current sector
 For( each station )
 {
  If current station belongs to current sector owner
   capturePossible = false
  if station belongs to player & is a trading stations & doesn't have a pre-defined special character at the beginning (like a *)
   capture = true
 }
 if capturePossible = true
  if capture = true
   Set sector ownership to player
Obviously you can use the special character of your choice, maybe make the special character necessary to claim the sector, and it doesn't have to be a trading dock. But anyway that is the methodology we use.

Hope this in some way helps.

---EDIT---
Oh and don't forget to change the owner of all the gates in the sector too.
Nirwin
------
Sector Takeover | Unlimited Resources (x2/x3)
blazer1121
Posts: 501
Joined: Tue, 26. Sep 06, 07:12

Post by blazer1121 »

Yes, good on ya. Thats exactly what i needed. I when i tested it on the weekend guess what happened. Nothing :D well, not for a while anyway.
I ran the script, and it took a fair while for it to actually run, I now have control of the sector but, heh, its no good if it takes so long to run, and it doesnt run atomatically. But thanks to you i now have the take over script for X3, I should be able to converte that......
some of it.
TRIERARCH
Posts: 39
Joined: Thu, 5. Oct 06, 10:32

Post by TRIERARCH »

blazer1121 wrote:Yes, good on ya. Thats exactly what i needed. I when i tested it on the weekend guess what happened. Nothing :D well, not for a while anyway.
I ran the script, and it took a fair while for it to actually run, I now have control of the sector but, heh, its no good if it takes so long to run, and it doesnt run atomatically. But thanks to you i now have the take over script for X3, I should be able to converte that......
some of it.
So are you saying this script works but it takes too long?
User avatar
nirwin
Posts: 2879
Joined: Tue, 1. Nov 05, 23:07
x3tc

Post by nirwin »

blazer1121 wrote:Yes, good on ya. Thats exactly what i needed. I when i tested it on the weekend guess what happened. Nothing :D well, not for a while anyway.
I ran the script, and it took a fair while for it to actually run, I now have control of the sector but, heh, its no good if it takes so long to run, and it doesnt run atomatically. But thanks to you i now have the take over script for X3, I should be able to converte that......
some of it.
Not sure if it's the same for X2, maybe an X2 modder can tell you, but the al.plugin.sectorTakeover file in the X3 sector takeover script is the one that registers a process with the AL engine, and it is set to run every second or something like that.
However I thought the AL engine wasn't in X2 (but then I'm sure I learnt how to do this from the X2 MSCI handbook).

It really shouldn't take the processor long to investigate every station in the sector you are in, should be able to do that in like 1/100 of a second.

The problem with the X3 sector takeover script, is that the check for capturing sectors is mixed up with a whole load of other logic, I'd say register different tasks seperately, i.e one script that checks for sector claiming, one script that deals with raiding parties, one script that deals with tax (if you want tax) etc. And have them all running as seperate processes. Don't overcomplicate your script like ours.
Nirwin
------
Sector Takeover | Unlimited Resources (x2/x3)
Legion400
Posts: 1380
Joined: Mon, 11. Oct 04, 22:47
x2

Post by Legion400 »

There would be no need for tax as there isnt a 'GOD' that build stations.

However what about the trading station/dockyard/shipyard,equp dock in the sector you destroy? as they respawn dont they so would this script stop them from spawning

and with raiding parties, evan if they retook the sector as i said there is no god to replace stations so it would be an empty sector.


Another thing if you was to say take over all of the main argon systems (in the original 'box') wouldnt you have to rebuild the stations as you would immediatly cause an economy crisis as the entire area would shut down from lack of argon products.
My Roid Table: Special Thx to Greyhawk for hosting
http://gr3yh4wk.50megs.com/Files/Table% ... 20v1.2.rar
blazer1121
Posts: 501
Joined: Tue, 26. Sep 06, 07:12

Post by blazer1121 »

Yeah, thats exactly the problem.
It takes to long to run it. It can take any amount of time.
I can't work on it though coose both computers are stuffed. :( :cry:
I think I can set the priority and set it to run every few secs. Because at the mo, all you have to have is a trading station or equipment dock, of any type in the sector.
User avatar
nirwin
Posts: 2879
Joined: Tue, 1. Nov 05, 23:07
x3tc

Post by nirwin »

Legion400 wrote:There would be no need for tax as there isnt a 'GOD' that build stations.

However what about the trading station/dockyard/shipyard,equp dock in the sector you destroy? as they respawn dont they so would this script stop them from spawning

and with raiding parties, evan if they retook the sector as i said there is no god to replace stations so it would be an empty sector.


Another thing if you was to say take over all of the main argon systems (in the original 'box') wouldnt you have to rebuild the stations as you would immediatly cause an economy crisis as the entire area would shut down from lack of argon products.
See these are the issues that make me not want to do a sector takeover script for X2, some of these issues I am facing in X3 though, like GOD won't build stations in player owned sectors. Yeah and tax is a stupid idea, don't do it, it just causes complaints, then again the lack of ability to profit from owning sectors causes complaints.... blazer, just be ready for complaints, for the word tax has now been mentioned in your thread. :D

And yes you would have to rebuild the economy as you go, and you would cause a crisis, but then isn't that exactly how wars work?

Anyway this is blazers headache, good luck pal, and if you need any help/advice on any specifics, just hit that PM button. :x2:
Nirwin
------
Sector Takeover | Unlimited Resources (x2/x3)
Legion400
Posts: 1380
Joined: Mon, 11. Oct 04, 22:47
x2

Post by Legion400 »

Also because the area would shut down from lack of argon produce u wouldnt be able to start it up again as you would be at war with the argon and so wouldnt be able to build your own argon facs :roll:

oo the challenges
My Roid Table: Special Thx to Greyhawk for hosting
http://gr3yh4wk.50megs.com/Files/Table% ... 20v1.2.rar
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22403
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

nirwin wrote:Not sure if it's the same for X2, maybe an X2 modder can tell you, but the al.plugin.sectorTakeover file in the X3 sector takeover script is the one that registers a process with the AL engine, and it is set to run every second or something like that.
However I thought the AL engine wasn't in X2 (but then I'm sure I learnt how to do this from the X2 MSCI handbook).
The AL Engine was something that was added to 1.4 of X2 and its what was used to add the extra life to the universe like the sector patrols, that didn't exist previously. All this stuff was replaced by the Jobs engine in X3 and now the AL Engine is only used for scripts.

u can look at my guild to makeing an AL Plugin, it should be pretty much the same in X2.

in fact the al scripts used in my bounty hunters guild were X2 scripts originally
Legion400
Posts: 1380
Joined: Mon, 11. Oct 04, 22:47
x2

Post by Legion400 »

Well what we can do (hopefully) is:

One script checks sector for argon,boron,teladi etc stations if none are found check for player owned trading station, if yes sector becomes owned by player. If there are race stations player cannot own sector.

Another script stops the respawning of race important stations while sector is owned by player.

Another script brands each sector a different importance rating from 0-10.

Reason being is if you take the sector from a race it will want it back, now depnding on how important that sector is will determine how often and how powerful a race retake attack will be.

Unknown sectors would be 0 because no one owns them so no one will want them back so now fleets will be sent to retake it.
Xenon 472 on the otherhand would be a 10 and so you would expect massive fleets to try and retake the sector, if this is possible it would prove very intresting trying to hold 472 ;)

And another script then spawns an attack fleet of strength to importance and sends it off to try and destroy the player owned trading station.


Perhaps you dont need that many scripts to do this but thats basicly what we want isnt it for the takeover script?

Taxes and other things in the x3 version will ahve to be missed because theres no such thing as god so apart from the important stations nothing else respawns :(
My Roid Table: Special Thx to Greyhawk for hosting
http://gr3yh4wk.50megs.com/Files/Table% ... 20v1.2.rar
blazer1121
Posts: 501
Joined: Tue, 26. Sep 06, 07:12

Post by blazer1121 »

Ah at last the civilised world has returned to me, with my computer and internet! :)

Great news! The script is working like a charm. You can capture a sector by having a trading dock in the system, then running the script. If anyne knows how to tie it in with your command console that'd be great.
When I find somewhere I can put my script up for download ill start working on having extra components. Change sector name, have to have no enemy buildings in sector, etc :)

Only thing is, the sector info stays the same eg population stays at 123937.... huh? I just killed everyone!
name is still the same, but im working on that
and I gues you caan't change the sun levels unless you blown up the suns :D
Legion400
Posts: 1380
Joined: Mon, 11. Oct 04, 22:47
x2

Post by Legion400 »

ooo goody! :D

i thought the population was for the planet in the system lol, and u cant orbitally bombard planets soo..

suns nah thats a paramater we should leave alone


i suppose for the name u cld ask sumone to search for the code in x3 and see if it can be 'duplicated' for X2, because Avarice chnages its name doesnt it.
My Roid Table: Special Thx to Greyhawk for hosting
http://gr3yh4wk.50megs.com/Files/Table% ... 20v1.2.rar
Lord Dakier
Posts: 3258
Joined: Fri, 8. Dec 06, 13:45
x4

Post by Lord Dakier »

so like have you guys found a place to put this mod cause i wana i just wanna use in need badly for summat like that
blazer1121
Posts: 501
Joined: Tue, 26. Sep 06, 07:12

Post by blazer1121 »

I won't be releasing for a while because

1. I dont have anywhere to host it (anyone got ideas)

2. Im learning the code that is used to write the x2 scripts. So ill be able to do some more advanced stuff soon, which i wasnt able to include in the original script.

just bear with me for a while.

I cant give it too anyone though if its not hosted anywhere

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