TG 2 OXP

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

Moderators: winston, another_commander

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: WIP - ToughGuys 2

Post by another_commander »

Smivs wrote:
another_commander wrote:
Smivs wrote:
Any thoughts on my witchpoint pirates, anyone?
What exactly do you do with the script posted earlier? How exactly do you apply it in the game?
It's in a folder called 'Scripts' in the .oxp folder.
Do you have a world-script in Config making a reference to this script? If not, then that is the reason you cannot see anything happening.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: WIP - ToughGuys 2

Post by Smivs »

another_commander wrote:
Do you have a world-script in Config making a reference to this script? If not, then that is the reason you cannot see anything happening.
Ah :idea: Thanks, I think I know how to do that...I'll have a go.

Edit:-
Who-hooo, all the pirates I could ever want. (I must be MAD!)

Image

Very many thanks :D
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: WIP - ToughGuys 2

Post by Smivs »

Next problem....my team of crack test pilots like the pirate blockade, but don't think it should be every single planet, and I agree with this.
I would only like the blockade at Industrial worlds (economy >4), and stable governments (say govt type <3).
Also I currently have 2 scripts, one for pirates and one for police. I want them to appear together (police attempting to break the blockade). How do I merge these into one script, with the govt/economy conditions?

This is what I've got so far:-

Code: Select all

// Configuration -- customize here 
this.role = "pirate"; 
this.count = 5; 

// Standard attributes 
this.name           = "Spawn-" + this.role; 
this.author         = "Jens Ayton"; 
this.copyright      = "This script is hereby placed in the public domain."; 
this.version        = "1.0.1"; 
this.description    = "Script to make several ships of a given role appear at the witchpoint after every jump." 


this.shipWillExitWitchspace = function() 
{    
    system.addShips(this.role, this.count, player.ship.position, 10000);
}
and

Code: Select all

// Configuration -- customize here 
this.role = "police"; 
this.count = 3; 

// Standard attributes 
this.name           = "Spawn-" + this.role; 
this.author         = "Jens Ayton"; 
this.copyright      = "This script is hereby placed in the public domain."; 
this.version        = "1.0.1"; 
this.description    = "Script to make several ships of a given role appear at the witchpoint after every jump." 


this.shipWillExitWitchspace = function() 
{    
    system.addShips(this.role, this.count, player.ship.position, 20000);
}
I can't see that this should be hard to do, but I'm lost with JS as you know. Thanks for any help. :D
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
curtsibling
Dangerous
Dangerous
Posts: 106
Joined: Sat Dec 25, 2010 11:19 am

Re: WIP - ToughGuys 2

Post by curtsibling »

TG2 looks like fun! I'm glad I bought a caddy - I think the damage control node might be needed!

:D
***Ship Log***
Ship:Caduceus Omega - Invidious Domain
Legal:Clean
Rating:Dangerous
Location: G1
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: WIP - ToughGuys 2

Post by Cody »

curtsibling wrote:
TG2 looks like fun!
Yeah, fun is one word for it... on a test cruise last night, 13 kills cost me over 30k in repair bills, when I finally limped into the station.
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!
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: WIP - ToughGuys 2

Post by another_commander »

Smivs: Try with this (note: not tested):

Code: Select all

// Configuration -- customize here 
this.role1 = "pirate"; 
this.count1 = 5;
this.role2 = "police";
this.count2 = 3;

// Standard attributes 
this.name           = "Spawn-" + this.role; 
this.author         = "Jens Ayton"; 
this.copyright      = "This script is hereby placed in the public domain."; 
this.version        = "1.0.1"; 
this.description    = "Script to make several ships of a given role appear at the witchpoint after every jump." 


this.shipWillExitWitchspace = function() 
{
    if (system.economy > 4 && system.government < 3)
    {  
        system.addShips(this.role1, this.count1, player.ship.position, 10000);
        system.addShips(this.role2, this.count2, player.ship.position, 10000);
    }
}
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: WIP - ToughGuys 2

Post by JensAyton »

BTW, if you’re using that script for something other than testing a custom ship role, you should change “this.name” to something unique.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: WIP - ToughGuys 2

Post by Smivs »

Thanks AC, but it's not working. I'm getting this log error
[loading.complete]: ========== Loading complete. ==========
[script.javaScript.warning.undefinedProp]: ----- JavaScript warning (blockade_script.js.anon-script): reference to undefined property this.role
[script.javaScript.warning.undefinedProp]: /home/smivses/.Oolite/AddOns/ToughGuys Armageddon.oxp/Scripts/blockade_script.js, line 8.
:?:

Edit:- It's OK, I think I've fixed it. There was a missing semi-colon after

Code: Select all

 if (system.economy > 4 && system.government < 3)
I'll give it a good test later, but early indicators are it's working well. Thanks again.

@ Ahruman, any name? Blockade?
Commander Smivs, the friendliest Gourd this side of Riedquat.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: WIP - ToughGuys 2

Post by another_commander »

Smivs wrote:
Edit:- It's OK, I think I've fixed it. There was a missing semi-colon after

Code: Select all

 if (system.economy > 4 && system.government < 3)
No, it is wrong having a semicolon at the end of that line. Unless JavaScript is different to C in that regard, a semicolon's presence there will generate buggy behaviour. I suggest you restart with Shift down.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: WIP - ToughGuys 2

Post by Smivs »

This is weird!
Without the semicolon it doesn't work and I get the log error shown above.
With the semicolon it seems to work but I get the same log error.
Tested both times with cache cleared.
Commander Smivs, the friendliest Gourd this side of Riedquat.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: WIP - ToughGuys 2

Post by another_commander »

Please post blockade_script.js.
User avatar
CheeseRedux
---- E L I T E ----
---- E L I T E ----
Posts: 827
Joined: Fri Oct 02, 2009 6:50 pm

Re: WIP - ToughGuys 2

Post by CheeseRedux »

Smivs wrote:
Next problem....my team of crack test pilots like the pirate blockade, but don't think it should be every single planet, and I agree with this.
I would only like the blockade at Industrial worlds (economy >4), and stable governments (say govt type <3).
Just as a bit of lateral thinking here: If you want to take your control even further, you could go down the route of the infamous Zaonce/Eagle2 planetinfo.plist. More work, certainly, but it'd allow you to make certain areas be infested with your blockades while others are clear.
(Of course, combining the two could be even more powerful: You'd get your guys at all worlds that fit the bill, and in addition they'd be added to the 'special selected' worlds.)
"Actually this is a common misconception... I do *not* in fact have a lot of time on my hands at all! I just have a very very very very bad sense of priorities."
--Dean C Engelhardt
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: WIP - ToughGuys 2

Post by Smivs »

Just done some more testing...without the semicolon the script seems to be loading, but it's not working in the sense that no pirates/police are appearing. I've tried this at
Poor Industrial Corporate (where I would expect the blockade)
Poor Agricultural Feudal (where I would not expect one)
Poor Industrial Feudal (not sure about this one - industrial should trigger a blockade, Feudal shouldn't)

The script is the one you supplied, renamed thus

Code: Select all

// Configuration -- customize here 
this.role1 = "pirate"; 
this.count1 = 5;
this.role2 = "police";
this.count2 = 3;

// Standard attributes 
this.name           = "WitchpointBlockade"; 
this.author         = "Jens Ayton"; 
this.copyright      = "This script is hereby placed in the public domain."; 
this.version        = "1.0.1"; 
this.description    = "Script to make several ships of a given role appear at the witchpoint after every jump." 


this.shipWillExitWitchspace = function() 
{
    if (system.economy > 4 && system.government < 3)
    {  
        system.addShips(this.role1, this.count1, player.ship.position, 10000);
        system.addShips(this.role2, this.count2, player.ship.position, 10000);
    }
}

The relevant log entry for the above is

Code: Select all

[loading.complete]: ========== Loading complete. ==========
[script.load.world.listAll]: Loaded 23 world scripts:
    assassins
    behemoth 2.5.4
    Furball 1.0 alpha 1
    GalNavy Build 0139
    hofd GalNavy Build 118 / HOFD Build 55
    IR-defences.js 1.0
    IR-finance.js 1.0
    IR-main-script.js 1.0
    IR-SDF.js 1.0
    IR-shipment.js 1.0
    IronHide Armour Script 1.01
    oolite-cloaking-device 1.74.2
    oolite-constrictor-hunt 1.74.2
    oolite-nova 1.74.2
    oolite-thargoid-plans 1.74.2
    oolite-trumbles 1.74.2
    Pi-Forty-Two Con stores 4.1.4
    Random_Hits 1.4.6
    Repair system 2.0
    rockHermit_Locator 1.3.3
    stellarSerpents_masterScript.js 1.00
    System Redux 1.2 1.2
    WitchpointBlockade 1.0.1
where WitchpointBlockade is the last script listed. This was with cache cleared, and checked that world_scripts.plist is correct for the script.
Commander Smivs, the friendliest Gourd this side of Riedquat.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: WIP - ToughGuys 2

Post by another_commander »

Smivs wrote:
I would only like the blockade at Industrial worlds (economy >4), and stable governments (say govt type <3).
The specs seem to be somewhat wrong. Industrial worlds have economy < 4 and stable governments should be above 3. The list of enumerations for the two attributes are as follows:
economy =
(
"Rich Industrial",
"Average Industrial",
"Poor Industrial",
"Mainly Industrial",
"Mainly Agricultural",
"Rich Agricultural",
"Average Agricultural",
"Poor Agricultural"
);
government =
(
"Anarchy",
"Feudal",
"Multi-Government",
"Dictatorship",
"Communist",
"Confederacy",
"Democracy",
"Corporate State"
);
Enumeration starts at 0 for the first element, 1 for the second, etc.

As for the error you are getting, something else is wrong. I checked the script as printed above on my system and got the blockade at a system that fulfilled the conditions. The fact that it is looking for this.role, when inside the script only this.role1 and this.role2 are mentioned seems strange.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: WIP - ToughGuys 2

Post by Smivs »

:oops: So I've got my 'greaterthan' and ' lessthan' the wrong way round. Doh. This explains why I was chuffed to get a grade 4 CSE maths.
I'll sort that out and have another go. Thanks for your patience.
Commander Smivs, the friendliest Gourd this side of Riedquat.
Post Reply