[Discussion] Generic X3TC S&M questions I

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

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

Post by ThisIsHarsh » Fri, 3. Jul 09, 00:52

s9ilent wrote:You could also try
<RetVar> = get station array: product=<Var/Ware> include empty=<Var/Boolean>
<RetVar> = get station array: resource=<Var/Ware> include empty=<Var/Boolean>
But... I'm not to sure if tradedocks (pirate stations) use command software as secondary resources, or not, nor do I know if it will respond to these commands. (Although, presumably it should work with the get resources command)
How the heck did I miss these! 'get station array: resource' does the trick, cheers!

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

Post by s9ilent » Fri, 3. Jul 09, 03:06

I need help with a script
http://members.optuszoo.com.au/whyistha ... actual.xml

On that script, this part
Is not returning... And I'm not to sure why..
It infinite loops :S (There are waits, so it doesn't hang)

The scripts purpose is to check a sector for all enemies, and it does this by calling the other script. I've checked the loops, and the subs, and they seem fine :S

Help me Obi won kenobi, your my only hope :'(
(Or Help me LV, in case your that way inclined)

073 * Check all sectors against the rules
074 $max.y = = get max sectors in y direction
075 while $max.y > 0
076 |dec $max.y =
077 |$max.x = = get max sectors in x direction
078 |while $max.x > 0
079 ||dec $max.x =
080 ||
081 ||$sect = get sector from universe index: x=$max.x, y=$max.y
082 ||skip if $sect -> exists
083 |||continue
084 ||skip if $sect -> is sector known by the player
085 |||continue
086 ||
087 ||* Exclude sectors not watched by the player, they act "funky"
088 ||* The find shps command requirs an "ocupied" sector to function correctly
089 ||* Check for shps operating in sector, restart their commands
090 ||@ = [THIS] -> call script 'plugin.sfm.ship.bl.all' : Sector=$sect
091 ||
092 ||@ = wait 3 ms
093 |end
094 end

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

Post by ThisIsHarsh » Fri, 3. Jul 09, 03:57

s9ilent wrote:I need help with a script
http://members.optuszoo.com.au/whyistha ... actual.xml

On that script, this part
Is not returning... And I'm not to sure why..
It infinite loops :S (There are waits, so it doesn't hang)

The scripts purpose is to check a sector for all enemies, and it does this by calling the other script. I've checked the loops, and the subs, and they seem fine :S

Help me Obi won kenobi, your my only hope :'(
(Or Help me LV, in case your that way inclined)
Edit: plugin.sfm.ship.bl.all.xml: best to put all sub routines at the bottom of your script after the final return statement. Though not sure if that is the cause of your problem or not. I would imagine having an endsub in the middle of your main script has some wierd behaviour associated with it.

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan » Fri, 3. Jul 09, 10:44

@s9ilent - the loop code looks fine to me. Getting stuck in the call? Comment it out to see.

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

Post by s9ilent » Fri, 3. Jul 09, 13:08

I have commented it out, and its in that call somewhere. I think thisisharsh is probably correct, in that it is probably the sub

But in any case, :( Game over man, game over!
(Refer to my So long and thanks for all the fish post, might not be up yet thou)






Oki doke, in lieu of writing a new post in this forum saying 'So long and thanks for all the fish.' I figure I've already made more then enough reply posts, filling up the greater portion of the top half of the forum with my stuff.. So I'll just put my goodbyes in here.
I'm off. RL stuff :( You know when you get that feeling that your spending too much time on the computer and that your studies are falling behind? No? Yes? Well that feeling past a long time ago, so I figure "It's time to go... computer games" :L :(

Any way, so... of all the stuff I was working on, I put up what I've done so far, and hopefully someone else can finish my work. Else, feel free to pilfer, plunder, steal, borrow, seek inspiration from, gain insight, or other wise use the stuff I've put up.

And if you have any questions about them, them as per usue, put it in the relevant thread, Ill peek in on it from time to time. (Where interarival time follows an exp dist, with param = the number of days from this post, till today -where today is your today today, not my posting today)

So any way, If I could spell correctly, I'd say Areviderchi, Bon Voyage, and Fare well. And of course



So long and thanks for all the fish.
The ironically not so silent s9ilent




Oh yes, one last thing... (Another project I can not finish)
I did plan on making a Freespace 2 mod -> x3tc. Lilith unwrap can port the models. You just have to recreate the mat6 entries. Similarly, you have to do the turrets/weapons/cockpit scenes. Otherwise, its a rather simply procedure to convert the ships to x3tc. (I only really ported the Orion destroyer, w/out weapons nor ship data). But yeh, I did get the greenlight from the guys over at the FSU page, so if any one else is interested (as per usue, just put recognition in the credits somewhere)
http://www.hard-light.net/forums/index. ... 772.0.html
Oh yeh, and I used gimp + addon, to look at the textures, but they should all already be in dds.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Fri, 3. Jul 09, 17:12

yeah you gosub is wrong, it will not work as u had planned it.


gosubs are usually at the bottom, after all your code, u shouldn't really go into a sub without jumping to it first, and the end sub would then get confused and dont know where to jump back to.

if you want to jump to different points, then u can use gosub instead.

if it was me doing that script, i would split it into 2 scripts.

then just call the script twice with the required arguments


also, this command doesn't make sense
044 ||||$pos == array alloc: size=$bl.timer
045 ||||dec $pos=
i think u mean get array size, not array alloc ?
what thats doing is setting $pos as a newly created array with $bl.timer elements
then trying to dec an array,which wouldn't work

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Fri, 3. Jul 09, 17:29

s9ilent wrote:The only issue with re-writing stock scripts is that some people use custom scripts, so it still might be beneficial to use sec signals for player ships, as they could be using non standard scripts.

Edit
01/07/09

Just another question cycrow/others

When does the signal_damaged and signal_aborted fire?
And what arguments do they use (or given the recent tidbit about arguments, how many?)
SIGNAL_DAMAGED is called from SIGNAL_ATTACKED, but only when theres no shields

SIGNAL_ABORT is not actually used, its never called

pelador
Posts: 1399
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by pelador » Fri, 3. Jul 09, 17:32

Is there any way for the SE to recognise wether a passenger on board your ship is a plot character.

I cant see a deliberate function for it or another one that would identify by characteristics if the passenger is plot. So other than managing an array of names which doesnt seem sensible to me I was hoping there might be a less than obvious way of doing it.

Would the check to see is invulnerable apply to passenger objects?

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

Post by ScRaT_GER » Fri, 3. Jul 09, 17:51

I've a small question on how prices, when selling ships in a shipyard, are calculated.

I tested a few things and got the following results:

1. There is a "base" value, which seems to be always about 56% of the buying price.
Say you buy a Paranid TS (S) it would cost, without the single 1 MJ shield, 497,435 cr.
When you sell it, completely empty, you'll get 271,090 cr, which is about 56.5 % of the buying price.
With a Paranid TP the percentage is about 56.1%.

Can a script get these values (the price) somehow?
Or do they even differ for different shipyards?

2. As far as I could see the wares the ship has preinstalled when buying it, cost the average price extra. When selling it, you'll get the minimum price. Is that true (for every ware)?

My last question: Is there a fast way, to get the ships hard- and software as an array? "get tradable ware array for ship" only gets you the tradable wares, "get hardware array for" doesn't return anything (?) and checking every ware by main- and subtype is quite a long procedure.

Greets,
ScRaT

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Fri, 3. Jul 09, 17:58

i made a library to get all the installed upgrades, which includes lasers, shields and equipment.

its not that difficult to get them really, as all upgrades are tech wares, so u simply loop through all tech wares.

the price u get when selling is usually half the buy price of everything on the ship.


get tradeable ware array gets the array of everything thats not being used and can be traded.

get hardware array is a job command, it returns the hardware thats been set in the jobs engine, usually used for the tech traders

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

Post by ThisIsHarsh » Sat, 4. Jul 09, 05:03

Does anyone know of a food ware that can be bought/sold in all race sectors? I.e. a food that all races eat. Preferably purchasable from all races, but I would settle for only sellable to all races if necessary.

User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by LV » Sun, 5. Jul 09, 09:28

there is no food i know of that crosses across races, the only things that spring to mind are the tech wares, ores and energy

someone else
Posts: 2972
Joined: Sun, 18. Jun 06, 13:37
x3tc

Post by someone else » Sun, 5. Jul 09, 21:29

simple question: how can I play a sound file of an effect from a Mission Director "script"?

why I'm asking: because it is the only way I can think of to add new voices for plot charachters (of a new plot) to the game in a easy and modular way.

My Plan:
Record my voice (cool and sexy 8)),
save it as a 20XX.wav and put it into "s" folder
make the MD play the right file when the plot charachter must speak.
then conquer the world.

is that doable or not? I quickly read trough the Reunion MD manual and a couple of threads on MD, but no answer... :?
Trade, Fight, Build, Think, Modify.
Ship Rebalance Mod
OOS Rebalance
Resized Aldrin Big Rock
SIDE/TOP/FRONT Ship Size Comparison
Remember young Padawan: money stolen can be, time cannot.

User avatar
Aro
Posts: 2765
Joined: Tue, 15. Jul 03, 00:35
x4

Post by Aro » Tue, 7. Jul 09, 05:15

You'd probably have to just try to play the audio file to see, from reading director files it could work. Wondering about it myself.
Forgot to add, check these out:
<play_music music=""
<play_sound


Was poking around and saw this:
<set_headquarters_upgrades upgrades="" ...
Could this add stuff like jumpdrives and such?

Osiris_sam
Posts: 422
Joined: Thu, 24. Aug 06, 13:45
x4

Post by Osiris_sam » Tue, 7. Jul 09, 21:05

The command:
<retvar> = <refobj> -> get resupply fuel required

what exactly does it return?
is it the amount required for the autojump resupply range of the refobj?

or is it the amount required amount - the amount in the cargo bay of the <refobj>

(my script using it keeps outputting -ve numbers to the debug file, and now im confused)

thanks


EDIT: Thanks Cycrow
Upon closer insepction i found my ship had some energy cells on board, the amount that was -ve in fact. thus this command must be returning 0... which is itself confusing
Last edited by Osiris_sam on Tue, 7. Jul 09, 21:47, edited 1 time in total.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Tue, 7. Jul 09, 21:22

it should return the same value thats displayed in the menu for fuel resupply.

also remember that fuel resupply and autojump are completly seperate things

Osiris_sam
Posts: 422
Joined: Thu, 24. Aug 06, 13:45
x4

Post by Osiris_sam » Thu, 9. Jul 09, 02:42

Trade Commands;
the Find station commands on the trade menu, in particular the ones which go like

<retvar/if> = (<refobj> ->) find station: Product <ware> ...

will they find trade docks/eq docks/other kinds of docks, which will buy that ware? or do i need to script that eventuality in (for tech wares, e.g. weapons, shields etc)?

note: to Cycrow.
the command i queried about before return the amount that is needed to fuel jumps within the jumprange set, taking into account ecells in the hold already. Not exactly what i needed, so i wrote i library to do what i wanted... thanks for your (as always) quick response though :)

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

Post by s9ilent » Thu, 9. Jul 09, 08:02

@ Osiris_sam
No they will not include trade docks for missiles/weapons/lasers.

So you will have to use a sideways solution to the issue. I just use a search for navigation command software. You could probably also just do a search for stations of the dock class too.

Osiris_sam
Posts: 422
Joined: Thu, 24. Aug 06, 13:45
x4

Post by Osiris_sam » Thu, 9. Jul 09, 12:38

k thanks, didnt think they did...
you'd think there would be a command

<retvar> = find dock buys: ware ...

:( oh well

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

Post by ThisIsHarsh » Fri, 10. Jul 09, 01:11

Anyone know if you can override the stock command->script mappings? I'm trying to override a stock command to link to my own script instead of the one in the !init.ship.globalsciptmap scripts, but when I run it on a ship it still runs the old version. I've tried adding a wait of 1ms at the top of my setup script in the hopes it will re-register it after registering in the !init scripts, but to no avail...

Locked

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