Altering of player legal status via XML script

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

Moderators: winston, another_commander

User avatar
Rustybolts
---- E L I T E ----
---- E L I T E ----
Posts: 293
Joined: Sun Jun 07, 2009 6:22 pm
Location: UK

Post by Rustybolts »

So someone pointed out to me before legacy scripts can take about 10 seconds to kick in and don't occur immediately. Leave it a few seconds the rating should change.
*EDIT* lol just seen your mistake myself anyway above comment still stands. I hate it when mistakes in code are that stupid you can't see them, i had trouble when doing blackjacks over a missing capital letter lol. *EDIT*
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
Image
pmw57
---- E L I T E ----
---- E L I T E ----
Posts: 389
Joined: Sat Sep 26, 2009 2:14 pm
Location: Christchurch, New Zealand

Post by pmw57 »

Rustybolts wrote:
Tested my solution and works here's my code

Code: Select all

{
	test = (
		{
		conditions = ("galaxy_number equal 0"); 
            do = (
                        {
                            conditions = ( 
                                "planet_number equal 129"
								 ); 
                            do = (
								"set :local_legal [legalStatus_number]",
								"add: local_legal 64",
								"setLegalStatus: [local_legal]"
							);
						}
				);
		}
	);
}	
I'm in the middle of converting the plist to javascript.

If the above were recoded to more standard javascript, how would we do this with 1.73.4? Something like this?
if (galaxyNumber === 0 && planetNumber === 129) {
player.bounty = 0;
}
Oh, and how would we work with things like mission_playerstation_AAA
The wiki reference is rather quiet on this, so I hope that we are able to do so and it's just currently undocumented.

I'm helping Lestradae recode his plist and 90% of it relates to the player stations, being over 13000 lines of plist code just in itself.
A trumble a day keeps the doctor away, and the tax man;
even the Grim Reaper keeps his distance.
-- Paul Wilkins
User avatar
Cmd. Cheyd
---- E L I T E ----
---- E L I T E ----
Posts: 934
Joined: Tue Dec 16, 2008 2:52 pm
Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...

Post by Cmd. Cheyd »

Code: Select all

this.whatever = function();
     if(galaxyNumber == 0 && system.ID == 129) {
          do.whatever;
     }
}
Should work....
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

I would use system.ID in place of planetNumber (it's the js equivalent) and == is enough, === isn't needed). But other than that yes you can identify systems that way. Trigger it with an event such as this.shipExitedWitchspace and it will happen as soon as you enter each system.

Depends quite what you want to do though exactly.
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 »

The full translation of the xml above:

Code: Select all

this.shipExitedWitchspace = function ()
{
    if(galaxyNumber == 0 && system.ID == 129)
    {
        player.bounty += 64;
    }
}
The legacy scripting system has no events and such, all legacy scripts are executed approximately once every 10 seconds, so - unless there are other conditions stopping that code from running again and again - the legacy code would keep increasing the player bounty throughout their stay in Zaonce.

This js code is executed only once per system, at the end of the tunnel effect.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
Post Reply