Page 3 of 3

Re: Ship-to-Ship Comms OXP

Posted: Fri Aug 01, 2014 6:37 am
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...

Re: Ship-to-Ship Comms OXP

Posted: Fri Aug 01, 2014 7:09 am
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)

Re: Ship-to-Ship Comms OXP

Posted: Fri Aug 01, 2014 7:55 am
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);
}

Re: Ship-to-Ship Comms OXP

Posted: Fri Aug 01, 2014 7:58 am
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.

Re: Ship-to-Ship Comms OXP

Posted: Fri Aug 01, 2014 11:31 am
by phkb
Right, don't know how I missed the "subEntities" property. Thanks for the help!

Re: Ship-to-Ship Comms OXP

Posted: Sun Aug 03, 2014 4:11 am
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)?

Re: Ship-to-Ship Comms OXP

Posted: Sun Aug 03, 2014 4:46 am
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.

Re: Ship-to-Ship Comms OXP

Posted: Sun Aug 03, 2014 3:29 pm
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

Re: Ship-to-Ship Comms OXP

Posted: Sun Aug 03, 2014 3:46 pm
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?

Re: Ship-to-Ship Comms OXP

Posted: Mon Aug 04, 2014 12:02 am
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.

Re: Ship-to-Ship Comms OXP

Posted: Tue Aug 05, 2014 10:03 am
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?

Re: Ship-to-Ship Comms OXP

Posted: Tue Aug 12, 2014 11:03 am
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.