[Discussion] Generic X3TC S&M questions I

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

Jon Tash
Posts: 6
Joined: Thu, 6. Mar 08, 17:48

Post by Jon Tash »

Hello

Is it possible to make a script to rename sectors?
It would be cool to have that sort of script with the Improved Races script.

JT
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

@ Jon Tash
No. At best, a script can load text files, which have the sector names in them, but it can not create the text files nor directly change them.
Jon Tash
Posts: 6
Joined: Thu, 6. Mar 08, 17:48

Post by Jon Tash »

No. At best, a script can load text files, which have the sector names in them, but it can not create the text files nor directly change them.
Ok, thanks
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

The mission director can directly rename sectors AFAIK.
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.
Feuerriese
Posts: 204
Joined: Thu, 28. Sep 06, 12:25
x4

Post by Feuerriese »

Ketraar's useful MUS can show you how to do that. The command you should use is <set_sector_override> :)
xWolfzx
Posts: 181
Joined: Fri, 14. Aug 09, 07:46
x4

Post by xWolfzx »

Hi,

I'm curious about this command '->add default items to ship' how does the command decide which items are default items and is there a way for me to change the default items? Eg: I want a Tiger to come equipped with PALC whenever it is spawned or when i created it via cheats.
Goldfinch
Posts: 876
Joined: Wed, 18. Feb 04, 19:12
x3tc

Post by Goldfinch »

I may be jumping in at the deep end here, but I want to get into scripting for TC and I always learn best if I have a goal I can aim for, something specific to learn how to do. That said, would it be possible to make player-useable jump beacons? At this point I just want to know if it's feasible, rather than how to do it.
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

Yes.
You just couldn't select them with the hardcoded jump shortcut because obviously they are no jumpgates.
You'll need to find a way to select those beacons without much hassle. The rest isn't terribly hard.

My Autojump script lets the player jump to... places... and you could use a similiar approach for your beacons.
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.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Q: What is the best way to create a ship (Here my out, I've become a bit noobish at ship creation)

What I want to do is create several types of ships, with no scenes or bodies, that are just "place holders" in space, with different ranges of health (e.g. 1000hp, 10 000 hp, 100 000 hp) (yes I realise that bodiless objects can not be hit -by lasers)

What is the best way to make them such that they are compatibility and easily added and all that other good stuff? I plan to use the objects in scripts later, so I'll need a way to search for the objects in the list (and efficiency is important)



Initially I did consider the Plugin managers ship creator, but I was hearing that it had TC issues a while back, and when I tried using it, it would complain that I needed scenes/bodies (In short, it doesn't like empty ships, and it keeps asking me to locate x3!)
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

The Complex Cleaner does just that. It locates "it's" objects automatically by comparing the object names to the TFile entries.
That way these objects can be appended to any TFactories without fuss.
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.
pelador
Posts: 1399
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by pelador »

Goldfinch wrote:I may be jumping in at the deep end here, but I want to get into scripting for TC and I always learn best if I have a goal I can aim for, something specific to learn how to do. That said, would it be possible to make player-useable jump beacons? At this point I just want to know if it's feasible, rather than how to do it.
Yep DAD has drones that deploy them for use aswell as many other features.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Q: Which ship types indexes are used for hard-coded stuff?
(e.g. Astronought is at 267, ->273 other misc special objects, 294 freight drone, 319-321 new mines, 220 keris, 31 fighter drone mk2)

290 2nd laser tower?
368 terran laser tower?

Context: Mod total conversion, working from a blank t-ships file, trying to figure out which ones should be reserved.



Q2: Am I correct in assuming that: in X3TC that these special objects are still referenced by their subtype == index in the ships file?
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

s9ilent wrote:Q2: Am I correct in assuming that: in X3TC that these special objects are still referenced by their subtype == index in the ships file?

Q: Which ship types indexes are used for hard-coded stuff?
Yes.

All fighter/freight drones, lasertowers, mines, satellites.
Hands off those ships and the tech wares associated with them.

Ammo is not special. It's merely whatever ware index the laser is told to gobble up.
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.
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

Oh, hi dudes!

I once wrote this in a tutorial:
Litcube wrote:Here's another tip:

Code:
set ship command preload script: command= BE_AWESOME script= Menu.BeAwesome

Code:
global script map: set: key= BE_AWESOME, class=Ship, race=Player, script=Cmd.BeAwesome, prio=0


The preload command is very useful for those command scripts where you want to initiate a menu before launching the action.

Whenever the COMMAND is called, the script specified using the PRELOAD code line will launch *prior* to launching the regular global map key. What's unique about this, is that you can use the pre-loaded script to return arguments to the regularly scheduled script so that there's a seamless interface between menu and script command. Use this command at the end of your preload script (Menu.BeAwesome) to set the variables of the command script:

Code:
$BeAwesomeMenuItems = create new array, arguments=menu choices1, 2, 3, etc.


Code:
return $BeAwesomeMenuItems


At this point, your Cmd.BeAwesome script (notice the difference in names and how they're mapped above), will launch, using the data that was returned from the Preload script as its arguments effectively "skipping" the user argument input stage in the CMD script.

Just another way to keep things clean and tidy, and to seperate the Data from the Logic, like most good programmers should.

When I wrote that, I hadn't yet ran into this problem:

When a selection in your menu is supposed to be either TRUE or FALSE, and the result happens to be FALSE, the command recieving the argument array thinks you didn't supply anything and asks you the question again, thus defeating the purpose of the menu in the first place.

Has anyone else ran into this? Know something I've done wrong?
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

A preload command, only fires the actual command when it returns 'something'. i.e. not null, not 0, and not false.
Setup your scripts to accept arguments like 1/2, instead of true/false if you want the command to be run, and you want to use some indicator argument (or an array of size 1 with a boolean in it, or some other non true/false solution)
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

Well, I figured it out.

False is equal to null, which the args don't accept.

So just do a check for anything FALSE and set it to 0 before you set the arg array. Args accept 0 just fine.


:)
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Q: What actually happens to missiles in OOS?

As from as far back as I remember, I just know that ships don't use missiles OOS. But I'm trying to build a combat script atm, and I'm noticing that the scripts have sections to catch incoming missiles, whilst OOS.

So is it that missiles still exist OOS but can only be fired IS?
Can missiles exist OOS but just aren't fired?
Or...?
jlehtone
Posts: 22477
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone »

s9ilent wrote:As from as far back as I remember, I just know that ships don't use missiles OOS.
Ships can and do use missiles OOS. But such missiles do not exist as objects, which could be targeted.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

:o (The end is nigh!!)H rm... interesting revelation.. My next question is:
Then how do missiles work in OOS? (damage wise and script reference wise)
And in what way do you mean they can not be targeted?

As the plugin.acp.fight.object uses

Code: Select all

  $incmissle = [THIS]->find nearest missile aiming to me
...
    if [THIS]->is in active sector
...
    else
      $rnd.missile.att = random value from 5 to 15 - 1
      if $rnd.missile.att
        = [THIS]->fire lasers on target $incmissle using turret 0
      end
Wait brainwave, when you say they don't exist as objects, do you mean that they
$ret = $incmissile -> exists
$ret <- [FALSE]
But, they are still referable ($incmissile), in scripts like the above -get nearest missile aiming at me- and -get array of missiles aiming at me-

(Or could it be something more zany, e.g. missiles only exists as ware subtype references on their targeted ships, incoming missile array)




Q2: Also, how do missiles work in OOS combat, as I know that ships "refresh" less often in OOS, and the missile travel distance would be covered in very few 'ticks'






Q3: Which actual command, makes ships do damage in OOS combat?

Context: I want to make capitol ships in combat, follow a specific way point of movement for IS combat whilst its turrets do the fighting. But if I did that on OOS, they will not shoot each other (as turret scripts sleep whilst OOS).
So which script command would I need to run on the task 0, to make them fight OOS, (hopefully, whilst still sort of following their way points)
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

Like jlehtone said, missile objects do not exist OOS, therefore you can not intercept them.
When fired, they hit instanteous at any range.

However, missiles do not automatically hit. I don't know the responsible variables but a missile fired OOS hits... sometimes.

It's black magic just like the OOS laser fire results.
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.

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