[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
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

And does that simply change the amount produced or the amount it holds?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

Both. You cannot change these values independantly.
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
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Ah good.

As long as it edited the number held.
The factories don't actually produce anything, so that's ok.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Just stumbled across a common sense problem for the random asteroid script...

4 Booleans, do you want Ore, Ice, Sil, Niv...

Problem is, the asteroids are set to have a random subtype between 0 and 3, with it being 0 for ore, 1 silicon, 2 niv and 3 for ice...

How would I set it up so any combination would work!?

I need to basically say, random number out of any of these 4 marked as true, and I'm having a mental blank... is there any way to put the 4 numbers in an array then tell it to grab a random value out of the array?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren »

Ejon,

$subtype.array = array alloc size = 0

skip if not $ore.ast.TF = [TRUE]
| append 0 to array $subtype.array

skip if not $sil.ast.TF = [TRUE]
| append 1 to array $subtype.array

skip if not $niv.ast.TF = [TRUE]
| append 2 to array $subtype.array

skip if not $ice.ast.TF = [TRUE]
| append 3 to array $subtype.array

$size = size of array $subtype.array
if $size > 0
| $rand = get random value between 0 and $size -1
| $rand.sub.type = $subtype.array [$rand]
| create asteriod: subtype $rand.sub.type .....
end

MarCon
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Was just about there... :P
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Is there a command in the script editor I can use to destroy an asteroid and create the correct debris? If you just destroy it the debris disappears... :S
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

get the Ressource Type and the Yield, destroy the Asteroid and create Debris with the same Mineral and Yield on its position (or put in some random factor)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Is that how the game does it?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
jlehtone
Posts: 22572
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone »

EmperorJon wrote:Is that how the game does it?
Probably not quite, but almost.

Remember that Asteroids do respawn. Therefore, "blow up" does not mean same as "destroy". I would implement "vanilla blow up" as:
1. Make invisible
2. Create debris
3. Start re-spawn timer

And therefore the respawn would be a simple:
1. Make visible (with "avoid in-sector collision")
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Considering they're not vanilla asteroids, they are ones I've added, that's unecessary.

The problem at the moment is, upon me saying 'destroy' they, obviously, break apart into the debris, then the debris disappears, but I can't find any way of actually creating the right sized debris in the right place by the right rotation... what could I do?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

jlehtone wrote:Remember that Asteroids do respawn. Therefore, "blow up" does not mean same as "destroy". I would implement "vanilla blow up" as:
1. Make invisible
2. Create debris
3. Start re-spawn timer

And therefore the respawn would be a simple:
1. Make visible (with "avoid in-sector collision")
that is not necesary because this will be done by the Game Engine - you have to tell it specificallty that it mustn't respawn an Asteroid before you destroy it.. (can be done with "disable Ship" )


@EJ no idea, but since the Destruction Animation of the big Asteroid is iirc always the same create one in the Sector center, destroy it and save the Coordinates of some debris until you have them all, then you just need some trigonometry to calculate the debris position for every Position and Angle in the Sector
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

I was doing that, but I can't seem to find the correct debris to use, and it's going to be so hard ot fit them into position.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
Chestburster2
Posts: 214
Joined: Sat, 25. Mar 06, 13:19
x3tc

Post by Chestburster2 »

Question ->

How can i edit the color of a bullet? Changing the RGB value inside the TBullets wont work.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

The rgb values in the tfiles are just (correct me if I'm wrong) the emissive light source values of the bullet, not the actual diffuse texture.

The actual "colour" of the bullet, is defined by it's model/texture (and most projectiles tend to use just the one "star" texture, repeated several times, so you should be able to modify that)
Chestburster2
Posts: 214
Joined: Sat, 25. Mar 06, 13:19
x3tc

Post by Chestburster2 »

Ah, thx s9ilent! Changed the PRG from yellow to red and it worked. now i just need to figure out which texture belongs to each bullet.
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

The PRG is red...?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
Chestburster2
Posts: 214
Joined: Sat, 25. Mar 06, 13:19
x3tc

Post by Chestburster2 »

CMOD3 changed it to yellow, i wanted it back to red ;)
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Ah, ok...


Can anyone help me out on this one...

It's triggered by moving to a new sector... well, ok it isn't. Something else is triggered which then runs this, but anyway.

Code: Select all

001   while $Num
002   |dec $Num = 
003 @ |= wait 5 ms
004   |display subtitle text: text= *This text has been removed to prevent spoilers* duration=2000 ms
005 @ |= [THIS] -> call script *This text has been removed to prevent spoilers*: 
006   |write to log file #19283  append=[TRUE]  value='It reached this part.'
007   end
008   return null
Causes blackness like it was still loading the sector, and station noises and announcements. Seems to be an infinite loop of some kind... but where!? It never reaches the show logfile output, whereas the others are reached, so this is the problem. If this is impossible for some reason, other ways?


EDIT: It would appear it's making it into the next script, which does have... a large loop in it. Very large. :S
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren »

EJon,

How long after the change sector is complete is the script called, cos you will need to wait to the change sector is comlete i think.

Code: Select all

005 @ |= [THIS] -> call script *This text has been removed to prevent spoilers*: 
Is there something in this script that could be causing the loop? Without seeing the code for it we can't tell if it's in there.

How big is $Num ?

Code: Select all

003 @ |= wait 5 ms 
004   |display subtitle text: text= *This text has been removed to prevent spoilers* duration=2000 ms
The way this will loop will only show the last subtitle as any previous ones will be overwritten due to the 5 ms wait if $Num is greater than 1.

MarCon

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