DONE: NPC 's switch on 'Navlights' when in docking Queue

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

dertien
---- E L I T E ----
---- E L I T E ----
Posts: 471
Joined: Sun Jan 23, 2011 9:27 pm
Location: Belgium, Monarchy, Feudal, Overtaxed system

DONE: NPC 's switch on 'Navlights' when in docking Queue

Post by dertien »

I would be looking to solve a little thing that I would like to add to the shippack I am making, but could be useful for other shippacks too.

I don't know if this can be accomplished by adding a few well placed entires in the AI files or if it should be done by script, so therefore the question.

- When NPC's enter station aegis to dock to the station, how could we make them switch on nav lights. A red one on the left and a green one on the right. If this could be done with flashers on the "wingtips", that would be cool, noting too fancy in the sense of shaders. A bit like Commander Mc Lane's docking assistant script when activated. They should be able to be positioned per ship like the exhaust plumes (xyz).

Of course, NPC's flying from witchpoint to Station don't want to advertise their whereabouts to pirates, and light up like x-mas trees.
So when they leave the station aegis or entering witchspace, they should turn the flashers off.

Does anybody like this idea, and can someone tell me how to accomplish this ?


SOLVED:

I must admit it was Smivs that gave me the idea with his shippack, but I just wanted the ships to switch them on near the station, not all the time.

Howto:

- open shipdata.plist of ship you would like to add flashers to and add them as subentities (cobra Mk 1 example):

Code: Select all

subentities = (
		
							{
								type = "flasher";
								position = (-30.97, -1.27, -7.62);
								color = redColor;
								initially_on = no;
								frequency = 1;
								size = 12;
							},
							{
								type = "flasher";
								position = (30.97, -1.27, -7.62);
								color = greenColor;
								initially_on = no;
								frequency = 1;
								size = 12;
							}		
				);
This will add isofase blinking flashers (green and red) on both 'wingtips' of the cobra Mk 1. Since the state of the flashers is set to

Code: Select all

 initially_on = no;
this will not do anything however without the file below, so read on.

If you want them to be permanently on (like in Smiv's shipset) change the code from

Code: Select all

frequency = 1;
to

Code: Select all

frequency = 0;
Then download this :https://app.box.com/s/j9nurj03c1ojqa43nmsb and put it in your oxp folder, make sure it is the last file that gets loaded, I put an extra "Z" in the name just in case.

Go camp around a station entrance and do some Cobbie Mk 1 spotting. Please report those that do not use their flashers.

Enjoy!

Some nice screenshots of a Cobra Mk 3 docking at Zaonce with Frontierspace background:

Pic 1 waiting for clearance (no nav lights)
Pic 2 docking (nav lights on)

Image
Image
Last edited by dertien on Sun Feb 09, 2014 8:08 pm, edited 11 times in total.
Alpha Backer of Elite Dangerous
With 250 GBP :D
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: NPC 's switch on 'Navlights' when entering Station Aegis

Post by Pleb »

Could this be done similarly to the Police ship's lights? They turn on when engaging hostiles and turn off when finished...perhaps if you take a look at that you can work something out from that?
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
dertien
---- E L I T E ----
---- E L I T E ----
Posts: 471
Joined: Sun Jan 23, 2011 9:27 pm
Location: Belgium, Monarchy, Feudal, Overtaxed system

Re: NPC 's switch on 'Navlights' when entering Station Aegis

Post by dertien »

Yes; I had something like that in mind, but nothing concrete as of yet.
Alpha Backer of Elite Dangerous
With 250 GBP :D
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: NPC 's switch on 'Navlights' when entering Station Aegis

Post by Diziet Sma »

There are a few ships with nav-lights already.. though they don't flash, and are on permanently.. Some of Smiv's ships, IIRC, and Captain Beatniks.. (such as both the Pitviper models)
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
dertien
---- E L I T E ----
---- E L I T E ----
Posts: 471
Joined: Sun Jan 23, 2011 9:27 pm
Location: Belgium, Monarchy, Feudal, Overtaxed system

Re: NPC 's switch on 'Navlights' when entering Station Aegis

Post by dertien »

Ha! well I did it and yes Pleb, the solution lay in the AI property lists, not too hard, but heck of a lot of time to get it right, and gametesting of course.

- added the entry

Code: Select all

switchLightsOff,
to all relevant AI plists (in the GLOBAL part at the top) exept in the dockingAI.plist GLOBAL where I used

Code: Select all

switchLightsOn,


- In the shipdata property list of every ship added the necessary subentity flashers at the right coordinates and with

Code: Select all

initially_on = yes;
like so:

Code: Select all

{
								type = "flasher";
								position = (-27.76, 0.21, 7.00);
								color = redColor;
								//colors = ({ hue = 61; }, { hue = 61; brightness = 0.0; }, { hue = 61; brightness = 0.0; }, { hue = 61; brightness = 0.0; });
								initially_on = yes;
								frequency = 1;
								size = 12;
							},
							{
								type = "flasher";
								position = (27.76, 0.21, 7.00);
								color = greenColor;
								//colors = ({ hue = 61; }, { hue = 61; brightness = 0.0; }, { hue = 61; brightness = 0.0; }, { hue = 61; brightness = 0.0; });
								initially_on = yes;
								frequency = 1;
								size = 12;
							},
And finally in the same file; changed the line

Code: Select all

 auto_ai = yes;
to

Code: Select all

auto _ai = no;
This might have some implications since the javascript files are no longer spoken for with the auto_ai set to NO. Don't really know what that will mean gameplay wise.

Now when ships are planning on docking they switch their navlights on ! works fine (as far as I've seen ingame) and is indeed similar to the police switching on their lights when attacking.

Great.

example Global part of the DockingAI.plist:

Code: Select all

{
	GLOBAL =
	{
		ENTER =
		(
			switchLightsOn,
			"dropMessages: DOCKING_ABORTED,FACING_DESTINATION",
			"setSpeedTo: 0.0",
			requestDockingCoordinates,
			"setStateTo: AWAIT_COORDS"
		);
	};
Edit: I changed the property of the flasher to initially off instead of on. See post at the top for correct usage, thanks
Last edited by dertien on Sun Feb 09, 2014 6:13 pm, edited 1 time in total.
Alpha Backer of Elite Dangerous
With 250 GBP :D
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: NPC 's switch on 'Navlights' when entering Station Aegis

Post by Pleb »

8) I thought it might be something like that, but I've never really played around with the flashers much before. Glad you've cracked it though! :)
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: NPC 's switch on 'Navlights' when entering Station Aegis

Post by Smivs »

All my ships feature flashing navigation lights as described, although they are permanently on, except on derelicts of course. :)
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: NPC 's switch on 'Navlights' when entering Station Aegis

Post by Thargoid »

That will work, but currently flashers are "all or nothing" in that you can only switch them all on or off by script. Being able to address them individually is a long standing feature request.
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: NPC 's switch on 'Navlights' when entering Station Aegis

Post by Zireael »

Wow, I love this suggestion and how quickly it got coded!
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: NPC 's switch on 'Navlights' when entering Station Aegis

Post by cim »

Thargoid wrote:
That will work, but currently flashers are "all or nothing" in that you can only switch them all on or off by script. Being able to address them individually is a long standing feature request.
Oolite JavaScript Reference: Flasher
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: NPC 's switch on 'Navlights' when entering Station Aegis

Post by Thargoid »

:)

Just for reference, how to we reference them directly (for example if I have two flashers, how to I reference one of them only? Do they now appear as sub-entities, or is there some other similar array?
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: NPC 's switch on 'Navlights' when entering Station Aegis

Post by cim »

Thargoid wrote:
Just for reference, how to we reference them directly (for example if I have two flashers, how to I reference one of them only? Do they now appear as sub-entities, or is there some other similar array?
ship.flashers

See also: ship.exhausts
dertien
---- E L I T E ----
---- E L I T E ----
Posts: 471
Joined: Sun Jan 23, 2011 9:27 pm
Location: Belgium, Monarchy, Feudal, Overtaxed system

Re: DONE: NPC 's switch on 'Navlights' when in docking Queue

Post by dertien »

A little question for people that are more acquainted with Oolite scripting and AI. What is the difference AI wise between a shipdata.plist having

Code: Select all

auto_ai = no;
and

Code: Select all

auto_ai = no;
, I have read upon it in the wiki, but still don't understand. What I seemed to understand was that with the auto ai set to ON that certain javascript AI would be called upon, and that Oolite is merging towards JS instead of using Plists since JS has more nuts and bolts to work with than property lists, or am I wrong here ?

Would someone care to elaborate ?
Alpha Backer of Elite Dangerous
With 250 GBP :D
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: DONE: NPC 's switch on 'Navlights' when in docking Queue

Post by Smivs »

I don't know the situation regarding the new js AIs, but normally auto_ai is set to 'on' which means the ship would be given an appropriate AI for the role it was spawned with. 'auto_ai=no' means that it will use the AI specified in the shipdata.plist
Commander Smivs, the friendliest Gourd this side of Riedquat.
Post Reply