[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 »

Just another little thing to consider,

Don't forget that if the ship that you are getting the onboard wares for is a TL, it just may have Stations onboard in the cargobay.

Oh, and one more, as the person using this script may have other scripts as well that may make non vanilla things possable, think about taking them into consideration as well. For example Apricotslices Mods allow you to have Ships in the cargobay (Beam ships aboard), just to name one, and Logain Industries PM V6 will allow you to have ships in the cargobay of a Carrier or TL, that makes 2 off the top of my head.
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Hm.


Anyway. It seems to be well and truley brokeded now... I'm not getting any final payout. It's registering the shipbase though, not sure about the ware money, I shot the idiot and he turned an PBGd me.


Been doing all my testing in the GE where the autopillock and attack scripts etc. don't seem to exist.

Then I was testing my weapon script and this simultaneously, shot some Pirate M3 and he turns round and discharges 1PBG, 1PBE, 3PAC, 2HEPT and an MD into me.

:evil: Why?


Anyway, prizes for the next person to spot a mistake... :roll:

Code: Select all

001   $Checks = [THIS] -> get local variable: name='ej.bounty.doublesig'
002   if $Checks != [TRUE]
003   |[THIS] -> set local variable: name='ej.bounty.doublesig' value=[TRUE]
004   |send incoming message 'Wow, it actually working' to player: display it=[TRUE]
005   |
006   |
007   |$Maintype = 8
008   |while $Maintype <= 16
009   ||$Maintype =  array alloc: size=0
010   ||$Subtypes =  get number of subtypes of maintype $MaintypeNumber
011   ||while $Subtypes
012   |||dec $Subtypes = 
013   |||$wareonboard =  get ware from maintype $Maintype and subtype $Subtypes
014   |||$Min = get min price of ware $wareonboard
015   |||$Amount = [THIS] -> get amount of ware $wareonboard in cargo bay
016   |||$Worth = $Amount * $Min
017   |||$Tot.OnboardWorth = $Tot.OnboardWorth + $Worth
018   |||$stringfinal =  convert number $Tot.OnboardWorth to string
019   |||send incoming message $stringfinal to player: display it=[TRUE]
020   ||end
021   ||inc $Maintype = 
022   |end
023   |
024   * Basic stats...
025   |$mil = get global variable: name='ej.player.which.military'
026   |if $mil != null
027   ||
028   ||$att = [THIS] -> get attacker
029   ||$race = [THIS] -> get owner race
030   ||$attrace = $att -> get owner race
031   ||$bounty = [THIS] -> get local variable: name='ej.bounty'
032   ||if $bounty == null
033   |||$bounty = 0
034   ||end
035   ||send incoming message 'Step1. Stats' to player: display it=[TRUE]
036   ||
037   * Multipliers for attackers.
038   ||
039   * All races x2 for X,K,Y and Enemy Race
040   * All races x2 for their Enemy
041   * All races x2 for Pirates except Teladi (x1)
042   * All races x0 for any other kills. You dont get paid for friendly fire!
043   ||
044   * If the players military, or the race of the attacker is...
045   ||
046   ||if $mil OR $attrace == Argon
047   |||if $race == Paranid OR $race == Pirates
048   ||||$multiplier = 2
049   |||else
050   ||||$multiplier = 0
051   |||end
052   |||
053   ||else if $mil OR $attrace == Boron
054   |||if $race == Split OR $race == Pirates
055   ||||$multiplier = 2
056   |||else
057   ||||$multiplier = 0
058   |||end
059   |||
060   ||else if $mil OR $attrace == Split
061   |||if $race == Boron OR $race == Pirates
062   ||||$multiplier = 2
063   |||else
064   ||||$multiplier = 0
065   |||end
066   |||
067   ||else if $mil OR $attrace == Paranid
068   |||if $race == Argon OR $race == Pirates
069   ||||$multiplier = 2
070   |||else
071   ||||$multiplier = 0
072   |||end
073   |||
074   ||else if $mil OR $attrace == Teladi
075   |||if $race == Pirates
076   ||||$multiplier = 1
077   |||else
078   ||||$multiplier = 0
079   |||end
080   |||
081   * If the the race of the attacker is... (player cant join mil. for these races)
082   |||
083   ||else if $attrace == Yaki
084   |||$multiplier = 2
085   |||
086   ||else if $attrace == Terran
087   |||$multiplier = 0
088   |||
089   ||else if $attrace == ATF
090   |||$multiplier = 0
091   |||
092   ||else if $attrace == Pirates
093   |||if $race == Teladi
094   ||||$multiplier = 1
095   |||else
096   ||||$multiplier = 2
097   |||end
098   |||
099   ||else if $attrace == Enemy Race
100   |||$multiplier = 2
101   |||
102   ||else if $attrace == Kha'ak
103   |||$multiplier = 2
104   |||
105   ||else if $attrace == Xenon
106   |||$multiplier = 2
107   |||
108   ||else
109   |||send incoming message 'Unknown military or race as killer, may cause problems.' to player: display it=[TRUE]
110   ||end
111   ||
112   * If the killed ship is X,K,Y or ER, it x2 to the killer to overide x0s above!
113   ||
114   ||if $race == Xenon OR $race == Kha'ak OR $race == Yaki OR $race == Enemy Race
115   |||$multiplier = 2
116   ||end
117   ||
118   ||send incoming message 'Step2. Multis' to player: display it=[TRUE]
119   * Works out worth of ship.
120   ||
121   ||send incoming message 'Shipbasebit?' to player: display it=[TRUE]
122   ||$waretype = [THIS] -> get ware type code of object
123   ||$shipcost = get average price of ware $waretype
124   ||$shipbase = $shipcost / 5
125   ||$stringfinal =  convert number $shipbase to string
126   ||send incoming message $stringfinal to player: display it=[TRUE]
127   ||
128   ||send incoming message 'Step3. Values' to player: display it=[TRUE]
129   ||
130   * Works out worth of ships items plus the base ship cost
131   ||$finalworth = $Tot.OnboardWorth + $shipbase
132   ||
133   * Player is killer - recieves previous bounties plus worth, affected by a Xplier.
134   ||if $attrace == Player
135   |||$finalpayout = ( $bounty + $finalworth ) * $multiplier
136   |||add money to player: $finalpayout
137   |||$stringfinal =  convert number $finalpayout to string
138   |||send incoming message $stringfinal to player: display it=[TRUE]
139   |||
140   * Player isnt killer - killer gets worth added to its bounty, which is now found.
141   ||else if $attrace != Player
142   |||$bounty = $att -> get local variable: name='ej.bounty'
143   |||if $bounty == null
144   ||||$bounty = 0
145   ||||$bounty = ( $bounty + $finalworth ) * $multiplier
146   ||||$att -> set local variable: name='ej.bounty' value=$bounty
147   |||end
148   ||end
149   |end
150   end
151   
152   * Notes
153   
154   * Killed ships belonging to player pass the item & ship worth on when killed.
155   * As you, the pilot, is not dead, theres no bounty.
156   
157   * Bounties betweem race doesnt matter.
158   * EG. Pirate kills Xenon, Player as Argon mil. kills Pirate.
159   * Bounty passed on contains a Xenon kill by the pirate.
160   * Surely thats good for the military!? No. Reasoning as such:
161   * Pirate survives Xenon attack, is obviously skilled & a threat therefore.
162   * Pirate -> Xenon bounty is passed on to the player.
163   * Lets say the multiplier has made it huge, Pirates killing Boron.
164   return null
______
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 »

This
009 ||$Maintype = array alloc: size=0
get rid of it
-------------------------------
This
010 ||$Subtypes = get number of subtypes of maintype $MaintypeNumber
change to

Code: Select all

010   ||$Subtypes =  get number of subtypes of maintype $Maintype 
-------------------------------
This
014 |||$Min = get min price of ware $wareonboard
015 |||$Amount = [THIS] -> get amount of ware $wareonboard in cargo bay
016 |||$Worth = $Amount * $Min
017 |||$Tot.OnboardWorth = $Tot.OnboardWorth + $Worth
018 |||$stringfinal = convert number $Tot.OnboardWorth to string
019 |||send incoming message $stringfinal to player: display it=[TRUE]
020 ||end
change to

Code: Select all

014   |||$Amount = [THIS] -> get amount of ware $wareonboard in cargo bay
015   |||If $Amount > 0 
016   |||$Min = get min price of ware $wareonboard 
017   ||||$Worth = $Amount * $Min 
018   ||||$Tot.OnboardWorth = $Tot.OnboardWorth + $Worth 
019   ||||$stringfinal =  convert number $Tot.OnboardWorth to string 
020   ||||send incoming message $stringfinal to player: display it=[TRUE] 
021   |||end 
022   ||end 
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

get rid of it
I thought I had! :oops:
change to
Same!? :?
change to
Now I didn't do that...


Hm, seems I was halfway through doing half this stuff with the script open when I died so it didn't save fully. :lol:
______
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 »

$MaintypeNumber
not same as
$Maintype
!!!
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

I wasn't saying 'it's the same'

I was saying 'I though I got rid of that too!'

:lol:
______
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 »

Anyway, prizes for the next person to spot a mistake...
Prize please :P
X 3 :D
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

______
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 »

My weapon script is really working well now (Not M3s, all ships, and all turrets!), but has a tendancy to fill M2s with weaponry. Whilst this'd be good when you killed them, I'd rather it not happen. :lol:

So I've hit a problem, I need to come up with an efficient way of only giving it some stuff... putting a limit on, but making a sure it's turrets are full. And that it doesn't fill an M2s turrets with ISR and CIG. :evil:
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
dillpickle
Posts: 1159
Joined: Mon, 3. Nov 08, 14:25
x3tc

Post by dillpickle »

I'm having a bit of a problem with custom station names, or docks to be more precise.

In the 0001-L044.xml file, I have added to page id 17:

Code: Select all

<t id="85000">{1000,120} {1000,50203} {17,16041} (ATF Military Shipyard)</t>
<t id="85012">{1000,120} {1000,50203} {17,6161} (ATF Military Headquarters)</t>
In my map file, I have added a Shipyard, and set n="85000", which displays the name 'ATF Military Shipyard' on the targeted item on the HUD, and on the sector map. Also Betty announces it correctly, and it displays correctly in the subtitles.

Likewise I have added a Military Base, and set n="85012".
However... Although Betty speaks the correct name, and the text is correct in the subtitles, the HUD and sector map display '{1000,120} {1000,50203} {17,6161}'.

This just appears to be a problem with Docks, as factories and ships all display correctly when named this way.

Any thoughts on what is causing this? Or more importantly how to solve it?
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Hmm. No idea! But I've learnt something.

You can get the autopilot to name something if you string up words it knows?

So ATF Military Shipyard? It thinks, ATF, I know that... etc.?

If so, nice!
______
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 »

After having answered so many questions, I have one of my own:

How can I raise a SIGNAL_DOCKED by myself?
I'm asking, because a custom docking computer script of mine, doesn't raise SIGNAL_DOCKED, because it has to work with:
$ship -> put into environment $station

Is there a way to use "send signal" for this purpose? Nothing I tried worked until now.

I'd be really glad, if someone knew the answer to this question.
Greetings,
ScRaT
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22438
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

you can send signals. Theres a send signal command which basically mimics the signal on the ship. Just make sure ur sending the correct arguments and it should work.

however, there are certain problems you need to be aware of. In some cases, the put into environment command needs to halt the script stack for it to function correctly. This basically means that anything after the command could be ignored as the script will be terminated. This is mainly the case for the players ship, but can happen on others as well

for safety you can create another global script to do it for you

Code: Select all

START $null -> call script 'put.in.environment' ship=$ship, station=$station

while not $ship -> is docked
  = wait 1000ms
end
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

Ah, thanks, then I'll try again with the "send signal" command.
however, there are certain problems you need to be aware of. In some cases, the put into environment command needs to halt the script stack for it to function correctly. This basically means that anything after the command could be ignored as the script will be terminated. This is mainly the case for the players ship, but can happen on others as well
That's good to know. Until now it seemed to work fine for me, but it's always better to be on the safe side.

Greetings,
ScRaT

EDIT: Thanks, Cycrow!
It works like a charm.
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Can someone just give me super-quick runthrough of script start names and their effects?

init, reinit, setup, I don't know what I want for what at the moment...
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

If you read the MSCI hand book on page.... hrm... interesting 11/123

init
setup
al plugin
galaxy ship init


The handbook has decent descriptions of them all.
Basically, most script packages use setups. (The only reason to use an init specifically, is if you need to do something PRIOR - and presumably you have a reason for not modifying the setup directly)
al plugins are for things that you want to run continuously in the background (e.g. race response fleets, mostly AI stuff, or people who want to use the yes/no al menu)
galaxy ship init's are for custom map starts, to give you a specific starting ship(s) and stations
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Which MSCI handbook?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 25130
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus »

Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

:thumb_up:
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

dillpickle wrote:In the 0001-L044.xml file, I have added to page id 17:

Code: Select all

<t id="85000">{1000,120} {1000,50203} {17,16041} (ATF Military Shipyard)</t>
<t id="85012">{1000,120} {1000,50203} {17,6161} (ATF Military Headquarters)</t>
I'd like to comment off your issue. Both for you as it appears from your wording that you are committing a big no no, and for anyone reading who is considering modding.

Dont modify 0001-L0?? files.

That text file gets changed every single patch to the game, and we have another patch in the pipeline. If you ever distribute this file, it will likely cause chaos in peoples games after a new patch.

Go to the documentation sticky, find a number that isnt being used, request it for your use, then create a blank text file with that name, and add your stuff in there. You also need a small setup script to add the text file to the game on startup (nickable from any mod or script pack, just change the number).

Thereafter, all changes you make to the game are unique to your file, and should never cause problems with either the game 0001 file and patches, or any other mod or script pack.

Another reason for creating your own file is that 0001 is huge, and you can lose your own stuff in there easily. Your own file will be small and everything in it is yours. The other issue is distribution, why include a huge file when you can include a small one.

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