Ship-to-Ship Comms OXP
Moderators: winston, another_commander
Re: Ship-to-Ship Comms OXP
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...
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
Re: Ship-to-Ship Comms OXP
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)
- phkb
- 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
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:
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
The dock is a subentity of the station
The filtered entity list for the system doesn't contain subentities - to find those you need to go to their parent entity.
Code: Select all
> system.mainStation.subEntities[2]
[Dock "Coriolis Dock" position: (0, 0, 500.256) (subentity)]
- phkb
- 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
Right, don't know how I missed the "subEntities" property. Thanks for the help!
- phkb
- 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
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)?- phkb
- 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
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.- Tricky
- ---- 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
Oolite PriorityAI Documentationphkb wrote:Also, for the instances where I do find aAIScript.oolite_priorityai
, when I do theperformAttack
andreconsiderNow
, 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
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: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)?
"performAttack" is on the ship object itself, not the AI controller, which might be causing the problem?phkb wrote:Also, for the instances where I do find aAIScript.oolite_priorityai
, when I do theperformAttack
andreconsiderNow
, 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.
- phkb
- 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
Right. That's fair enough.cim wrote:That property will only exist for ships with a 1.79 or later JS AI
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.cim wrote:"performAttack" is on the ship object itself, not the AI controller
- phkb
- 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
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?
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?
- Norby
- ---- 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
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.- If the player doesn't dump some cargo within (say) 10 seconds, the pirate band start attacking again.
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.
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.it would be good for the greeting to mean something in the game world
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.when a piece of equipment is primed is it possible to have the associated MFD be displayed
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.