User:Cholmondely/programming adventures
An attempt to get Refugee Adders to trust and follow me in dangerous systems.
Contents
Overview
This requires (i) mucking about with their AIs (getting them to follow me) and (ii) constructing a believable method for generating this "trust".
Background
Having been most impressed by Murgh's addition of personality to his early OXPs, and with his recent work on his Refugee Adder, I very much want to add the possibility of an ethical interaction with both these ships and others.
The Problem
The Refugee Adder at the moment just runs away. If I try to protect it en-route to a safe haven (eg the Main Orbital Station) it just runs from me. With BCC I can engage it in conversation, but this seems to have no impact on its behaviour (Murgh built in a decent BCC dialogue into his OXP, but it seems to have little impact on AI). And there seems to exist no mechanism as yet to transfer food/wine&liqueurs/medicine/water/fuel from my ship to the Refugee Adder.
AI work (the following bit)
Littlebear suggested this AI would do the trick:
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);
Littlebear also added:
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 your 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 (1km). When it gets to the desired range switch it back to the first state. It will then fly between 1 and 5 kms from the player.
Presumably this AI has to be in either an AI.plist or in a .JS file of some sort.
Queries
1: Need to find out about where JS AI's go. Is it just a .js script sitting in the AIs folder ("Holds AI plists")?
2: How about using the older AI.plist and the EscortAI? Might that be simpler?
- But. If my ship is powerful enough to protect the Refugee Adder, I don't need it to fight for me - and just want it to scram if I get in a fight. But, this EscortAI would be better than the current status quo where the RA just avoids me!
BCC work (the persuasion bit)
Wildeblood was good enough to spend a lot of time explaining about how to do this.
Firstly - how to get the Refugee Adder to change its AI, and secondly - about linking it into BCC.
I'll want to link in my dialogue with what Murgh has already added into his OXP.
References
Programming References
- Hiran's Database with JS scripts listed for each OXP
The Future
Will next want a similar thing for the Commies convict ships!
This might involve much more: Escaping Prisoners (in Mining Pods from Commies OXP) - see especially the notes on communication and scooping for potential differences!