Ship-to-Ship Comms OXP

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

Moderators: winston, another_commander

User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Ship-to-Ship Comms OXP

Post by Thargoid »

This is where the debug console is your friend - you can also then use it to monitor, evaluate and tweak the added ship at your pleasure...
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Ship-to-Ship Comms OXP

Post by cim »

target.isFleeing will tell you if the target is currently running away, but it won't tell you if it's dumped cargo before or after doing so.

Easiest way to pick up on that is probably the cargoDumpedNearby event handler. (It's a ship script event handler, but if you put it in a world script, it'll get triggered any time this event happens to the player ship)

(And seconding Thargoid's recommendation for the debug console)
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: Ship-to-Ship Comms OXP

Post by phkb »

Question: how do you find the dock related to a station. The wiki says that each station has at least one, but I can't find any in the entire system.

I used this code to try and track one down, but no entity says "isDock = true". Maybe I've missed something here:

Code: Select all

this._reportAllEntities = function() {
	function _isValidEntity(entity)
	{
		return entity.isValid && !(entity.isVisualEffect);
	}
	var ents = system.filteredEntities(this, _isValidEntity);
	log(this.name, "Total entities = " + ents.length.toString());
	ents.forEach(function(ent)
	{
		log(this.name, "==========================================");
		log(this.name, "entity displayName = " + ent.displayName);
		log(this.name, "entity scanClass = " + ent.scanClass);
		log(this.name, "entity owner = " + ent.displayName);
		log(this.name, "entity isInSpace = " + ent.isInSpace.toString());
		log(this.name, "entity isDock = " + ent.isDock.toString());
		log(this.name, "entity isPlanet = " + ent.isPlanet.toString());
		log(this.name, "entity isPlayer = " + ent.isPlayer.toString());
		log(this.name, "entity isShip = " + ent.isShip.toString());
		log(this.name, "entity isStation = " + ent.isStation.toString());
		log(this.name, "entity isSubEntity = " + ent.isSubEntity.toString());
		log(this.name, "entity isVisible = " + ent.isVisible.toString());
		log(this.name, "entity isWormhole = " + ent.isWormhole.toString());
		log(this.name, "entity status = " + ent.status);
	}, this);
}
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Ship-to-Ship Comms OXP

Post by cim »

The dock is a subentity of the station

Code: Select all

> system.mainStation.subEntities[2]
[Dock "Coriolis Dock" position: (0, 0, 500.256) (subentity)]
The filtered entity list for the system doesn't contain subentities - to find those you need to go to their parent entity.
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: Ship-to-Ship Comms OXP

Post by phkb »

Right, don't know how I missed the "subEntities" property. Thanks for the help!
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: Ship-to-Ship Comms OXP

Post by phkb »

I'm noticing that some ships don't seem to have a "AIScript.oolite_priorityai". In particular, any "Hognose" ships I come across or even create. Is this due to some issue with the Hognose, or something I should consider on a wider scale (ie. OXP ships's pre v1.79)?
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: Ship-to-Ship Comms OXP

Post by phkb »

Also, for the instances where I do find a AIScript.oolite_priorityai, when I do the performAttack and reconsiderNow, I'm not getting any of them to decide to drop cargo. Yet if I fire a shot at them they drop and run straight away.
User avatar
Tricky
---- E L I T E ----
---- E L I T E ----
Posts: 821
Joined: Sun May 13, 2012 11:12 pm
Location: Bradford, UK. (Anarchic)

Re: Ship-to-Ship Comms OXP

Post by Tricky »

phkb wrote:
Also, for the instances where I do find a AIScript.oolite_priorityai, when I do the performAttack and reconsiderNow, I'm not getting any of them to decide to drop cargo. Yet if I fire a shot at them they drop and run straight away.
[EliteWiki] Oolite PriorityAI Documentation
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Ship-to-Ship Comms OXP

Post by cim »

phkb wrote:
I'm noticing that some ships don't seem to have a "AIScript.oolite_priorityai". In particular, any "Hognose" ships I come across or even create. Is this due to some issue with the Hognose, or something I should consider on a wider scale (ie. OXP ships's pre v1.79)?
That property will only exist for ships with a 1.79 or later JS AI (which at the moment is basically no OXP ships with custom AIs). The old style AIs will occasionally dump cargo but you definitely have to shoot at them to get that to happen.
phkb wrote:
Also, for the instances where I do find a AIScript.oolite_priorityai, when I do the performAttack and reconsiderNow, I'm not getting any of them to decide to drop cargo. Yet if I fire a shot at them they drop and run straight away.
"performAttack" is on the ship object itself, not the AI controller, which might be causing the problem?
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: Ship-to-Ship Comms OXP

Post by phkb »

cim wrote:
That property will only exist for ships with a 1.79 or later JS AI
Right. That's fair enough.
cim wrote:
"performAttack" is on the ship object itself, not the AI controller
This is what I'm doing, based on your sample. I'll keep trying -- I might remove a few OXP's to just get the core ships and see whether I can get any of them to work, and let you know how I get on. Thanks for the help.
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: Ship-to-Ship Comms OXP

Post by phkb »

I have a couple of general feedback questions for those who are interested.

Let's say you're attacked by a pirate band, and using this new-fangled "BroadcastComms MFD (tm)" you quickly send out "I surrender" message. The pirate band accept the surrender -- but what should happen next? There are lots of options, but I'm wondering about some of the following:
- If the player doesn't dump some cargo within (say) 10 seconds, the pirate band start attacking again.
- If the player starts attacking the pirate band, then up all their accuracy levels for 20 seconds
- Something else?

And another question: You're cruising along and you come across a group of ships. You target one of them and send them a greeting. I'm thinking it would be good for the greeting to mean something in the game world, but I'm not sure what's the best use of it. I thought that I could possibly customise the responses from the other ship to indicate something about them but I'm not sure what would be useful and helpful or potentially reveal too much. I'd love to get some ideas.

And a technical question: when a piece of equipment is primed is it possible to have the associated MFD be displayed (if it isn't already)? Is this feasible, or even recommended?
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Ship-to-Ship Comms OXP

Post by Norby »

- If the player doesn't dump some cargo within (say) 10 seconds, the pirate band start attacking again.
My ideas: you can check if the player acts as really cooperate. For example reducing the speed and turning off weapons is good (can extend the time for dump) and using injectors (speed>maxSpeed) or a laser hit on any ship will be retaliated.
You can send another warning if the player significantly increase his distance from the pirates after surrender without dump then attack before he can escape.
it would be good for the greeting to mean something in the game world
Some random neutral answer is enough in the first version imho. You can add more later and you can outsource the task into other OXPs by providing an interface to add more. You must not write stories here to fill up the radio comms with meanings, I guess others will be happy to do it.
when a piece of equipment is primed is it possible to have the associated MFD be displayed
Possible but is not recommended, at least until we can not query which MFDs are displayed to avoid overwrite another. Dispaying in the first empty slot is also problematic, without query this way will duplicate the MFD at every priming of the equipment until all available slot will be filled with this MFD.

There is a workaround in [wiki]HUDSelector[/wiki], if this OXP is installed then you can test if your BroadcastCommsMFD is in the $HUDSelectorMFDs array which mean displayed, else you can send a warning in consoleMessage when the equipment is primed. I can make an array checker function if you ask but probably the player who want to use your MDF will setup properly without this message also.
Post Reply