Free Trade Zone OXP

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Post by Mauiby de Fug »

It would appear that if one is a Fugitive, docking at a FTZ actually reduces your legal status to Offender!

One consequence of this is that after one survives a sortie with the Thargoids as a reserve for the Galactic Navy (in the oxp of the same name), and then detonates an Energy Bomb to clear up all the little Thargoid Robot Fighters, and, somewhat less sportingly, a whole bunch of your former Navy comrades as well (thereby becoming a Fugitive), one can make a short trip to your nearest Multi-Government system, stop by the FTZ to become an Offender, and then blast a few pirates on the way to the planet to become clean again. (Whew, that was a monster of a sentence!)

A quick, easy and morally dubious way to gain 100+ kills while remaining Clean!
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Post by Disembodied »

Mauiby de Fug wrote:
It would appear that if one is a Fugitive, docking at a FTZ actually reduces your legal status to Offender!
Confirmed, but I'm not sure why. The FTZ script.plist is as follows:

Code: Select all

{

free-trade-zone = (
        {
            conditions = (
                "status_string equal STATUS_EXITING_WITCHSPACE", 
                "planet_number greaterthan -1",
		 "systemGovernment_number equal 2"
            		); 
            do = ( "addShipsAt: free_trade_zone 1 wpu 0 0 -0.3",
		      "addShipsAtPrecisely: ftzpirate 2 wpu 0 0 -0.25",
              "reset: local_freetradezone_marked");       
          
        },  
       {
           conditions = (
                "status_string equal STATUS_EXITING_WITCHSPACE", 
                "planet_number greaterthan -1",
		 "systemGovernment_number equal 2",
                "d100_number greaterthan 75"
            ); 
            do = ( "addShipsAtPrecisely: pirate 2 wpu 0 0 -0.25"); 
        },
       {
           conditions = (
                "status_string equal STATUS_EXITING_WITCHSPACE", 
                "planet_number greaterthan -1",
		 "systemGovernment_number equal 2",
                "d100_number greaterthan 30"
            ); 
            do = ( "addShipsAtPrecisely: ftzpirate 2 wpu 0 0 -0.2"); 
        },
       {
           conditions = (
                "status_string equal STATUS_EXITING_WITCHSPACE", 
                "planet_number greaterthan -1",
                "systemEconomy_number greaterthan -1",
		 "systemGovernment_number equal 2",
                "d100_number greaterthan 70"
            ); 
            do = ( "addShipsAtPrecisely: ftzpirate 4 wpu 0 0 -0.15"); 
        },        
       {
           conditions = (
                "status_string equal STATUS_EXITING_WITCHSPACE", 
                "planet_number greaterthan -1",
		 "systemGovernment_number equal 2",
                "d100_number greaterthan 50"
            ); 
            do = ( "addShipsWithinRadius: ftzhauler 1 wpu 0 0 -0.2 5000"); 
        },       
       {
           conditions = (
                "status_string equal STATUS_EXITING_WITCHSPACE", 
                "planet_number greaterthan -1",
		 "systemGovernment_number equal 2",
                "d100_number greaterthan 75"
            ); 
            do = ( "addShipsWithinRadius: ftzhauler 1 wpu 0 0 -0.25 5000"); 
        },       
	{
            conditions = (
              "status_string equal STATUS_LAUNCHING", 
                "planet_number greaterthan -1",
		 "systemGovernment_number equal 2"
            		); 
	do = ( "checkForShips: free_trade_zone",
		{ conditions = ("shipsFound_number equal 0" ); 
		
            do = ( "addShipsAt: free_trade_zone 1 wpu 0 0 -0.3"); }  );  

	},              
       {
           conditions = (
                "status_string equal STATUS_LAUNCHING", 
                "planet_number greaterthan -1",
		 "systemGovernment_number equal 2",
                "d100_number greaterthan 50"
            ); 
            do = ( "addShipsWithinRadius: pirate 2 wpu 0 0 -0.3 10000"); 
        },       
       {
           conditions = (
                "status_string equal STATUS_LAUNCHING", 
                "planet_number greaterthan -1",
		 "systemGovernment_number equal 2",
                "d100_number greaterthan 75"
            ); 
            do = ( "addShipsWithinRadius: ftzpirate 2 wpu 0 0 -0.3 10000"); 
        },       
       {
           conditions = (
                "status_string equal STATUS_LAUNCHING", 
                "planet_number greaterthan -1",
		 "systemGovernment_number equal 2",
                "d100_number greaterthan 50"
            ); 
            do = ( "addShipsWithinRadius: ftzhauler 1 wpu 0 0 -0.2 5000"); 
        },       
       {
           conditions = (
                "status_string equal STATUS_LAUNCHING", 
                "planet_number greaterthan -1",
		 "systemGovernment_number equal 2",
                "d100_number greaterthan 75"
            ); 
            do = ( "addShipsWithinRadius: ftzhauler 1 wpu 0 0 -0.25 5000"); 
        },       
       {
           conditions = (
                "status_string equal STATUS_LAUNCHING", 
                "planet_number greaterthan -1",
		 "systemGovernment_number equal 2",
                "d100_number greaterthan 90"
            ); 
            do = ( "addShipsWithinRadius: police 6 wpu 0 0 -0.3 5000"); 
        },       
       { 
            conditions = ( 
                "status_string equal STATUS_DOCKED", 
                "dockedStationName_string equal Free Trade Zone", 
                "local_freetradezone_marked undefined" 
            ); 
            do = ( 
            "set: mission_freetradezone_fine [legalStatus_number]", 
            "add: mission_freetradezone_fine 5", 
            "setLegalStatus: [mission_freetradezone_fine]", 
            "set: local_freetradezone_marked YES", 
            "reset: mission_freetradezone_fine"
                ); 
      },
    );
}
The specific bit that garnishes visitors' legal status is

Code: Select all

       { 
            conditions = ( 
                "status_string equal STATUS_DOCKED", 
                "dockedStationName_string equal Free Trade Zone", 
                "local_freetradezone_marked undefined" 
            ); 
            do = ( 
            "set: mission_freetradezone_fine [legalStatus_number]", 
            "add: mission_freetradezone_fine 5", 
            "setLegalStatus: [mission_freetradezone_fine]", 
            "set: local_freetradezone_marked YES", 
            "reset: mission_freetradezone_fine"
                ); 
      },
As far as I can see, this should be storing the player's current legal status as a mission variable, adding 5 to it, and then setting the player's legal status to the mission variable – i.e. 5 more than it used to be. Obviously, though, it's not! Anyone got any idea why?
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Post by Switeck »

Maybe it's OR-ing 5 to your legal status, but because it's a binary OR only a byte's worth is kept...so if you're >255 legal status, you are now reduced to 0-255?
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

The code looks correct to me (and I guess it must have worked at some time).

My guess is that for some reason the "set: mission_freetradezone_fine [legalStatus_number]" doesn't work, but will result in mission_freetradezone_fine being set to 0. If the rest of the code is working, 5 would be added to that, so finally legalStatus_number would be set to 5, which would lead to an offender status.

Could you do another test and see whether player.bounty is indeed 5 after this part of the code is run. And also that it stays at 5 with subsequent dockings at the FTZ?
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Post by Disembodied »

A Clean player's bounty is set to 5 after docking. Multiple dockings in the same FTZ (without jumping out) don't add to this (which is the intended result). Go in as a Fugutive, though, and you come out as an Offender with a bounty of 5. It looks indeed as if

Code: Select all

            "set: mission_freetradezone_fine [legalStatus_number]"
is actually setting mission_freetradezone_fine to 0.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Disembodied wrote:
is actually setting mission_freetradezone_fine to 0.
Im sure it worked in the past. I used the same construction in the legacy script of thargoidWars because the original code by Murgh did not work. That was explicit tested to work correct. But that was back with Oolite 1.69 or 1.70 at the most as it is now using a JS script.

I just looked in the code and noticed that there are 3 names that are renamed to get more consistent names. In the whilteList.plist there is a list with tho old names for translation to the new ones:

Code: Select all

	query_method_aliases =
	{
		"fuel_leak_rate_number" = "fuelLeakRate_number";
		"fuel_level_number" = "fuelLevel_number";
		"legalStatus_number" = "commanderLegalStatus_number";
	};
Probably the automatic replacement is not working correct. Try if changing the name to "commanderLegalStatus_number" does work. If that new name does work, the Oolite bug is here and the two other names above are likely to not work either in current Oolite. (name change was in r 2098, march 2009)
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Post by Disembodied »

Eric Walch wrote:
Probably the automatic replacement is not working correct. Try if changing the name to "commanderLegalStatus_number" does work. If that new name does work, the Oolite bug is here and the two other names above are likely to not work either in current Oolite. (name change was in r 2098, march 2009)
That's done the trick. Go in as a Fugitive, come out as a Fugitive with an extra +5! I'll update and upload the OXP.

Edit: does this mean the new version won't work properly with versions of the game older than March 2009?
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Post by Disembodied »

New version of the Free Trade Zone OXP now available for download, once again with working legal garnish courtesy of Eric!
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Disembodied wrote:
Edit: does this mean the new version won't work properly with versions of the game older than March 2009?
Yep! However, the aim is still get the next stable ( which is still coming, btw ;) ) totally backward compatible with 1.65 save games & OXPs, so the bug discovered by Eric is going to be fixed in the near future! :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Kaks wrote:
Yep! However, the aim is still get the next stable ( which is still coming, btw ;) ) totally backward compatible with 1.65 save games & OXPs, so the bug discovered by Eric is going to be fixed in the near future! :)
But not by me. :lol: The problem is however that the condition part is handled different than the "DO" part. I just wrote a small script:

Code: Select all

		{
			conditions = (
				"status_string equal STATUS_LAUNCHING",
				"legalStatus_number greaterthan 5",
			);
			do = (
				"set: mission_test [legalStatus_number]",
			);
		},
On startup this is preprocessed and the resulting plist ends up in the cache. When I look in the saved cache file I see the code Oolite is actually working with:

Code: Select all

		(
			YES,
			(
				(
					0,
					"status_string equal STATUS_LAUNCHING",
					"status_string",
					0,
					(
						(
							NO,
							"STATUS_LAUNCHING",
						),
					),
				),
				(
					1,
					"legalStatus_number greaterthan 5",
					"commanderLegalStatus_number",
					3,
					(
						(
							NO,
							5,
						),
					),
				),
			),
			(
				(
					NO,
					"set:",
					"mission_test [legalStatus_number]",
				),
			),
			(),
		),
I see that the replacement in the condition part is correct (at least when I understand the pre-processed plist correct), but not in the DO part. So whoever will try fixing that, must probably look there.
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Re: Free Trade Zone OXP

Post by Disembodied »

Newly updated [wiki]Free Trade Zone[/wiki] page on the wiki, courtesy of Fatleaf: many thanks to him and to all the wiki wizards for their excellent wikiwirk! :D
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Free Trade Zone OXP

Post by phkb »

Disembodied has very kindly given me permission to update and maintain this OXP going forward. He's also shared some ideas with me on how the OXP may develop in the future.

In version 0.21 (now available via the download manager):
  • Converted model to be a variation of the new Rock Hermit.
  • Added a customised docking tunnel texture for use by BGS.
  • Turned on docking requests.
  • Limited FTZ's to only appear in TL7 systems or higher.
  • Converted plist-style script to Javascript.
  • Updated the populator routine to use the new Oolite populator methods.
  • Added routines to check if the FTZ was destroyed in a system, and only recreate the station after 30 days have passed.
  • Updated the market script to use the new style.
  • Added an option for commanders who dock at the station to either take the bounty increase, or pay a fine.
The [EliteWiki] Free Trade Zone Wiki page has also been updated to reflect the changes.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Free Trade Zone OXP

Post by Cody »

Not tried this OXP before - has it always used Z on the ASC? Zieman Habitats also use Z, you see.

Not that it's a problem - just curious.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Free Trade Zone OXP

Post by phkb »

Cody wrote:
has it always used Z on the ASC?
As far as I'm aware it's always had Z. I can easily change it to something else, although I'm not sure what to.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Free Trade Zone OXP

Post by Cody »

phkb wrote:
I can easily change it to something else, although I'm not sure what to.
No need - plenty of multiple usages on the ASC already, and it's easy to tell FTZs from ZHs anyway.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
Post Reply