[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

mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren »

Point Man wrote:Thanks for the replies it works...damn it's so obvious...now anyway :P

EDIT: I still don't know how to make the item have to be in a ship for it to work though....any ideas?
Put this before the recharge loop.

skip if $target.ship get amount of ware "the ware it needs to have" in cargo bay
| return null


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

Post by ScRaT_GER »

Anyone know any resource or simple method whereby I can obtain the exact notoriety gains/losses caused by killing enemy/friendly ships?
Well, you can simply use the SIGNAL_KILLED to see, when a ship was killed.
You then keep track of the notorieties to every race and calculate the difference.

However I'm not sure if the notoriety changes before or after the SIGNAL_KILLED and all attached secondary signal scripts are executed - but either way would work, you'd just interpret the results differently.

Greetings,
ScRaT
Point Man
Posts: 22
Joined: Wed, 15. Sep 10, 08:48

Post by Point Man »

Sorry bout the constant questioning but I can only get it to work on player ship how do I make it so ANY ship with the ware will automatically run the script?
EDIT: actually it doesn't work what is wrong with this code

Code: Select all

skip if [PLAYERSHIP]->get amount of ware {Shield Booster} in cargo bay
  return null
$shield.max = [PLAYERSHIP]->get maximum shield strength
= wait 12000 ms
$shield.per = [PLAYERSHIP]->get shield percent
while $shield.per < 100 
  $shield.add = $shield.max / 10 
  [PLAYERSHIP]->add shields per value:$shield.add
  $shield.per = [PLAYERSHIP]->get shield percent
end
mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren »

Point Man

First, the 'wait' needs to be inside the 'while' loop to get it to pause between each loop, as it is the loop will just cycle without a pause. Also you need to get the current shield strength and then add the desired amount and use the 'set current shield strength' command.

Im not sure '[PLAYERSHIP]->add shields per value:$shield.add' would be the best command to use here.

Code: Select all

skip if [PLAYERSHIP]->get amount of ware {Shield Booster} in cargo bay 
  return null 
$shield.max = [PLAYERSHIP]->get maximum shield strength 
$shield.add = $shield.max / 10

$shield.per = [PLAYERSHIP]->get shield percent 
while $shield.per < 100 
  $shield.current = [PLAYERSHIP]-> get current shield strength
  $shield.new = $shield.current + $shield.add
  skip if $shield.new < $shield.max
    $shield.new = $shield.max
  [PLAYERSHIP]-> set current shield strength to: $shield.new 
  = wait 12000 ms  
  $shield.per = [PLAYERSHIP]->get shield percent 
end
MarCon
User avatar
TrixX
Posts: 2035
Joined: Wed, 18. Aug 10, 14:28
x4

Post by TrixX »

Any info as to why the M0 class is bugged? I've seen a lot of references to it, and hence things like the Valhalla are M2 rather than M0...

Just curious for future plans is all ;)

OK need to expand on this. Where are the ship classes defined? Need to alter a couple of them ;)
"If you’re not prepared to be wrong, you’ll never come up with anything original."
Sir Ken Robinson
Gyver162
Posts: 17
Joined: Tue, 7. Jul 09, 14:19
x3tc

Post by Gyver162 »

I've a problem my script is adding 3 itemst/wares for sale and there is one thing I don't know how to set price for this items in script code.

Code: Select all

$shield.1 = {ZA_EMP_10623_BLANK_WARE_CUSTOM18_3} 
$shield.2 = {ZA_EMP_10633_BLANK_WARE_CUSTOM19_3} 
$shield.3 = {ZA_EMP_10643_BLANK_WARE_CUSTOM20_3} 
 
$hol = get sector from universe index: x=1, y=4
 
$exister = find station: sector=$hol class or type={Dok z wyposażeniem} race={Argoni} flags=null refobj=null maxdist=null maxnum=null refpos=null
if $exister->exists
  $exister->add product to factory or dock: $shield.1
  $enchk.1 = $exister->get amount of ware $shield.1 in cargo bay
  skip if $enchk.1 != 0 
    = $exister->add 5 units of $shield.1
   
  $exister->add product to factory or dock: $shield.2
  $enchk.2 = $exister->get amount of ware $shield.2 in cargo bay
  skip if $enchk.2 != 0 
    = $exister->add 5 units of $shield.2
   
  $exister->add product to factory or dock: $shield.3
  $enchk.3 = $exister->get amount of ware $shield.3 in cargo bay
  skip if $enchk.3 != 0 
    = $exister->add 5 units of $shield.3
end
return null
And one more thing there is command "add 5 units (...)" and in factory there is only 2 items... :?
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

You can't set prices except through modding. Instead, choose the EMP wares that has a price closest to what you want.

Stations have a maximum amount they can hold, again the only way to change this is through modding.
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.
Gyver162
Posts: 17
Joined: Tue, 7. Jul 09, 14:19
x3tc

Post by Gyver162 »

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

Post by s9ilent »

Question: Are there any Special characters used by Tfiles?
e.g. I know that \033 are for colour tags
And [xxx] has some special properties

Basically what I need to do, is put an xml-like object into a single tfile entry, and I'm not to sure which characters I can use.

I wanted to []'s (and I've used them before as straight text) but I don't know what will happen if I use lots of them (e.g. one object might have something like... 30 pairs of []'s and they will be nested inside each other.
(In short, I just want to know if my game will explode, or run fine --- or if any one has better suggestions for opening/closing characters)
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

Brackets [] will only work if you escape them with backslashes \. Otherwise the game won't recognize them (e.g. for regular expressions). The same is true for normal brackets ().
Maybe you could try curly braces {} as opening and closing characters - but I never tried that, so you might have to escape them, too.

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

Post by s9ilent »

Unfortunately, curly braces are used for text referencing
e.g. {17,1401} {pageid,textid}, and i do plan on passing lots of numbers through (so the chance of issues arising is high)

Are you sure [] need escape characters?
As I use them in my menus with no issues
<t id="1011">[-] \033Y%s\033X</t>
<t id="1012">[+] \033Y%s\033X</t>
(I haven't tried it with any thing more complex thou)

The other idea I was thinking of was to use completely random characters like #@$%^* (But not &'s because they are special)
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

[]'s are screwy in the logbook, but work for menus and ship names. I've used {} for ship names and it works fine for the logbook. ()'s are for putting comments in the XML file, so you have to escape them to use them, but once escaped they work anywhere afaik.

If you're interested in storing complex data structures in the t-file, why not try JSON?
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.
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

Unfortunately, curly braces are used for text referencing
Ah, right. I forgot about that...
Are you sure [] need escape characters?
Well, I tried to use them for regular expressions, which didn't work in the first place. So I tried to output them to the logbook and they didn't show up until I escaped them. But as ThisIsHarsh pointed out, this seems only to be a problem of the logbook.

And since brackets don't seem to be interpreted in any way by the game there should be no problems when nesting them.

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

Post by s9ilent »

Thanks for the suggestions everyone. That JSON script looks very interesting (And I'll look into it for my x3-online ideas) but I've decided to just stick with [] for now, as I'm using a very simple structure of

object -> [name=property[childobject][childobject2].....]
(Where there are 0-n child objects, and the child objects are the same as the parent)
User avatar
ThalonMook
Posts: 1296
Joined: Tue, 3. Feb 04, 12:11
x4

Post by ThalonMook »

Hi,

I need a transparent texture for a model. It shoud be invisible.

Does anybody know one from the DDS Folder.
Or can anybody give me the entriy I must use for the material tag in the bodyfile ?

CU Thalon
Coruskane
Posts: 851
Joined: Fri, 13. Jun 08, 13:14
x4

Post by Coruskane »

TrixX wrote:Any info as to why the M0 class is bugged? I've seen a lot of references to it, and hence things like the Valhalla are M2 rather than M0...

Just curious for future plans is all ;)

OK need to expand on this. Where are the ship classes defined? Need to alter a couple of them ;)
M0 is not a defined object class (or at least not an enabled definition), leading to problems. I imagine, because it is so firmly rooted in the game engine and in so many different aspects of the game, that these object classes are hard-coded and therefore not open to modding.

As to whether this is indeed the issue, I have no idea..Pure speculation on my part :). Also, big (arbitrary) community arguments over what an M0 should be...:D
Amon-ra
Posts: 49
Joined: Mon, 5. May 08, 00:00

Post by Amon-ra »

I use the X3editor to change the classes of a particular ship so I can utilize it with a mod (Production modules mod) its an M2 but to use the modules you need an M1. turns out you can't change classes via editor because the classes are hardcoded in OBJ files?

can anyone provide some insight into this?

also editing Docking slots through the editor dont seem to do much either, a vessel I had with 2 docking slots despite being a sizely M7, I wanted to increase that to 8, but it does not transition into game even if it shows in the editor, any help with this as well? :D

X3 editor 2
FriedTrix
Posts: 63
Joined: Fri, 13. Jan 06, 03:12
x4

Post by FriedTrix »

does anyone knows if there is a way to edit stations proprieties?
For example creating/moding a factory mine that would collect another ressource than the expected ones(example, getting a gold mine)?

thx
Coruskane
Posts: 851
Joined: Fri, 13. Jun 08, 13:14
x4

Post by Coruskane »

Amon-ra wrote:I use the X3editor to change the classes of a particular ship so I can utilize it with a mod (Production modules mod) its an M2 but to use the modules you need an M1. turns out you can't change classes via editor because the classes are hardcoded in OBJ files?

can anyone provide some insight into this?

also editing Docking slots through the editor dont seem to do much either, a vessel I had with 2 docking slots despite being a sizely M7, I wanted to increase that to 8, but it does not transition into game even if it shows in the editor, any help with this as well? :D

X3 editor 2
more info required:

was it 2 internal bays or 2 external clamps?

If the latter then the only way to add docking space is to add the clamps and dummies etc in the scene files.
Amon-ra
Posts: 49
Joined: Mon, 5. May 08, 00:00

Post by Amon-ra »

well i have 2 ships one which I gave up on it had 2 clamps, that I believe requires some model editing, I can do, don't know how yet and semi-uninterested. the second ship which poses the same issue has 1 docking bay and can field a total of 6 ships below M7, same dilemma can you give information as to how I am to go about increasing the Docking slots and size class of this ship M2 into M1.

(It can externally dock 2 TM's btw, its internal docking however is limit to 6.)

Why am I doing this? I wanted a mobile vessel with good armaments as a Base ship, since in a bit my universe is going to go to hell, I need to keep moving and bolster defenses for allies (if any :D) under the assualt.

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