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

I've got another question on signals, this time concerning SIGNAL_REQUESTUNDOCK.

How is this signal raised? Is it send by the ship, which requests to dock? Or is it send by the dock? Or does all this happen implicitly when "fly to station" is used to dock at a station, which is "full"?
Additionally, if I want to send the signal, which arguments do I have to use?

I'm asking, because I coulnd't find any script that actually sends the signal.

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

Post by EmperorJon »

Hmm, wondered about that one myself.
______
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 »

AFAIK, When a fighter on a carrier undocks, it sends the request to undock to the carrier. Thou I have not really played with this signal my self. I believe the purpose of this is to prevent the carrier doing things when ships are launching.

I also think that if you have a fighter in a carrier in a station, I believe that when the fighter tries to undock, it sends that signal to the carrier, which then undocks it self, lets the fighter out, and redocks it self (with the stock scripts) thou I'm not 100% sure on that.
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

No, the purpose of the signal is the following:
When a ship tries to dock a station where all docking clamps are occupied, SIGNAL_REQUESTUNDOCK is called on the ship, which is docked the longest. This ship then undocks and flies around in space for some seconds and then redocks (have a look at !ship.signal.requestundock).

And my question is, how I can raise the signal by myself. Sending it doesn't work, because I don't know the arguments and until now I wasn't able to "provoke" it (e.g. by trying to dock to a "full" station).

Greetings,
ScRaT

EDIT: I don't know why it didn't work yesterday, but now it works. When I try to dock at a "full" station the signal is raised on one ship.
There are no arguments passed to the script, which is called by SINGAL_REQUESTUNDOCK.
"fly to station" seems to be the command, who raises the signal.
dillpickle
Posts: 1159
Joined: Mon, 3. Nov 08, 14:25
x3tc

Post by dillpickle »

apricotslice wrote: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.
Thanks for the advice - I had actually realised this shortly after posting and have now put all my stuff in a separate text file.


Anyhow, on to today's problem...
If someone could tell me why this isn't working I'd be grateful.

Code: Select all

<condition>
  <check_all>
    <object_is_docked dockobject="DPL2M06.KE Military Outpost"/>
    <!--<match_object class="tp"/>-->
  </check_all>
</condition>
<action>
  <do_all>
    <do_choose>
      <do_when value="{player.ship.isclass.tp}" exact="0">
        <play_text actor="DPL2M06.Tata Na" face="205" pageid="210" textid="907" priority="99"/>
        <incoming_message author="{DPL2M06.Tata Na}" text="{7351,385104}"/> 
      </do_when>
      <do_otherwise>
        <set_actor_location actor="DPL2M06.Tata Na" object="{player.ship}" location="passenger"/>
        <play_text actor="DPL2M06.Tata Na" face="205" pageid="210" textid="900" priority="99"/>
        <incoming_message author="{DPL2M06.Tata Na}" text="{7351,385105}"/>
      </do_otherwise>
    </do_choose>
  </do_all>
</action>
With the code above, if I dock in a class of ship other than a TP, then the correct message from the <do_when> portion plays correctly.
If I dock in a TP, then nothing happens, and Tata Na stays where he is.

Un-commenting the <match_object class="TP"/> switches things around - dock in a TP and the correct message plays, and Tata Na gets on board. Dock in any other class of ship and nothing happens.

The way I see it in this case, is the <do_choose> is a simple 'either' / 'or', except I'm getting no 'or'!!!
Help...
User avatar
Ketraar
EGOSOFT
EGOSOFT
Posts: 12187
Joined: Fri, 21. May 04, 17:15
x4

Post by Ketraar »

Code seams correct.

Still, do not match class in conditions, makes the do_choose pointless. It will only trigger when you're in a TP so the "choose" will never happen.

Without the match class, do you dock in same "go"? As I don't see any resets you only can test this once per load. (just making sure).

Can't see any other issue in this portion of code.

MFG

Ketraar

PS.: in author, change to {actor.name@DPL2M06.Tata Na} to get the name displayed.
Image
dillpickle
Posts: 1159
Joined: Mon, 3. Nov 08, 14:25
x3tc

Post by dillpickle »

Ketraar wrote:As I don't see any resets ....
A reset was what it needed. Added one in on un-docking, everything now working correctly.

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

Post by EmperorJon »

Yes. It's me, I'm back, and my infamous bounty script is here too...


I've managed to get it to infinite loop whilst editing it and saving accidentally, and although I'm pretty sure I can easily fix it I'm just wondering about any outstanding problems generally with it that anyone else can once again notice. Still don't think I've got the ware counting right.

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

Post by ThisIsHarsh »

EmperorJon wrote:Yes. It's me, I'm back, and my infamous bounty script is here too...

I've managed to get it to infinite loop whilst editing it and saving accidentally, and although I'm pretty sure I can easily fix it I'm just wondering about any outstanding problems generally with it that anyone else can once again notice. Still don't think I've got the ware counting right.
You need to do "$Tot.OnboardWorth = 0" before the first loop (e.g. line 6), otherwise the uninitialised $Tot.OnboardWorth defaults to null, and null+anything=null, I think.

You also need to "inc $Maintype" between lines 19 and 20, that's where you got an infinite loop.

Lines 29-31 - if $bounty is null you probably want to set the local variable as well as $bounty, i.e. between lines 31 and 32 put "[THIS]->set local variable: name='ej.bounty' value=$bounty".

Line 123 and 135: you rarely (if ever?) need to convert a number to a string, X3TC can generally convert to a string on the fly as necessary.
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.
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

Can anyone give me a quick guide (or link to previous guide/mod) to selectively removing *all* of the non-plot missions?

My hangup is that I don't like missions that are not derived from the current game state or at least change the current game state.

E.g. station defense mission - where a bunch of enemies are conveniently spawned from nowhere as soon as you accept the mission, makes no sense.

Something like e.g. a station build mission makes more sense, because it has a continuing influence on the state of the game.

I would love a list of the second category of mission, that actually are derived from, or have influence on, the game state.

With or without that list, I would appreciate a quick guide to removing all the 'random' style missions I mention I don't like.

Cheers for any help with this.
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.
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

Removing the missions should be as simple as editing out all the commands in the main director files. As long as the mission file runs properly but doesnt do anything, it should work. So extract all the director files, choose the ones you dont want, and snip. Then put them in a new cat/dat, or live in the directory under tc.

You cant just delete the files (which should work), unless you delete every version in every cat/dat. But if you deleted all of them, that should remove them from the game.
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

apricotslice wrote:Removing the missions should be as simple as editing out all the commands in the main director files. As long as the mission file runs properly but doesnt do anything, it should work. So extract all the director files, choose the ones you dont want, and snip. Then put them in a new cat/dat, or live in the directory under tc.

You cant just delete the files (which should work), unless you delete every version in every cat/dat. But if you deleted all of them, that should remove them from the game.
OK, thank for this. I'll have a go at it asap. Any clue as to what numbered cat/dat files I should start looking for Director files? I would imagine there are no Director files in 01.dat, or maybe there are?

Also, is it easy enough to know what each mission is about by simply looking at the filename or first few lines in the code?
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.
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

Unpack all the cat/dats into separate directories. A lot of them have been constantly tinkered with, but some may not have.

Then I'd make a work directory, and copy them in, in ascending cat/dat number order. That will ensure you get them all.

The names are pretty good. The numbers in the names have a structural order to them, so you only need to identify the main files that start each type of mission and ignore the rest.
dillpickle
Posts: 1159
Joined: Mon, 3. Nov 08, 14:25
x3tc

Post by dillpickle »

If you want to keep the plot missions, then you will need to be very careful about which missions you remove, as they use a lot of them as libraries.
For example the Goner plot will use the deliver wares, deliver matching ship, build station, and defend object, amongst others.

Looking at the director files, it appears there is an easy way to solve your problem.
The 3.01 Generic Mission File contains triggers for all the station offered missions, if you open it up, you will see that some missions are already commented out.
Commenting out the mission types you don't want to run, and their respective 'set value' will stop the mission being offered.
Add your altered 3.01 Generic Mission File to a director folder in the X3TC directory, and you should only see the mission types you want.
If at a later date you decide you want 'x' mission types again, simply uncomment the relevant mission.
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

@TiH, thanks for your help.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
Ketraar
EGOSOFT
EGOSOFT
Posts: 12187
Joined: Fri, 21. May 04, 17:15
x4

Post by Ketraar »

To remove any MD vanilla file related mission simply open the mdfiles.txt and delete the name of related file. This will prevent it to be loaded, hence its no longer available ingame.

As stated above
This will break several Plots, most use the Generic mission

MFG

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

Post by ThisIsHarsh »

Wow, thanks for the responses peeps.

@dillpickle: your solution sounds 'safest' with regard plot missions, so I'll give it a go.
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.
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

Ketraar wrote:To remove any MD vanilla file related mission simply open the mdfiles.txt and delete the name of related file. This will prevent it to be loaded, hence its no longer available ingame.
So does that mean that to add a new md file, you need to add it into mdfiles.txt for it to run ?
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

So does that mean that to add a new md file, you need to add it into mdfiles.txt for it to run ?
No, definetely not. I guess it's only for the vanilla files to be loaded, when the game is still unmodified.

Greetings,
ScRaT
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

I'm just wondering why I've never been able to get a new md file to run.

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