[Discussion] Generic X3TC S&M questions III

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

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

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24969
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Mon, 5. Sep 11, 19:47

What do you mean with guessing the coordinates?
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

gefer8
Posts: 96
Joined: Thu, 1. Sep 11, 01:45

Post by gefer8 » Mon, 5. Sep 11, 20:33

I mean when I unload, it's a guessing game how close I put it around another station so it's connected.

User avatar
heratik
Posts: 1210
Joined: Tue, 3. May 11, 16:31
x3tc

Post by heratik » Tue, 6. Sep 11, 13:42

gefer8 wrote:I mean when I unload, it's a guessing game how close I put it around another station so it's connected.
Using the different axis views available in the sector map when unloading a station, in combination with being able to view the exact axis numbers of previously deployed stations displayed in the bottom right corner of the sector map, in further combination with having an Advanced Satellite in the sector so you can switch to view at a structural level in the sector map, no mod or script is needed to place stations with almost pinpoint accuracy. :)

User avatar
Ketraar
EGOSOFT
EGOSOFT
Posts: 11878
Joined: Fri, 21. May 04, 17:15
x4

Post by Ketraar » Tue, 6. Sep 11, 15:34

Also remember that when placing stations you can position them relatively to other objects by pressing 'numpad 5', which will position the station on the same spot as the selected object (for instance an already placed station) and then move it to the side or up/down maintaining the same "line". Combine this with the mentioned advanced sat and some zooming in and you will soon notice its not much of an issue to place stations almost perfectly.

For lots of stations it will still be tedious though :-P

MFG

Ketraar
Image

User avatar
eldyranx3
Posts: 2178
Joined: Sat, 14. Jan 06, 21:29
xr

Post by eldyranx3 » Tue, 13. Sep 11, 18:23

Im not sure I understand how to use the name override function in MD code. It obviously links to a ID on text page 17, but instead of adding to page 17, cant I just link a bunch of existing ids together?

Strong Arms Weapons Dealer, for example? Those entries already exist, but it looks like I cant directly put them in the MD code when creating ships / stations / objects.

Along the same lines, I'm not sure how [Set_Mission_Rank] works. What page ID does it use?

User avatar
Ketraar
EGOSOFT
EGOSOFT
Posts: 11878
Joined: Fri, 21. May 04, 17:15
x4

Post by Ketraar » Tue, 13. Sep 11, 18:50

textID override will only accept a number, not an ID as usual.

textid="1247" will work, or textid="{value@previoussetvalue}" resulting in full numbers, as it will read only from page 17 anyway.
textid="{17,1247}" will not work, or any other value composition.

To obtain a name from multiple IDs you will have to create an entry in page 17 where you can set it up using the method you described and then call that ID.

No clue about the set_mission_rank as I never used it, would need looking up. You can have a look at JensKa's Taxi mission for an example on how to use it, maybe it gives you enough of a clue to figure it out. (Mission can be found in the Community scripts list).

MFG

Ketraar
Image

User avatar
eldyranx3
Posts: 2178
Joined: Sat, 14. Jan 06, 21:29
xr

Post by eldyranx3 » Tue, 13. Sep 11, 18:55

Thanks again Ketraar!

I hate these little curve balls that aren't documented or follow existing logic flow. I can only hope there's more support in X-R.

dillpickle
Posts: 1159
Joined: Mon, 3. Nov 08, 14:25
x3tc

Post by dillpickle » Tue, 13. Sep 11, 19:18

eldyranx3 wrote:Along the same lines, I'm not sure how [Set_Mission_Rank] works. What page ID does it use?
It uses Page ID 350900 (900) - check out one of the corporation missions to work out how they're used.

User avatar
eldyranx3
Posts: 2178
Joined: Sat, 14. Jan 06, 21:29
xr

Post by eldyranx3 » Tue, 13. Sep 11, 19:23

Thanks!

psionix
Posts: 1
Joined: Tue, 20. Sep 11, 02:21

Post by psionix » Tue, 20. Sep 11, 02:30

How i can remove unused scripts hotkeys from my savegame?
Image
When i start new game these hotkeys not appear.

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

Post by s9ilent » Tue, 20. Sep 11, 05:03

@psionix

w.r.t The first one (0-99) I don't know what uses that (no one should be using 0's???)
w.r.t The second one (2010-737) I also don't know what uses these

w.r.t The rest, 7030xxxx These appear to be from 7030: Gazz, NICE Interface Enhancement. I suspect if you reinstall that particular script package, it should come with an uninstall script.

Firewrath
Posts: 121
Joined: Fri, 3. Aug 07, 05:49
x3tc

Confusing Signals.

Post by Firewrath » Mon, 17. Oct 11, 11:16

Ok. So i need some help with signals. I need a way to track when a player ship kills another ship.
(As talked about in this thread: Leveling Pilots?.)

First. So you know where im coming from, I practically know Nothing of scripting and find the tutorials rather ...backwards. As-in the X3TC tutorial reads "Go read the X3R Tutorial" and the X3R tutorial reads "Go read the X2 Tutorial" ...and the X2 scripts wont work with with X3TC from what ive read/heard about script engine updates.


So ive read over the Universal Trader scripts and think i pretty well get how to keep pilot stats with local variables, but ive no idea how to detect when a ship kills another ship to track kills for advancement.

Ive tried looking around at signal scripts but they havnt been much help.
The closest i think ive gotten is from a few threads on the board, but it pretty much goes like this:

Code: Select all

global secondary signal map: add signal=SIGNAL_KILLED race=null class=Ship script='<My Script>' prio=120

if i understand that correctly, that would add a 'secondary signal' to EVERY ship in the game, then when they die, it would trigger 'My Script', correct?

would this work for ships that respawn?
(i figure it would, but want to be sure,)

do i have to do this command more then once or set it up like an AL that loads every time the game or a save is loaded?

and would this work with mods like XRM that changes the universe map without interfering with them?
(i figure the 'map' bit means the universe map,....)


also, what if someone uninstalls my pilot script,...
would that signal remain attached to all the ships?

is there a way to remove it with like an 'uninstall' command or would it matter?

ive also read that secondary signals fire twice or used to, is that something i still have to worry about?
and if so, is there a way to prevent it?

Now after all that, :P
from reading the '!ship.signal.killed' script, i figure that if in 'My Script' i use '$killer' that it returns my ships ID which i can use to update the local variables?

hrm, im sure ive forgotten about or missed something in all this, but i think its good enough for now, :P
if someone can help and explain this stuff to me, id appreciate it,
Last edited by Firewrath on Mon, 17. Oct 11, 13:47, edited 1 time in total.

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

Post by Gazz » Mon, 17. Oct 11, 12:23

What I suggested was to tie it to both SIGNAL_ATTACKED and DOCKED.

Those are likely to fire once in a while. SIGNAL_KILLED would only service one ship - the one that fired the last shot.

Of course you can do all of the above. Whatever you feel like...
With mainly carrier-based fighters, DOCKED would make the most sense, though.

I wouldn't worry too much about pinpoint accuracy there.
If a signal fires twice, so be it. It does the same thing. If the rank is already displayed correctly, so what?
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.

Firewrath
Posts: 121
Joined: Fri, 3. Aug 07, 05:49
x3tc

Post by Firewrath » Mon, 17. Oct 11, 13:05

Because i want the script to track kills, if the ship kills another ship, and the script fires twice, it would add 2 to the ships kill count instead of just 1,

so i figured it would do the first update of the pilot name with its fight skill as part of the 'hire pilot' command and then refresh that every time the ship got a kill to keep it updated with any fight skill increases,

ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh » Mon, 17. Oct 11, 15:41

Firewrath wrote:Because i want the script to track kills, if the ship kills another ship, and the script fires twice, it would add 2 to the ships kill count instead of just 1,

so i figured it would do the first update of the pilot name with its fight skill as part of the 'hire pilot' command and then refresh that every time the ship got a kill to keep it updated with any fight skill increases,
I take it from this that you want to add your own pilot leveling, rather than use the already existing pilot fight skill leveling, as in your thread (that would be much easier, just a secondary signal or two and some "sprintf" string manipulation with "get/set pilot name" and "get pilot fightskill" commands).
There are 10 types of people in the S&M forums - those who understand binary, and those who don't.

Black holes are where God divided by zero.

Firewrath
Posts: 121
Joined: Fri, 3. Aug 07, 05:49
x3tc

Post by Firewrath » Tue, 18. Oct 11, 00:02

the only thing ive seen about pilots gaining levels in X3TC is where Gazz pointed at '!plugin.acp.fight.attack.object' but all i found in there was:

Code: Select all

032   if not  = random value from 0 to $combat.level - 1
033   |inc $combat.level = 
034   |[THIS] -> set pilot fightskill to $combat.level
is 'inc $combat.level = ' the same as something like this in C++:
'combat.level = combat.level+1' ?

and is that executed on every attack run?
or is it just once per target?
i mean, does it increase the fight skill every time the ship attacks another ship, or does it only do it once till that ship is destroyed?
(i can see where any of that would cause problems with a custom pilot leveling script,)


and even if that does increase the pilots fight skill, id still like to track things like ship kills,

also, from reading '!plugin.acp.fight.attack.object' and '!plugin.acp.fight.skill.std' which it links to, i take it that it sets the default fight skill of any ship to a random number?

ive other questions but id rather get this stuff settled and out of the way first, ^-^

ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh » Tue, 18. Oct 11, 02:55

Firewrath wrote:is 'inc $combat.level = ' the same as something like this in C++:
'combat.level = combat.level+1' ?
Yes.
Firewrath wrote:and is that executed on every attack run?
or is it just once per target?
i mean, does it increase the fight skill every time the ship attacks another ship, or does it only do it once till that ship is destroyed?
(i can see where any of that would cause problems with a custom pilot leveling script,)
Every time the script is called, there is a small chance, getting smaller the higher the fight skill, that the skill will increase. "if not random value" is TRUE only if the random value is 0 - it's a common pattern in X3TC scripts.

For example, a ship running a patrol script detects an enemy, so calls !plugin.acp.fight.attack.object. There is then the potential for skill increase. Once the 'victim' is destroyed, then the script exits and returns to the patrol script, which may detect another enemy and so the acp script is called again, with another potential increase in fight skill, and so on.
Firewrath wrote:and even if that does increase the pilots fight skill, id still like to track things like ship kills,
So yeah, you will need a secondary signal handler script for SIGNAL_KILLED for that.
Firewrath wrote:also, from reading '!plugin.acp.fight.attack.object' and '!plugin.acp.fight.skill.std' which it links to, i take it that it sets the default fight skill of any ship to a random number?
Only if the ship doesn't currently have any fight skill (i.e. is zero), which I don't think ever actually happens by default.


Another issue worth considering is that the acp script is only called under certain conditions. Check !fight.attack.object - that delegates the script to call depending on the context. For example, no NPC ship uses the acp script unless it is within 1 jumps of the player (boring !fight.attack.object.std is used instead)...
There are 10 types of people in the S&M forums - those who understand binary, and those who don't.

Black holes are where God divided by zero.

Firewrath
Posts: 121
Joined: Fri, 3. Aug 07, 05:49
x3tc

Post by Firewrath » Tue, 18. Oct 11, 17:54

ThisIsHarsh wrote: Informative stuff.
Awesome, Thanks for that. ^-^

ThisIsHarsh wrote:
Firewrath wrote:also, from reading '!plugin.acp.fight.attack.object' and '!plugin.acp.fight.skill.std' which it links to, i take it that it sets the default fight skill of any ship to a random number?
Only if the ship doesn't currently have any fight skill (i.e. is zero), which I don't think ever actually happens by default.
So is there an easy way to set the default fight skill of player ships?
im hoping to avoid an over use of signals,
(right now it looks like i'll have three with ATTACKED/DOCKED on about Every ship, and +KILLED on the NPC ships (or mebey all of them, idk yet))
because if not, id prolly have to add CAPTURED and ...i cant remember it right now, but i think theres one that tracks when you buy something from a station, so thatd be like 5 signals total, =/

ThisIsHarsh wrote: Another issue worth considering is that the acp script is only called under certain conditions. Check !fight.attack.object - that delegates the script to call depending on the context. For example, no NPC ship uses the acp script unless it is within 1 jumps of the player (boring !fight.attack.object.std is used instead)...
just to be sure if i read this correctly from that script, but this:

Code: Select all

if $player.ships OR $player.stations OR $player.isowner OR $player.jumps < 2
means that player ships always use the more complex fight script, right?

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

Post by Gazz » Tue, 18. Oct 11, 18:05

Firewrath wrote:means that player ships always use the more complex fight script, right?
Yah. And once you got a bunch of satellites placed, every ship in the universe uses the more complex one.
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.

ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh » Tue, 18. Oct 11, 21:12

Firewrath wrote:
ThisIsHarsh wrote:
Firewrath wrote:also, from reading '!plugin.acp.fight.attack.object' and '!plugin.acp.fight.skill.std' which it links to, i take it that it sets the default fight skill of any ship to a random number?
Only if the ship doesn't currently have any fight skill (i.e. is zero), which I don't think ever actually happens by default.
So is there an easy way to set the default fight skill of player ships?
im hoping to avoid an over use of signals,
(right now it looks like i'll have three with ATTACKED/DOCKED on about Every ship, and +KILLED on the NPC ships (or mebey all of them, idk yet))
because if not, id prolly have to add CAPTURED and ...i cant remember it right now, but i think theres one that tracks when you buy something from a station, so thatd be like 5 signals total, =/
AFAIK there is no way to set a fight skill default. In fact, do player ships even *have* their own fight skill? You might need to use the pilot commands to create a pilot (quite cool, since you can then transfer pilots to different ships, carry them around as passengers, etc and they will retain their stats).

I'm not sure what you are trying to do. I thought it was just track kills and skill and show alongside the pilot name, in which case you only need SIGNAL_KILLED to update the stats and pilot name of the $killer.

But other than that, don't worry too much about using signals. In fact signals are by far the preferred way of doing things. They are only triggered when an event (signal) occurs, so have practically no overhead, compared to constantly running scripts.
There are 10 types of people in the S&M forums - those who understand binary, and those who don't.

Black holes are where God divided by zero.

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