[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
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

It never reaches the show logfile output
What do you mean by show logfile output? Line 004 or line 006?
If it is line 006 the problem is likely to be within the called script.

If it is not line 006, than maybe displaying a subtitle, while the sector is still loading is the problem. But iirc I did that several times and it never caused a problem.

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

Post by EmperorJon »

Mark, I know about the subtitle, num is the number of asteroids in the sector. The subtitle only needs to be shown once.

Scrat, yes, I reckon the problem is in the called script which has a massive loop... sort of keeps running for... minutes... :S


EDIT:

About 4 minutes in fact... what should I do? Do you want to see the code...? If it's taking 4 minutes will it take 4 minutes before it lets me into the next sector? Could a well placed Wait command solve it...? I'm really bad at getting things looping at unfortunate times... I mean, really good at it, but really bad. :P
______
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 »

If your script runs for 4 minutes without a wait then you'll have a hard time explaining to players that this is normal.
They push the reset button long before that and your script "is broken because it locks up my computer".

If such massive calculations are required - pre-compute them more slowly and activate the feature only after this is finished.

See those @ signs in scripts? Those are interrupt points, giving control back to other scripts... and the graphical engine.
They are good stuff.
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
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

Could a well placed Wait command solve it...?
Additional waits would make the waiting time even longer.

The best solution might be to use the START option for the script call. This makes the SE simply continue the calling script, while at the same time executing the called script. In other words: The SE doesn't wait for a return statement in the called script.
Of course this is only possible if the rest of the script doesn't depend on the execution of the called script.
Additionally, problems will arise, if you run the script an object and not globally. In this case, you'd have to use tasks (which is not really a problem either).
Do you want to see the code...?
Yes, why not. Maybe it's possible to save some time.
The subtitle only needs to be shown once.
So why put in into the loop? :D

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

Post by EmperorJon »

There's waits in it.

The thing is, when I run the script on its own it's fine. No lag at all.


When I run it from the trigger, lockup in the gates.

I put a wait in there and it was working, but not running the scripts! -.-

No it's locking up again. :wall:

I'm going to try something new... I'm guessing, if you're in the gate, 'sector exists' is either false or the sector is where you're heading, correct? Which?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
eldyranx3
Posts: 2178
Joined: Sat, 14. Jan 06, 21:29
xr

Post by eldyranx3 »

Try the START/Prefix in the [Call Script] like ScRaT_GER suggested. Worked for me!
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

I was about to, it's just he said it may cause problems if running that script on a specific object... which it does... for quite a while repeatedly.

EDIT: May GoD bless you and your ships for several years! :D
______
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 »

It has been successful! I have created the Reaper, and it follows you... Feel it's asteroidy wrath! :fg:

Oh, and thanks guys.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

I was about to, it's just he said it may cause problems if running that script on a specific object... which it does... for quite a while repeatedly.
It causes problems, if you're starting the script on the same task as the calling script is running.
Let's say we have to scripts A and B.
A is running on task 1000 of a ship and now uses the following command:

Code: Select all

START [THIS] -> call script 'B':
This will start script B on task 1000 of the ship, and thus overwrite script A. At the same time, the START prefix makes the SE continue the execution of script A, but this is not possible, because it was overwritten by script B.

I did this once in a script and at first only script A was frozen and after a while the whole game followed.

Greetings,
ScRaT
Chestburster2
Posts: 214
Joined: Sat, 25. Mar 06, 13:19
x3tc

Post by Chestburster2 »

Question ->
How can i change the names of existing weapons and let betty speak their new names?

- i changed both of the flak weapons to beam weapons (it works IG)
- made a new t-file (9998), added the ID 17 from boardcomp objects and id 8153 + 8163, changed their names to Laser Flak Array and Focused Laser Flak Array

the editor displays them with their new names but nothing changed IG :/
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Well, I'm not a modder, but obviously you can't get betty to speak the names. No idea about how to link the item to the tfile to the game.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

the editor displays them with their new names but nothing changed IG :/
Do you load the T-File 9998 using the command "load text: id=9998" in a setup script?
and let betty speak their new names?
This is only possible, if the name can be composed by other names. If that's the case you'll have to mod the mov/00044.xml, which contains definitions for the sound snippets. You'd have to define new ones for "Laser", "Flak", "Focused" and "Array" (if they don't exist) and link them together in a Text-Definition (t id="XXX").
Then you have to refer to that Text-Definition for the name of the object, and Betty will speak the name.

As you see it's quite complex, so you'll have to consider if it's worth the effort.

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

Post by EmperorJon »

Ok...

Code: Select all

else if $Type == 82
028   |$Ar =  get ship array: of race $Mil class/type=M3
029   |$Count =  size of array $Ar
030   |while $Count
031   ||dec $Count = 
032   ||$Ship = $Ar[$Count]
033   ||$Race = $Ship -> get maker race
034   ||if $Race == $Mil
035   |||$Rand =  = random value from 0 to 6 - 1
036   |||if $Rand < 3
037   ||||goto label Skipping
038   |||else if $Rand == 3
039   ||||$Multi = 1
040   |||else if $Rand == 4
041   ||||$Multi = 2
042   |||else if $Rand == 5
043   ||||$Multi = 3
044   ||||while $Multi
045   |||||dec $Multi = 
046   |||||$Ship =  create ship: type=$Ship owner=$Mil addto=$Sec x=0 y=0 z=0
047   |||||$Ship -> set name to 'Task Force'
048   |||||$Ship -> add default items to ship
049 @ |||||= $Ship -> call script '!ship.cmd.attack.std' :  the victim=$Target  do not follow in new sector=[TRUE]
050   |||||display subtitle text: text='Support incoming!' duration=400 ms
051   Skipping:
052   ||||end
053   |||end
054   ||end
055   |end
056   end
What would you expect that to do. And what would you say is wrong if I just get a Mammoth. -.-
______
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 »

Phew.. just looked inside the 00044 and i dont think its worth the efford for a personal only mod.

But thanks for the reply scrat :)
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

I don't believe Betty says the word 'focussed' any time either, so that writes that one off. :P
______
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 »

Another one *g*

Rapid box - w/l/h <- if i adjust these, the projectile (and/or his hitbox) gets bigger/smaller?

And is there a way to adjust the scattering of some weapons?
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

I'm guessing w/l/h is width lenght height.
______
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 »

Yep, width, length and hight
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Well, I have no experience with it, so I'd just suggest... try it out and see what happens!


Anyway, help please someone! :P

Code: Select all

|$Count =  size of array $AF
030   |while $Count
031   ||dec $Count = 
032   ||$Ship = $AF[$Count]
033   ||$Rand =  = random value from 1 to 6 - 1
034   ||if $Ship == Mammoth
035   |||$Rand = 0
036   |||while $Rand
037   ||||dec $Rand = 
038   ||||$FShip =  create ship: type=$Ship owner=$Mil addto=$Sec x=0 y=0 z=0
039   ||||$FShip -> set name to 'Task Force'
040   ||||$FShip -> add default items to ship
041   ||||$FShip -> set race logic control enabled to [FALSE]
042 @ ||||= $FShip -> call script '!ship.cmd.attack.std' :  the victim=$Target  do not follow in new sector=[TRUE]
043   ||||display subtitle text: text='Support incoming!' duration=400 ms
044   |||end
045   ||end
046   |end
047   end
048   return null
I had to add a line in there to stop Mammoths from spawning! :O I get all the ships I'd expect, but also tons of mammoths!? WHY!?


EDIT: I am aware of the End problem. :P

EDIT2: And still Mammoths. One of those dumb things somewhere I've overlooked, I know it!
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22438
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

EmperorJon wrote:Ok...

Code: Select all

else if $Type == 82
028   |$Ar =  get ship array: of race $Mil class/type=M3
029   |$Count =  size of array $Ar
030   |while $Count
031   ||dec $Count = 
032   ||$Ship = $Ar[$Count]
033   ||$Race = $Ship -> get maker race
034   ||if $Race == $Mil
035   |||$Rand =  = random value from 0 to 6 - 1
036   |||if $Rand < 3
037   ||||goto label Skipping
038   |||else if $Rand == 3
039   ||||$Multi = 1
040   |||else if $Rand == 4
041   ||||$Multi = 2
042   |||else if $Rand == 5
043   ||||$Multi = 3
044   ||||while $Multi
045   |||||dec $Multi = 
046   |||||$Ship =  create ship: type=$Ship owner=$Mil addto=$Sec x=0 y=0 z=0
047   |||||$Ship -> set name to 'Task Force'
048   |||||$Ship -> add default items to ship
049 @ |||||= $Ship -> call script '!ship.cmd.attack.std' :  the victim=$Target  do not follow in new sector=[TRUE]
050   |||||display subtitle text: text='Support incoming!' duration=400 ms
051   Skipping:
052   ||||end
053   |||end
054   ||end
055   |end
056   end
What would you expect that to do. And what would you say is wrong if I just get a Mammoth. -.-
Its because your using an object not a type
Your creating a ship of type $ship. But that is an object so its defaulting to type 0 as its not valid. Type 0 would be the mammoth

You need to get the ware type of the ship and use that Instead

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