Code help!
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 452
- Joined: Mon, 7. May 07, 05:17
Code help!
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!
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!
-
- Posts: 2239
- Joined: Wed, 4. Jun 08, 22:30
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':
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
I guess one possibility is to look at this 'if':
Code: Select all
<do_if value="typeof $OfferLocation == datatype.componentslot">
<!-- .... -->
</do_if>
Anyway good luck with this, your conquer mod is awesome

-
- Posts: 452
- Joined: Mon, 7. May 07, 05:17
Thanks mate!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':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?Code: Select all
<do_if value="typeof $OfferLocation == datatype.componentslot"> <!-- .... --> </do_if>
Anyway good luck with this, your conquer mod is awesome
I will try it asap and will return here to let you know if it worked.

-
- Posts: 452
- Joined: Mon, 7. May 07, 05:17
Didn´t work.
I try this as GenericMissions.xml:
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.


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>


-
- Posts: 2239
- Joined: Wed, 4. Jun 08, 22:30
-
- Posts: 452
- Joined: Mon, 7. May 07, 05:17
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.
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.

-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
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...
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
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

-
- Posts: 452
- Joined: Mon, 7. May 07, 05:17
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?
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?
-
- Posts: 2239
- Joined: Wed, 4. Jun 08, 22:30
OK - I've got something 
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...

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>
-
- Posts: 452
- Joined: Mon, 7. May 07, 05:17
Yeah! it Works!
I tested your code just changing ths:
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...
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!
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>
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...


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!
-
- Posts: 2239
- Joined: Wed, 4. Jun 08, 22:30