Code help!

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Code help!

Post by Rubini »

Hi mates,

I need to block/not allow a station to have missions connected to it. If I'm not wrong, missions slots are attached to stations modules. Ok, but will be not a good idea to delete these slots because a module can be used by more than one station. So, do you know if we have a "command" to remove/or not allow mission from /for a station?

Situation: on Conquer mod we have an full automated small station, the outpost. Outposts don't have humans inside, so don't make sense have missions attached to this type of station.

Thanks in any advice!
User avatar
MegaJohnny
Posts: 2239
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny »

I don't know if there's a quick command for it, but take a look at md.GenericMissions.OfferInSpace, that's one bit of code that all mission offers have to go through.

I guess one possibility is to look at this 'if':

Code: Select all

<do_if value="typeof $OfferLocation == datatype.componentslot">
  <!-- .... -->
</do_if>
You could insert some code directly before that to set $OfferLocation to null if the station is an outpost. It feels a bit hacky but I think it would work?

Anyway good luck with this, your conquer mod is awesome :D
Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini »

MegaJohnny wrote:I don't know if there's a quick command for it, but take a look at md.GenericMissions.OfferInSpace, that's one bit of code that all mission offers have to go through.

I guess one possibility is to look at this 'if':

Code: Select all

<do_if value="typeof $OfferLocation == datatype.componentslot">
  <!-- .... -->
</do_if>
You could insert some code directly before that to set $OfferLocation to null if the station is an outpost. It feels a bit hacky but I think it would work?

Anyway good luck with this, your conquer mod is awesome :D
Thanks mate!
I will try it asap and will return here to let you know if it worked.
:wink:
Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini »

Didn´t work. :(

I try this as GenericMissions.xml:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<add sel="/mdscript/cues/library[@name='OfferInSpace']/actions/set_value" pos="before">
		<write_to_logbook category="general" text="'=== GM OUTPOST debug === \n Station: %1 \n OfferLoc: %2 '.[@$Station.macro, @$OfferLocation.container.macro]"/>
		<do_if value="@$Station.macro == macro.struct_bt_alb_warehouse_macro or @$OfferLocation.container.macro == macro.struct_bt_alb_warehouse_macro">
            <set_value name="$Station" exact="null"/>
            <set_value name="$OfferLocation" exact="null"/>
		</do_if>
	</add>
</diff>
The mission icons on the Oupost and the missions itself continues there, neither the logbook message was wrote, so it even don´t flow at this place. :?: :?:
User avatar
MegaJohnny
Posts: 2239
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny »

Hmm... I can't see why it wouldn't either. I even checked the XPath you wrote with a tester, and it gets the right element no problem. Definitely nothing in the debug log?

I'll have a look at this (using some other criteria to test with) and let you know if I get anything that works :)
Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini »

Thanks mate to look at it!
No messages on debug log. I also looked at GenericMissions.xml a lot and found nothing more relevant. The interesting is that the message don´t appears on logbook, so definitively it is not passing by this library "OfferInSpace" to generate the missions on an station component/module. :?:
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

if the availability of Missions depends on wheter there are free Mission actor Slots what about filling them up with invisible Xenon NPCs?

alternatively maybe create a new "Mission Type" which fills up all available Offer Slots, has an invisible Icon and does nothing if selected by accident..

just two ideas, didnt look into the details how this stuff works...
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 ;)
Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini »

Hi UniTrader,
I tried to fill them with fake missions or fake offers but didn't work, but probably because I did something wrong. Anyhow, I liked the idea to put there a xenon npc. This works to ships and stations crew. Do you have an idea how I can put these xenon npc on freemission actor slot? Will the code accept it?
User avatar
MegaJohnny
Posts: 2239
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny »

OK - I've got something :)

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
    <!--
    <add sel="//do_if[@value='typeof $OfferLocation == datatype.componentslot']" pos="before">
        <show_help custom="'Hello from OfferInSpace'" force="true" />
    </add>
    -->
    <add sel="//do_if[@value='typeof $OfferLocation == datatype.componentslot']" pos="before">
        <do_if value="$Station.owner == faction.jonferson">
            <show_help custom="'Blocking missions on JSS stations'" force="true" />
            <set_value name="$OfferLocation" exact="null" />
        </do_if>
    </add>
</diff>
This stops missions appearing on JSS stations. That help text pops up when I enter a zone with a JSS station, which implies it is passing by that code, and I didn't find any missions on those stations. I'm still puzzled by what could be wrong with your code, but my guess is the XPath is doing something we didn't expect...
Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini »

Yeah! it Works!

I tested your code just changing ths:

Code: Select all

<add sel="//do_if[@value='typeof $OfferLocation == datatype.componentslot']" pos="before"> 
        <!--<do_if value="$Station.owner == faction.jonferson">-->
		<do_if value="$Station.macro == macro.struct_bt_alb_warehouse_macro"> 
            <show_help custom="'Blocking missions on JSS stations'" force="true" /> 
            <set_value name="$OfferLocation" exact="null" /> 
        </do_if> 
    </add> 
And its worked as intend.
Then tested my first code from yesterday and it also worked!??
The trick: it just dont work for stations that are already on playerzone when game was loaded. And yesterday I, in any moment, changed zones... :shock: :D
When I return to the zone where the game loaded it works too, no more icons or missions in that Outpost!
Very good! Thanks mate!
User avatar
MegaJohnny
Posts: 2239
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny »

Ah, what a pain - glad I could help. :wink:

Return to “X Rebirth - Scripts and Modding”