Page 1 of 3
Information desired!
Posted: Tue Jul 09, 2024 10:30 am
by Cholmondely
1) Needed for wiki
NPCs and their weapons
Laser Mountings:
I understand that side lasers are not used by NPCs. Is this also true for rear lasers?
Q-bombs:
Are these fully usable by NPCs or do they need a custom AI to do so?
Cloaking Devices
Are these fully usable by NPCs or do they need a custom AI to do so?
Thargoid Plasma Accelerator
Are these fully usable by NPCs or do they need a custom AI to do so?
2) Tweaks
Rescues of NPCs
How do I tweak Refugee Adders, Commie Convict Miner Minnows/Convict Miner Rays to follow me?
How would I do it via Broadcast Comms (presuming that I write the dialogue myself)?
Re: Information desired!
Posted: Tue Jul 09, 2024 12:06 pm
by phkb
Rear lasers are definitely used by the existing AI.
Not sure on the others without looking (not near my pc as the moment)
Re: Information desired!
Posted: Tue Jul 09, 2024 6:41 pm
by LittleBear
For following the player:
ENTER = ("scanForNearestShipWithRole: player")
"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setDesiredRangeTo: 5000.0", checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DESIRED_RANGE_ACHIEVED" = (What you want them to do when they get there);
UPDATE = (performFlyToRangeFromDestination);
KillerWolf's Phantom will cloak, but that may be with a custom AI. I got blasted by a police phantom that was hanging out cloaked by the main station, when I was innocently testing some AIs by shooting a clean test ship I'd spawned by the main station.
Ranges are in meters, so the above example would cause the ship to fly to within 5kms of the player. If you wanted the ship to hang between 1 and 5kms from you wing, you could add setting the state to a different state when it gets to 5km and have an identical state to the first but with the range set to 1,000. When it get to the desired range switch it back to the first state. It will then fly between 1 and 5 kms from the player.
I don't think a ship will use a q-mine on its own. But if you attached a script to the ship you could add a dice roll under ATTACK_SHIP and on a roll of 1 send a script message to the script so it spawns a q-mine within 50m of the ships position. If you also add:
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
Then it will injector away from its own q-mine so it isn't caught in the blast.
Re: Information desired!
Posted: Tue Jul 09, 2024 8:15 pm
by Cholmondely
LittleBear wrote: ↑Tue Jul 09, 2024 6:41 pm
For following the player:
ENTER = ("scanForNearestShipWithRole: player")
"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setDesiredRangeTo: 5000.0", checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DESIRED_RANGE_ACHIEVED" = (What you want them to do when they get there);
UPDATE = (performFlyToRangeFromDestination);
KillerWolf's Phantom will cloak, but that may be with a custom AI. I got blasted by a police phantom that was hanging out cloaked by the main station, when I was innocently testing some AIs by shooting a clean test ship I'd spawned by the main station.
Ranges are in meters, so the above example would cause the ship to fly to within 5kms of the player. If you wanted the ship to hang between 1 and 5kms from you wing, you could add setting the state to a different state when it gets to 5km and have an identical state to the first but with the range set to 1,000. When it get to the desired range switch it back to the first state. It will then fly between 1 and 5 kms from the player.
I don't think a ship will use a q-mine on its own. But if you attached a script to the ship you could add a dice roll under ATTACK_SHIP and on a roll of 1 send a script message to the script so it spawns a q-mine within 50m of the ships position. If you also add:
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
Then it will injector away from its own q-mine so it isn't caught in the blast.
This dumb pilot found nothing obvious in KW's
Phantom. No obvious AI's.
But. There
was this:
Code: Select all
this.name = "kwGeneric_externalMissiles.js";
this.author = "Thargoid";
this.copyright = "Creative Commons: attribution, non-commercial, sharealike.";
this.description = "Generic external missile launching script";
this.version = "1.0";
this.shipSpawned = function()
{ // just to ensure ship is fully loaded with selected missile type and nothing else
if(this.ship.scriptInfo.missileRole) // missileRole should be defined in shipdata.plist
{ this.missileRole = this.ship.scriptInfo.missileRole; }
else
{ this.missileRole = "EQ_MISSILE"; } // default to standard missile if not
this.ship.awardEquipment("EQ_MISSILE_REMOVAL"); // remove all spawning missiles and restock with selected ones.
var addCounter = 0;
for(addCounter = 0; addCounter < this.ship.missileCapacity;addCounter++)
{ this.ship.awardEquipment(this.missileRole); }
}
this.shipFiredMissile = function(missile, target)
{
if(this.ship.subEntities.length === 0) {return}; // if we've run out of sub-ents before we run out of missiles
var subCounter = this.ship.subEntities.length - 1; // Set counter to number of sub-ents minus 1 (as entity array goes up from zero)
for(subCounter = this.ship.subEntities.length - 1;subCounter>=0;subCounter--)
{
if(this.ship.subEntities[subCounter].hasRole(missile.primaryRole)) // if the sub-ent is the same as the missile being fired
{
missile.position = this.localToGlobal(this.ship.subEntities[subCounter].position); // move the fired missile to the sub-ent position
missile.orientation = this.ship.subEntities[subCounter].orientation.multiply(this.ship.orientation); // point the missile in the right direction
missile.desiredSpeed = missile.maxSpeed;
this.ship.subEntities[subCounter].remove(); // remove the sub-ent version of the missile
break; // come out of the loop, as we've done our swap
}
}
}
this.localToGlobal = function(position)
{ // sub-ent position is relative to mother, but for swapping we need the absolute global position
let orientation = this.ship.orientation;
return this.ship.position.add(position.rotateBy(orientation));
}
this.shipTakingDamage = function(amount, fromEntity, damageType)
{
if(this.ship.missiles.length === 0 && this.ship.subEntities.length === 0) // if we're all out of missiles and any sub-entities, bail out.
{ return; }
this.missileSubs = 0;
var subCounter = this.ship.subEntities.length - 1; // Set counter to number of sub-ents minus 1 (as entity array goes up from zero)
for(subCounter = this.ship.subEntities.length - 1;subCounter>=0;subCounter--)
{
if(this.ship.subEntities[subCounter].hasRole(this.missileRole)) // if the sub-ent is a missile, count it
{ this.missileSubs++; }
}
if(this.missileSubs === 0 && this.ship.subEntities.length === 0) // if we're all out of missiles and missile sub-entities, bail out.
{ return; }
if(this.missileSubs < this.ship.missiles.length) // if we've got more missiles than sub-entity missiles
{
this.ship.awardEquipment("EQ_MISSILE_REMOVAL"); // get rid of all missiles
if(this.missileSubs > 0)
{
var missileCounter = 0;
for(missileCounter = 0;missileCounter<this.missileSubs;missileCounter++) // restock with the correct number of selected missile
{ this.ship.awardEquipment(this.missileRole); }
}
return;
}
if(this.missileSubs > this.ship.missiles.length) // if we've got less missiles than sub-entity missiles
{
this.difference = this.missileSubs - this.ship.missiles.length;
var removeCounter = 0;
for(removeCounter = 0;removeCounter<this.difference;removeCounter++) // loop through however many subs we need to remove
{
var subCounter = this.ship.subEntities.length - 1; // Set counter to number of sub-ents minus 1 (as entity array goes up from zero)
for(subCounter = this.ship.subEntities.length - 1;subCounter>=0;subCounter--)
{
if(this.ship.subEntities[subCounter].hasRole(this.missileRole)) // if the sub-ent is a missile, remove it
{
this.ship.subEntities[subCounter].remove();
break;
}
}
}
return;
}
}
So I just bung your script into a js.script file?
Just looking at Murgh's Refugee Adder, it already has two js scripts (a populator and a namer). The thing is, the Refugee Adder is (sensibly) scared of all ships, and usually does a runner if I hang around too long after conversing on BCC with it. So I need some sort of switch which changes the AI from being terrified of me to being willing to follow me. Am I correct in presuming that there is none such in what you wrote?
ENTER = ("scanForNearestShipWithRole: player")
"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setDesiredRangeTo: 5000.0", checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DESIRED_RANGE_ACHIEVED" = (What you want them to do when they get there);
UPDATE = (performFlyToRangeFromDestination);
The BCC interaction is inside the Descriptions.plist
There is an xpatAI.plist which reads as follows:
Code: Select all
{
GLOBAL = {
ENTER = (
"setStateTo: HEAD_FOR_PLANET"
);
};
"GO_TO_RANDOM_STATION" = {
ATTACKED = (
setTargetToPrimaryAggressor,
"commsMessage: [xpat-appeal]",
fightOrFleeHostiles
);
"ATTACKER_MISSED" = (
"commsMessage: [xpat-appeal]",
performFlee,
"setStateTo: ATTACKED"
);
"CASCADE_WEAPON_DETECTED" = (
"setAITo: fleeQMineAI.plist"
);
"COURSE_OK" = (
"setSpeedFactorTo: 0.5",
performFlyToRangeFromDestination
);
"DESIRED_RANGE_ACHIEVED" = (
dockEscorts,
setTargetToNearestStation,
"setAITo: dockingAI.plist"
);
"DOCKING_REFUSED" = (
"setStateTo: CHECK_STATUS"
);
ENTER = (
"dropMessages: WAYPOINT_SET",
"setDesiredRangeTo: 15000.0",
setDestinationToTarget,
checkCourseToDestination
);
"INCOMING_MISSILE" = (
setTargetToPrimaryAggressor,
"sendTargetCommsMessage: [xpat-plea]",
"setStateTo: INCOMING_MISSILE",
"randomPauseAI: 0.25 1.5"
);
"NO_STATION_FOUND" = (
"switchAITo: exitingTraderAI.plist"
);
"TARGET_FOUND" = (
setTargetToFoundTarget,
"sendTargetCommsMessage: [xpat-plea]",
fightOrFleeHostiles
);
UPDATE = (
setTargetToLastStation,
"setDesiredRangeTo: 15000.0",
setDestinationToTarget,
checkCourseToDestination,
scanForHostiles,
"pauseAI: 10.0"
);
"WAYPOINT_SET" = (
"setAITo: gotoWaypointAI.plist"
);
};
"GO_TO_STATION" = {
"AEGIS_IN_DOCKING_RANGE" = (
dockEscorts,
setTargetToSystemStation,
"setAITo: dockingAI.plist"
);
ATTACKED = (
"setAITo: traderInterceptAI.plist",
performFlee,
"commsMessage: [xpat-plea]",
"setStateTo: HEAD_FOR_PLANET"
);
"ATTACKER_MISSED" = (
"commsMessage: [xpat-appeal]",
performFlee,
"setStateTo: ATTACKED"
);
"CASCADE_WEAPON_DETECTED" = (
"setAITo: fleeQMineAI.plist"
);
"COURSE_OK" = (
"setSpeedFactorTo: 0.5",
performFlyToRangeFromDestination
);
"DESIRED_RANGE_ACHIEVED" = (
dockEscorts,
setTargetToSystemStation,
"setAITo: dockingAI.plist"
);
"DOCKING_REFUSED" = (
"pauseAI: 40.0",
"commsMessage: [xpat-broadcast]",
"switchAITo: route2sunskimAI.plist"
);
ENTER = (
"dropMessages: WAYPOINT_SET",
setTargetToSystemStation,
"setDesiredRangeTo: 5000.0",
setDestinationToTarget,
checkCourseToDestination
);
"INCOMING_MISSILE" = (
"setAITo: traderInterceptAI.plist",
"setStateTo: INCOMING_MISSILE",
"randomPauseAI: 0.25 1.5"
);
"NO_STATION_FOUND" = (
"switchAITo: exitingTraderAI.plist"
);
"ROLL_1" = (
"commsMessage: [xpat-broadcast]",
"pauseAI: 40.0",
"setStateTo: GO_TO_STATION"
);
"ROLL_2" = (
"pauseAI: 40.0",
"setStateTo: GO_TO_STATION"
);
"TARGET_FOUND" = (
setTargetToFoundTarget,
"pauseAI: 40.0",
"rollD: 2"
);
UPDATE = (
setTargetToSystemStation,
"setDesiredRangeTo: 5000.0",
setDestinationToTarget,
checkCourseToDestination,
"scanForNearestShipWithRole: player",
"pauseAI: 10.0"
);
"WAYPOINT_SET" = (
"setAITo: gotoWaypointAI.plist"
);
};
"HEAD_FOR_PLANET" = {
"AEGIS_CLOSE_TO_MAIN_PLANET" = (
"setStateTo: GO_TO_STATION"
);
"AEGIS_IN_DOCKING_RANGE" = (
dockEscorts,
"setStateTo: GO_TO_STATION"
);
ATTACKED = (
"setAITo: traderInterceptAI.plist",
performFlee,
"commsMessage: [xpat-plea]",
"setStateTo: HEAD_FOR_PLANET"
);
"ATTACKER_MISSED" = (
"commsMessage: [xpat-appeal]",
performFlee,
"setStateTo: ATTACKED"
);
"CASCADE_WEAPON_DETECTED" = (
"setAITo: fleeQMineAI.plist"
);
"COURSE_OK" = (
"setSpeedFactorTo: 0.65",
performFlyToRangeFromDestination
);
"DESIRED_RANGE_ACHIEVED" = (
"setStateTo: GO_TO_STATION"
);
ENTER = (
setCourseToPlanet,
"setDesiredRangeTo: 30000.0",
"setSpeedFactorTo: 0.35",
checkCourseToDestination
);
"INCOMING_MISSILE" = (
"commsMessage: [xpat-appeal]",
performFlee,
"setStateTo: ATTACKED"
);
RESTARTED = (
checkAegis
);
"ROLL_1" = (
"commsMessage: [xpat-broadcast]",
"pauseAI: 40.0",
"setStateTo: HEAD_FOR_PLANET"
);
"ROLL_2" = (
"pauseAI: 40.0",
"setStateTo: HEAD_FOR_PLANET"
);
"TARGET_FOUND" = (
setTargetToFoundTarget,
"pauseAI: 40.0",
"rollD: 2"
);
UPDATE = (
setCourseToPlanet,
"setDesiredRangeTo: 30000.0",
checkCourseToDestination,
"scanForNearestShipWithRole: player",
"pauseAI: 10.0"
);
"WAYPOINT_SET" = (
"setAITo: gotoWaypointAI.plist"
);
};
}
I understand that .plists do not allow for an
either "this then that" or "that then this" logic.
Re: Information desired!
Posted: Tue Jul 09, 2024 8:27 pm
by LittleBear
Nah, the AI needs to go in the AI.
Something like this.
GLOBAL = "setState: CLOSE_WITH_PLAYER";
"CLOSE_WITH_PLAYER" = {
ENTER = ("scanForNearestShipWithRole: player")
"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setDesiredRangeTo: 1000.0", checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"ATTACKED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"ATTACKER_MISSED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
"DESIRED_RANGE_ACHIEVED" = (setState: MOVE_AWAY_FROM_PLAYER);
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
UPDATE = (performFlyToRangeFromDestination);
};
"MOVE_AWAY_FROM_PLAYER" = {
ENTER = ("scanForNearestShipWithRole: player")
"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setDesiredRangeTo: 1000.0", checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"ATTACKED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"ATTACKER_MISSED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
"DESIRED_RANGE_ACHIEVED" = (setState: CLOSE_WITH_PLAYER);
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
UPDATE = (performFlyToRangeFromDestination);
};
"ATTACK_SHIP" = {
ENTER = (setTargetToPrimaryAggressor, performAttack);
"FRIENDLY_FIRE" = ("setStateTo: BREAK_OFF");
"ATTACKED" = (setTargetToPrimaryAggressor, performAttack);
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, performAttack);
"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
"TARGET_DESTROYED" = (performIdle, "setStateTo: DECIDE_ROUTE");
"TARGET_LOST" = (performIdle, "setStateTo: DECIDE_ROUTE");
"NO_TARGET" = (performIdle, "setStateTo: DECIDE_ROUTE");
CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
"FRUSTRATED" = (performAttack);
};
With just these three states the NPC won't do anything at all until it detects the player. If you wanted it to do things when the player isn't there, then you need to add some states for navigation (such as HEAD_FOR_PLANET, HEAD_TO_WITCHPOINT etc, but do a scan for player whilst its in its navigation states.
Re: Information desired!
Posted: Tue Jul 09, 2024 8:48 pm
by Cholmondely
I'm sorry. I think that I failed to explain things properly.
1) Phantom seems to have no relevant AI for operating the Cloaking Device. So the Vanilla game code presumably supplies that.
2) Refugee Adder flees from everybody. If I converse with it via BCC, it will stop and natter with me but then start fleeing again (from me).
I want to be able to persuade it, in-game, that I'll escort it to the station/planet and protect it from the McNasties.
If I understand your script, it just forces the Refugee Adder to accept me as a good guy and follow me - without any persuasion. This seems unrealistic to me. How does it yet know that it can trust me?
Ideally, I'd like to be able to do the following:
If in a safe system (a democracy, say), persuade it to allow me to escort it to a safe station (or as an Adder, to the planet surface).
If somewhere nastier, persuade it to follow me through a wormhole towards somewhere safer and then escort it - or even just abandon it in the new system to make its own way safely.
Sorry to be a pain in the unmentionables...
Re: Information desired!
Posted: Wed Jul 10, 2024 1:40 am
by Wildeblood
Cholmondely wrote: ↑Tue Jul 09, 2024 8:48 pmRefugee Adder flees from everybody. If I converse with it via BCC, it will stop and natter with me but then start fleeing again (from me).
I want to be able to persuade it, in-game, that I'll escort it to the station/planet and protect it from the McNasties.
If I understand your script, it just forces the Refugee Adder to accept me as a good guy and follow me - without any persuasion. This seems unrealistic to me. How does it yet know that it can trust me?
You want two AIs: the existing one it has, and one like LittleBear is showing, call it something like FollowPlayer.plist. Then in some JS somewhere - once you have satisfied your conditions to do so - you will swap its usual AI for the FollowPlayer AI, with a function called something like setShipAITo(FollowPlayer.plist).
What is BCC, and where are its scripts - all worldscripts, or attached to individual ships?
Proceed as follows:
1. Search wiki to find correct name and syntax of native Oolite function that sets ship AIs.
2. Write your JS function that swaps a target ship's AI, using that.
3. Test in debug console, reassure yourself it works as you understand it to.
4. Create FollowPlayer AI, following LittleBear's lead.
5. Test your JS function again, using this new AI and existing refugee AI.
At this point, you should be able to make the refugee ship follow you or flee from you, using the debug console.
Get the AIs working properly before doing any more JS.
6. Search BCC related scripts for a suitable point to insert your JS function.
7. Come back here and report progress.
Alternative procedure:
1. Search BCC related scripts for a suitable point to insert your JS function.
2. Come back here, and report BCC scripts are a hellish nightmare of uncommented code.
Re: Information desired!
Posted: Wed Jul 10, 2024 5:40 am
by Cholmondely
Wildeblood wrote: ↑Wed Jul 10, 2024 1:40 am
What is BCC, and where are its scripts - all worldscripts, or attached to individual ships?
Thanking you, Sir! An "action plan" is
very helpful!
BCC = Phkb's
BroadCast Comms - which allows "communication" with NPC ships.
Hiran's "OXP Index" entry for BCC (Just those existing as OXZs and listed on the in-game Expansions Manager's "list".)
I was told that Phkb, Thargoid and cim had the best commented scripts.
Re: Information desired!
Posted: Thu Jul 11, 2024 1:41 am
by Wildeblood
Wildeblood wrote: ↑Wed Jul 10, 2024 1:40 am
1. Search wiki to find correct name and syntax of native Oolite function that sets ship AIs.
https://wiki.alioth.net/index.php/Oolit ... Ship#setAI
https://wiki.alioth.net/index.php/Oolit ... p#switchAI
Re: Information desired!
Posted: Thu Jul 11, 2024 6:11 am
by Cholmondely
Again, thanks. I'd found the first but was unsure whether it was definitely the one needed!
The problem is not understanding Java script - I utterly fail to understand any of what goes on. I had a look (3 years ago) in the innards of what is now "Equipment 'Sell Item' Color" OXP to add in a couple of items which then were not reddened by it, and could not understand
any of what I was looking at. Ditto with other attempts to decipher simple snippets of code (such as "BlOomberg Markets" OXP just a few months ago).
Thus with the wiki entry:
setAI
function setAI(AIName : String)
Set the current AI, leaving the old one suspended. Equivalent to the setAITo: AI method. May not be used on player. From 1.79 onwards AI files may either be plist-based (with a .plist extension) or Javascript-based (with a .js extension).
See also: AI, switchAI(), exitAI()
I don't understand what "String" is supposed to refer to. I do understand the rest (I think!) from editing the wiki and following along in these boards for several years. So what I'll do later today is see if I can find "setAI(" in a couple of OXPs which I think might have it (BCC, Synchronised Torus OXP, Escort Formations) and if I can work out what "string" is supposed to mean from them!
As I've grumbled previously, I'm convinced that back in the Aegidian day I'd have worked it all out (especially with OpenStep). But I understand that JavaScript allows one to do
so much more, that it's a waste of time to puzzle it (OpenStep) out (especially since so many OpenSteppers totally fail to get to grips with Javascript).
Edited for clarificatory purposes
Re: Information desired!
Posted: Thu Jul 11, 2024 6:50 am
by hiran
Cholmondely wrote: ↑Thu Jul 11, 2024 6:11 am
setAI
function setAI(AIName : String)
Set the current AI, leaving the old one suspended. Equivalent to the setAITo: AI method. May not be used on player. From 1.79 onwards AI files may either be plist-based (with a .plist extension) or Javascript-based (with a .js extension).
See also: AI, switchAI(), exitAI()
I don't understand what "String" is supposed to refer to. I do understand the rest (I think!) from editing the wiki and following along in these boards for several years. So what I'll do later today is see if I can find "setAI(" in a couple of OXPs which I think might have it (BCC, Synchronised Torus OXP, Escort Formations) and if I can work out what "string" is supposed to mean from them!
As I've grumbled previously, I'm convinced that back in the Aegidian day I'd have worked it all out (especially with OpenStep). But I understand that JavaScript allows one to do
so much more, that it's a waste of time to puzzle it out (especially since so many OpenSteppers totally fail to get to grips with Javascript).
Good question. String just means a sequence of characters. I guess it refers to the name of an AI or - like in the other thread - to a script filename. While the documentation needs to be improved we also need to be happy that we have something at all....
Re: Information desired!
Posted: Thu Jul 11, 2024 7:13 am
by Wildeblood
Sorry about the terseness of this morning's message; I'd just started it when Mr Flibble distracted me, so I clicked send with just the links, rather than abandon the message and have to go back to find the links again. TL;DR: It's all Flibble's fault.
You demonstrate what I have harped on about many times: the documentation requires code snippets to illustrate what it is trying to convey, because normal people don't read computer-documentation-ese. This:
function setAI(AIName : String)
is
not a snippet of javascript, it's documentation-ese. It intermingles parts which must be used exactly as given - including being case sensitive:
.setAI()
parts which are completely arbitrary:
.setAI(AIName)
and information about those parts:
function setAI(AIName
: String)
We already know setAI is a function, we went looking or it. So ignore that. The colon and word "String" are merely trying to convey that the one parameter, AIName, must appear inside chicken scratches, thus:
.setAI("AIName")
Or, in your case:
.setAI("FollowPlayer.plist")
Re: Information desired!
Posted: Thu Jul 11, 2024 8:10 am
by Wildeblood
Okay, it's activated equipment, using (b) to cycle through a list of possible messages, and (n) to - ostensibly - transmit the selected message to the current player.ship.target.
Overview
========
This OXP provides a means by which the player can communicate in a real way with other ships. That is, the types of communications the player transmits will have a bearing on the game in some way, depending on the transmission type
There are 11 types of transmissions:
In reality, it's 11 OXPs in one, each having a different effect on NPCs, and the player selects which of those game-play alterations he wants by "transmitting a message". (Is this a fair comment, phkb, or am I over-simplifying too much?)
Phkb has helpfully included a method to extend BCC with new messages, so you won't need to go trawling through its scripts.
You need to specify your requirements more precisely, by expounding (not expanding) on this:-
Cholmondely wrote: ↑Tue Jul 09, 2024 8:48 pm
I want to be able to persuade it, in-game, that I'll escort it to the station/planet and protect it from the McNasties.
If I understand your script, it just forces the Refugee Adder to accept me as a good guy and follow me - without any persuasion. This seems unrealistic to me. How does it yet know that it can trust me?
Ideally, I'd like to be able to do the following:
If in a safe system (a democracy, say), persuade it to allow me to escort it
How will this persuasion work? The simplest way is a single magic reset button, labelled "Change test ship AI to follow player" or "Transmit secret code-word provided by Free The Slaves! NGO" where pressing the (n) activate key calls the AI resetting function immediately. Other obvious possibilities are a counter, where the player has to transmit messages repeatedly, until a specific number is reached, or a timer, where the player has to interact with the NPC for a while, before the reset occurs. Or, any combination of pre-conditions you care to define...?
Re: Information desired!
Posted: Thu Jul 11, 2024 5:14 pm
by hiran
Wildeblood wrote: ↑Thu Jul 11, 2024 8:10 am
How will this persuasion work? The simplest way is a single magic reset button, labelled "Change test ship AI to follow player" or "Transmit secret code-word provided by Free The Slaves! NGO" where pressing the (n) activate key calls the AI resetting function immediately. Other obvious possibilities are a counter, where the player has to transmit messages repeatedly, until a specific number is reached, or a timer, where the player has to interact with the NPC for a while, before the reset occurs. Or, any combination of pre-conditions you care to define...?
Hmm. Under which circumstances would one be able to influence another ship or it's crew that much? I thought about spying, but this thread here is going further.
See
viewtopic.php?t=21663
Re: Information desired!
Posted: Fri Jul 12, 2024 8:20 am
by Cholmondely
Current state of affairs.
Busy for the next few days.
Murgh's Refugee Adder (oolite.oxp.Murgh.prohip_xpat_b2WIP.oxp) has an old-style AI.plist and a descriptions.plist providing the dialogue for BCC.
So what I presume I need to do now is
1) Add in LittleBear's code above (presuming compatibility), ensuring that it is properly labelled (ie identifiable by the presumed combination of BCC and the ship script inside the shipdata.plist)
2) Work out how to "energise it" from within BCC, and generate an appropriate dialogue.
Musings for the future:
1) Wildeblood's ideas about timers/counters for repeated attempts to bamboozle the Refugee Adder
2) Not all Refugee Adder pilots will be the same. A handful might have decent piloting skills (accuracy, speed of reaction) to fight back attackers - possibly needing more persuasion to accept escorting - and also being able to fight back meaningfully against a small number of attackers. One or two of these hand-made ships might even have an old beam laser stuck on the front!
3) BCC is an add-on, not an "everybody has one" item. What about Refugee Adders without one?