ThisIsHarsh wrote:Coruskane wrote:hmm true.ThisIsHarsh wrote:e.g. current player notoriety, notoriety of ship vs. sector, player fight rank, etc, etc
[Discussion] Generic X3TC S&M questions II
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 851
- Joined: Fri, 13. Jun 08, 13:14
-
- Posts: 22
- Joined: Wed, 15. Sep 10, 08:48
Currently I am in the Process of Developing a Weapon mod but I have hit a snag...When I update the Tlaser and Tbullet files within the .cat file they do not update...They save and when reopened the saved changes are there but the VFS does not seem to update ingame and the Weapons are still the same..Why is That?
Note: I am using X3 Editor 2
Note: I am using X3 Editor 2
-
- EGOSOFT
- Posts: 12187
- Joined: Fri, 21. May 04, 17:15
Seams you are not extracting the files. The Editor does not save files within cats.
Editing Terran Conflict - The Very Basics by enenra
MFG
Ketraar
Editing Terran Conflict - The Very Basics by enenra
MFG
Ketraar

-
- Posts: 22
- Joined: Wed, 15. Sep 10, 08:48
Thanks for the quick reply, should have looked a bit harder for tuts 
EDIT: Found what was wrong silly me The entries for bullets start at 0 and the Tdebugger starts at 2 just had to take 2 off each entry that I added and hey it worked!

EDIT: Found what was wrong silly me The entries for bullets start at 0 and the Tdebugger starts at 2 just had to take 2 off each entry that I added and hey it worked!
Last edited by Point Man on Thu, 16. Sep 10, 02:55, edited 2 times in total.
-
- Posts: 120
- Joined: Sat, 3. Jan 09, 03:57
-
- Posts: 2035
- Joined: Wed, 18. Aug 10, 14:28
Actually I am doing some research into that. I am going to put low poly and untextured models of the ships at +10% size in the scene files. See if that aids with the problematic autopilot...
Cadius uses separate ship collision files similar to this, but his scene files work without the base model being present, so I'm guessing that is the collision field for the ship. Increase the size of the collision field and reduce the polies and it may just solve the issues with autopilot and IS suicides on Solar Panels...
Cadius uses separate ship collision files similar to this, but his scene files work without the base model being present, so I'm guessing that is the collision field for the ship. Increase the size of the collision field and reduce the polies and it may just solve the issues with autopilot and IS suicides on Solar Panels...
"If you’re not prepared to be wrong, you’ll never come up with anything original."
Sir Ken Robinson
Sir Ken Robinson
-
- Posts: 120
- Joined: Sat, 3. Jan 09, 03:57
Interesting........in theory it seems plausible as the model itself isn't as complex, although I don't see how an increased collision field would help?
Wouldn't that make it so the ai would go more bonkers as it would collide with things from further away?
Also, uh, I tried looking for an answer, but just couldn't find it. How do you spawn ships in game using the editor?
Wouldn't that make it so the ai would go more bonkers as it would collide with things from further away?
Also, uh, I tried looking for an answer, but just couldn't find it. How do you spawn ships in game using the editor?
-
- Posts: 120
- Joined: Sat, 3. Jan 09, 03:57
-
- Posts: 2035
- Joined: Wed, 18. Aug 10, 14:28
Actuall the Fleet Collision Fix mod worked similarly to this except instead of making the collision field bigger (in the scene file) it made all the ships tiny and redid the scene positioning of the emissive parts to compensate. This made all fighters about 10% of current size (screwing up sound and so on) but also made them able to fly in squadrons and avoid crashing easily. I am just reversing the idea and increasing the collision box itself so formation flying and solar suicides are less common (after FCF broke my first game
)

"If you’re not prepared to be wrong, you’ll never come up with anything original."
Sir Ken Robinson
Sir Ken Robinson
-
- Posts: 851
- Joined: Fri, 13. Jun 08, 13:14
Hello,
I am having some problems with a global variable and arrays:
I suspect that I am either instancing a 2d array wrong, or I am incorrectly adding arrays to a global variable.
I would appreciate you having a look..tearing my hair out
The full script is attached https://www.humyo.com/FWQbYxl/Public/a. ... tvIczaztqE
I am having some problems with a global variable and arrays:
Code: Select all
* Update reference global variable with this new ship type we have found
$Lib.Ships.ArraySize = size of array $Lib.Ships
inc $Lib.Ships.ArraySize =
resize array $Lib.Ships to $Lib.Ships.ArraySize
$Lib.Ships[$Lib.Ships.ArraySize][0] = $ship.Ship
$Lib.Ships[$Lib.Ships.ArraySize][1] = $ship.Power.Max
$Lib.Ships[$Lib.Ships.ArraySize][2] = $ship.Power.Lasers
$Lib.Ships[$Lib.Ships.ArraySize][3] = $ship.Power.Engines
set global variable: name='plugin.Cor.SS.Lib.Ships' value=$Lib.Ships
I would appreciate you having a look..tearing my hair out

The full script is attached https://www.humyo.com/FWQbYxl/Public/a. ... tvIczaztqE
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
$Lib.Ships has now $Lib.Ships.ArraySize elements, which means that the last element is $Lib.Ships.ArraySize - 1.resize array $Lib.Ships to $Lib.Ships.ArraySize
$Lib.Ships[$Lib.Ships.ArraySize][0] = $ship.Ship
Thus you try to assign to a array element which does not exist.
Additionally $Lib.Ships[$Lib.Ships.ArraySize][0...3] does not simply exist, but you have to explicitly put an array there.
I'd do it like this:
Code: Select all
$new.Ship = create new array, arguments=$ship.Ship, $ship.Power.Max, $ship.Power.Lasers, $ship.Power.Engines, null
append $new.Ship to array $Lib.Ships
ScRaT
-
- Posts: 1468
- Joined: Wed, 3. Aug 05, 05:05
I would be tempted to do it this way to avoid the whole "size starts at 1" and "index starts at 0" thing.
EDIT:
Beaten by ScRaT_GER
MarCon
Code: Select all
* Update reference global variable with this new ship type we have found
$new.ship.array = array aloc: size = 4
$new.ship.array [0] = $ship.Ship
$new.ship.array [1] = $ship.Power.Max
$new.ship.array [2] = $ship.Power.Lasers
$new.ship.array [3] = $ship.Power.Engines
append $new.ship.array to array: $Lib.Ships
set global variable: name='plugin.Cor.SS.Lib.Ships' value=$Lib.Ships
Beaten by ScRaT_GER
MarCon
-
- Posts: 851
- Joined: Fri, 13. Jun 08, 13:14
ok, thanks. Good stuff
@ScraT:
..assumed it would make the datatype of the new variable, $Lib.Ships, the same as the data it is receiving.
Well, that is good in a way. I prefer explicit language...fewer headaches and unexpected errors. (Ruby is the devil's language...
)
And to be able to find the relevant ship's array, wouldn't I need the global variable to have an index column comprised of the ship type, with the x column comprised of the references to the nested array? Therefore 2d array is minimum for the global?
@Mark:
In that case, what will the 1-d array actually have as its data? Won't its [y][0] values be the name of the array placed there? i.e. [0][0]=$new.Ship.Array?
If that is the case, then how can I extract the correct index from the global variable, when knowing only $Ship.Type?

I undestand multi-dimensional arrays, because I understand matrices. I would search the [n][0] values for the $Ship.Type, then extract the corresponding [search result][0...Xn-1] elements of info.
However, I am not sure I understand nested arrays
..time to experiment 
Thanks you two, apologies for the long reply.
@ScraT:
whoops! n-1 coming 'atcha.ScRaT_GER wrote:$Lib.Ships has now $Lib.Ships.ArraySize elements, which means that the last element is $Lib.Ships.ArraySize - 1.resize array $Lib.Ships to $Lib.Ships.ArraySize
$Lib.Ships[$Lib.Ships.ArraySize][0] = $ship.Ship
Thus you try to assign to a array element which does not exist.
Hmm, so to extract a global variable of Array type I first have to instanciate an array within which to place the extracted array? I didn't realise X was slightly-strongly-typedAdditionally $Lib.Ships[$Lib.Ships.ArraySize][0...3] does not simply exist, but you have to explicitly put an array there.

Well, that is good in a way. I prefer explicit language...fewer headaches and unexpected errors. (Ruby is the devil's language...

Wouldn't that make a 4 dimensional array?I'd do it like this:Code: Select all
$new.Ship = create new array, arguments=$ship.Ship, $ship.Power.Max, $ship.Power.Lasers, $ship.Power.Engines, null append $new.Ship to array $Lib.Ships
And to be able to find the relevant ship's array, wouldn't I need the global variable to have an index column comprised of the ship type, with the x column comprised of the references to the nested array? Therefore 2d array is minimum for the global?
@Mark:
So you are saying have a unique array for each ship, with the global variable array simply referencing each array as opposed to what I was trying (and failing to do) which was have a multi-dimensional global array within which all the elements I want will sit as-is.mark_a_condren wrote:I would be tempted to do it this way to avoid the whole "size starts at 1" and "index starts at 0" thing.
Code: Select all
* Update reference global variable with this new ship type we have found $new.ship.array = array aloc: size = 4 $new.ship.array [0] = $ship.Ship $new.ship.array [1] = $ship.Power.Max $new.ship.array [2] = $ship.Power.Lasers $new.ship.array [3] = $ship.Power.Engines append $new.ship.array to array: $Lib.Ships set global variable: name='plugin.Cor.SS.Lib.Ships' value=$Lib.Ships
In that case, what will the 1-d array actually have as its data? Won't its [y][0] values be the name of the array placed there? i.e. [0][0]=$new.Ship.Array?
If that is the case, then how can I extract the correct index from the global variable, when knowing only $Ship.Type?
Goodie...More stuff for me to thiink aboutEDIT:
Beaten by ScRaT_GER

I undestand multi-dimensional arrays, because I understand matrices. I would search the [n][0] values for the $Ship.Type, then extract the corresponding [search result][0...Xn-1] elements of info.
However, I am not sure I understand nested arrays


Thanks you two, apologies for the long reply.
-
- Posts: 22
- Joined: Wed, 15. Sep 10, 08:48
How do I make a ware run a script....I mean When a ware is in the cargo bay of the ship make it run a script constantly? I can't figure out what to use (Trying to make a Shield regenerator that regens 5% every 20 secs). I got the script down and working but only runs once...and that brings me to my second question how do I get the script running multiple times?
Sorry bout the newby questions but only just got into scripting and run outta tuts to follow so trying my own crap now!
Any help you could give to get me started on it would be nice
Cheers
Point Man
Sorry bout the newby questions but only just got into scripting and run outta tuts to follow so trying my own crap now!
Any help you could give to get me started on it would be nice
Cheers
Point Man
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
The type system of X is like the one in Python. You can assign any value to any variable, but every variable has a certain type at every time.I didn't realise X was slightly-strongly-typed
No, it's actually the same thing mark_a_condren does, but a bit more compact.Wouldn't that make a 4 dimensional array?
You could reference the $ship.Power.Max of the 10th ship in $Lib.Ships by writing $Lib.Ships[9][1] - so it's two dimensional.
You could do a linear search through all first indices or you could use two arrays, one holding the ship types, the other one the values.And to be able to find the relevant ship's array, wouldn't I need the global variable to have an index column comprised of the ship type, with the x column comprised of the references to the nested array?
Nested arrays ARE mutli-dimensional arrays. An array of arrays is like a matrix and is two dimensional. An array of arrays of arrays is three dimensional, like an array of matrices.However, I am not sure I understand nested arrays
Use a loop:I got the script down and working but only runs once...and that brings me to my second question how do I get the script running multiple times?
Code: Select all
while ($someConditionIsTrue)
* Do something
end
ScRaT
-
- Posts: 1468
- Joined: Wed, 3. Aug 05, 05:05
Point Man
To expand on ScRaT_GER's reply, you could do something like,
$current.shield.percent = $target.ship get shield percent
while $current.shield.percent < 100
| Add the required amount of shield percentage
|@ = wait 12000 ms
| $current.shield.percent = $target.ship get shield percent
end
This would loop every 20 seconds adding the required shield amount until the shields are back to 100%
MarCon
To expand on ScRaT_GER's reply, you could do something like,
$current.shield.percent = $target.ship get shield percent
while $current.shield.percent < 100
| Add the required amount of shield percentage
|@ = wait 12000 ms
| $current.shield.percent = $target.ship get shield percent
end
This would loop every 20 seconds adding the required shield amount until the shields are back to 100%
MarCon
-
- Posts: 1135
- Joined: Sun, 19. Oct 08, 18:46
No help for my query before, so here it is again:
Anyone know any resource or simple method whereby I can obtain the exact notoriety gains/losses caused by killing enemy/friendly ships?
Anyone know any resource or simple method whereby I can obtain the exact notoriety gains/losses caused by killing enemy/friendly ships?
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.
Black holes are where God divided by zero.
-
- Posts: 22
- Joined: Wed, 15. Sep 10, 08:48
-
- Posts: 851
- Joined: Fri, 13. Jun 08, 13:14