[Discussion] Generic X3TC S&M questions II

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

All missile models include huge collision boxes.
I suppose that was necessary with the painfully inept vanilla missile defense scripts... once upon a time.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Skinmeister
Posts: 122
Joined: Tue, 26. Sep 06, 01:15

Post by Skinmeister »

Last edited by Skinmeister on Sun, 13. Feb 11, 18:53, edited 2 times in total.
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

It will not default. It will have no language file.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Skinmeister
Posts: 122
Joined: Tue, 26. Sep 06, 01:15

Post by Skinmeister »

Last edited by Skinmeister on Sun, 13. Feb 11, 18:53, edited 2 times in total.
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

You can name your file:
XXXX.xml

dropping the L0yy

I've seen 0002.xml used.
However, in the file is: <language id="44">.
I'm not sure how that affects it.
Chriswarden0
Posts: 1
Joined: Sun, 16. Jan 11, 03:07

Post by Chriswarden0 »

This may seem like a silly question, but how do i change my game to **modified**? I am trying to use the plugin manager but it says i am still vanilla. I have activated Thereshallbewings though so i am confused.... any help would be appreciated
My Boreas went BOOM!!!! Hehehe!
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

In plugin manager:
Settings -> Mode -> Modified
Katorone
Posts: 378
Joined: Thu, 12. Oct 06, 10:49
x3tc

Post by Katorone »

I have a mod in mind, which I think is fairly simple... But I'm not entirely sure it's possible.

I'd run an AL on all player ships in the galaxy, when one of these gets attacked, the player is warned.
However, with a twist... The player can press certain hotkeys to do actions.
EG:
- F9 to view the sectormap of where the attack is
- F10 to jump to said sector (to the gate the closest to the attacker, if it's possible to get a travel direction, perhaps I'd calculate which gate is better with the ship's speed in mind).
- F11 to let the attacked ship try to make an emergency jump to the nearest friendly sector with a friendly base. (or a nearby sector/station if there's not enough energy)

etc

I'm sure the last two can be done with scripts one way or the other. But I'm not sure if scripts can show the sector map. At least when not asking for user input.
Is there someone who could reassure me that it is possible? (And perhaps give me a pointer of what I'd have to do.)

Thanks!
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

I'd run an AL on all player ships in the galaxy, when one of these gets attacked, the player is warned.
For that, signals are the mechanism of choice since they are only emmited when needed and thus do not create performance overhead.
But I'm not sure if scripts can show the sector map. At least when not asking for user input.
You can show the appropriate sector map by using the "get user input: type= sector=$attackSector" command. However, the map that shows up does not have the same functionality as the normal sector map (i.e. you cannot access a ships console, etc.). Unfortunately there is no way to open the "real" sector map via SE.

As you noted yourself, the last two can be done with scripts quite easily.

Greetings,
ScRaT
Katorone
Posts: 378
Joined: Thu, 12. Oct 06, 10:49
x3tc

Post by Katorone »

Thank you for your reply.
ScRaT_GER wrote: You can show the appropriate sector map by using the "get user input: type= sector=$attackSector" command. However, the map that shows up does not have the same functionality as the normal sector map (i.e. you cannot access a ships console, etc.). Unfortunately there is no way to open the "real" sector map via SE.
Bugger! I was afraid of that. :-/ Is it at least a map where you can see the name of the ship? I'm not terribly good at linking icons to actual ship sizes... Specially when there are multiple ships in the same spot. :-/
And without seeing where I'm getting myself in to, there's no point in just jumping in the sector. :-/
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

Try something like this:
$message = sprintf: pageid=$pageid textid=$textid, $var1, $var2, null, null, null
send incoming question $message to player: callback='ScriptName' (more info on questions)
$null = null
$ship = $null -> get user input type={DATATYP_SHIP}, title=Choose Ship, sector=$attackedsector
Open your menus and have it
START $ship -> command <Object Command>: arg1=<Value>, arg2=<Value>, arg3=<Value>, arg4=<Value>

You will be able to select the ship with the attacked sectormap then have it call a menu which you can then have do whatever command you want.
Omini
Posts: 677
Joined: Tue, 8. Dec 09, 17:50
x4

Post by Omini »

I have a mod in mind, and there are some things I would like just clarified as my understanding of modding is very limited.

1) I'm fairly sure I've seen something with regards to a universe editor, so with this in mind I'm simply wanting confirmation. Is it possible to add your own sectors in a pre-determined location by the modder?

2) Audio wise, are you able to add your own audio files for things such as ship names, sector names, and NPC comms?

3) I have in mind to create a sort of plot along with a mod, so are you able to create your own plot-style missions or are you limited to just the pre-existing types of missions (ie. "Deliver X amount of Goods", "Protect Station", "Patrol to Sector X", etc)

4) Another one for confirmation, but can you add additional gates and link said gates? Also making it possible for the new gates to be reconised by the HUB?

5) Are new ship models restricted in any way? Such as turret counts (I'm fairly sure they are - how many turrets are ships limited to?), poly counts, etc?

6) Can you add and use your own textures?

7) Can you add your own weapons with their own custom effects/images?

(I'm fairly sure I had more questions, but I can't remember them now.)
amtct wrote:Don't quote this
I should be a journalist.


Tutorial On Selecting Single Mod Package
Katorone
Posts: 378
Joined: Thu, 12. Oct 06, 10:49
x3tc

Post by Katorone »

h2o.AvA wrote:Try something like this:
$message = sprintf: pageid=$pageid textid=$textid, $var1, $var2, null, null, null
send incoming question $message to player: callback='ScriptName' (more info on questions)
$null = null
$ship = $null -> get user input type={DATATYP_SHIP}, title=Choose Ship, sector=$attackedsector
Open your menus and have it
START $ship -> command <Object Command>: arg1=<Value>, arg2=<Value>, arg3=<Value>, arg4=<Value>

You will be able to select the ship with the attacked sectormap then have it call a menu which you can then have do whatever command you want.
Wauw, thanks! *saves the snippet*
Katorone
Posts: 378
Joined: Thu, 12. Oct 06, 10:49
x3tc

Post by Katorone »

Omini wrote: 1) I'm fairly sure I've seen something with regards to a universe editor, so with this in mind I'm simply wanting confirmation. Is it possible to add your own sectors in a pre-determined location by the modder?
Yes.
Omini wrote: 2) Audio wise, are you able to add your own audio files for things such as ship names, sector names, and NPC comms?
Yes.
Omini wrote: 3) I have in mind to create a sort of plot along with a mod, so are you able to create your own plot-style missions or are you limited to just the pre-existing types of missions (ie. "Deliver X amount of Goods", "Protect Station", "Patrol to Sector X", etc)
Yes.
No.
Omini wrote: 4) Another one for confirmation, but can you add additional gates and link said gates? Also making it possible for the new gates to be reconised by the HUB?
Yes.
Omini wrote: 5) Are new ship models restricted in any way? Such as turret counts (I'm fairly sure they are - how many turrets are ships limited to?), poly counts, etc?
There are restrictions, but I don't know them. Turrets are defenitly limited. I _think_ 6 turrets and 48 guns. But I'm not sure.
Omini wrote: 6) Can you add and use your own textures?
Yes.
Omini wrote: 7) Can you add your own weapons with their own custom effects/images?
Yes.

There are mods which have done this. Have a look at XTC (Xtended: Terran Conflict).
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

What are some different ways for a ship to continuously check for a condition, run some code when the condition is met, then continue checking for it?

This lovely bit of code:

Code: Select all

while [this]->exists
while !$condition
= wait 1000 ms
$condition = [this]->get condition
end
gosub code
end
Any others?
Last edited by h2o.Ava on Wed, 26. Jan 11, 09:34, edited 1 time in total.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

You could try an AL plugin script
These run globally and fire every x seconds. (note, x seconds, not mili-second)

The MSCI handbook has a good tutorial on it



Also [this]-> exists, doesn't achieve too much. When someone gets de-existed, all scripts terminate on it.
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

Code: Select all

while [this]->exists
This is a nonsense instruction because the script will go poof when THIS is destroyed.
It is identical to "while [TRUE]", which you should use for ease of reading.


A simpler construction (fewer nested loops to keep track off for one) would be...

Code: Select all

while $Object ->get condition
= wait 1000 ms
skip if $Object->exists
break
gosub code
end
ALP are quite a bit harder to wrap your head around and don't really do anything other than this.
Their benefit is a handy on/off switch which is a neat thing to have in a global script.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

It needs to run on multiple ships so ALP is out.

I was hoping for a less brute force method.

Thx for the tips. :)
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

You can properly use the MD to check for conditions but that makes no real difference.
Every MD check has to be calculated the exact same way and if the SC has to check Condition A every 1000ms it's no better or worse than the MD checking Condition A every 1000ms.
It's no magic wand to check conditions "for free", only a different wording that looks more elegant in some cases.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

what happens to a task on a ship when the ship becomes [playership]?

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