Page 1 of 1

Could NPCs be made more likley to jump out?

Posted: Wed Jun 20, 2007 6:33 pm
by LittleBear
In playing the game, NPCs very rarely seem to make hyperspace jump to escape. As players we'd usually get a hyperspace lock on another system, if fuel's available, just in case things get really tough. I've seen em jump occasionally and following them though their own wormhole was cool. Would it be do-able to up the chance of NPCs jumping out when on ENERGY_LOW?

Posted: Wed Jun 20, 2007 7:10 pm
by Cmdr. Maegil
In Oolite\oolite.app\Contents\Resources\AIs\route1traderAI.plist, you'll find

Code: Select all

    FLEE = {
        ATTACKED = (fightOrFleeHostiles); 
		FIGHTING = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
		FLEEING = (setTargetToPrimaryAggressor, "setStateTo: FLEE");
        "TARGET_LOST" = (performIdle, "setStateTo: GLOBAL"); 
        "TARGET_DESTROYED" = (performIdle, "setStateTo: GLOBAL"); 
        ENTER = ("setDesiredRangeTo: 25600", performFlee); 
        EXIT = (); 
        "INCOMING_MISSILE" = (setTargetToPrimaryAggressor, broadcastDistressMessage, fightOrFleeMissile, fightOrFleeHostiles); 
        "REACHED_SAFETY" = (performIdle, "setStateTo: GLOBAL"); 
        UPDATE = (); 
Change

Code: Select all

		FLEEING = (setTargetToPrimaryAggressor, "setStateTo: FLEE");
to

Code: Select all

		FLEEING = (setTargetToPrimaryAggressor, "setSpeedFactorTo: 1.0", "pauseAI: 15.0", "setStateTo: EXIT_SYSTEM"); 
and add

Code: Select all

    "EXIT_SYSTEM" = {
		ENTER = ();
		EXIT = ();
		UPDATE = (performHyperSpaceExit);
		"WITCHSPACE OKAY" = (wormholeEscorts);
		"WITCHSPACE BLOCKED" = (setTargetToFoundTarget, setDestinationWithinTarget, "setDesiredRangeTo: 10000.0", performFlyToRangeFromDestination);
		"WITCHSPACE UNAVAILABLE" = ("setAITo: route1traderAI.plist");
	}; 
That should do it. Maybe?

Posted: Wed Jun 20, 2007 7:21 pm
by LittleBear
I'll give that a try. I thought it might be hard coded, but that AI should work. Might do a quick brave_sir_robin.oxp hack. Make traders say 50% likely to jump out on energy low (if they can) and 50% likely to flee (either on injectors or normal power). Too higher chance or to low?

Posted: Wed Jun 20, 2007 7:46 pm
by johnsmith
I did an AI using that method, and can confirm that it worked. Of course you can allways follow then through the wormhole if you're quick.

Posted: Sat Jun 23, 2007 1:52 pm
by Cmdr. Maegil
LittleBear wrote:
Might do a quick brave_sir_robin.oxp hack.
With soundtrack?

http://www.stmoroky.com/sirrobin/robin~~.au
http://www.stmoroky.com/sirrobin/meeting~~.au
http://www.stmoroky.com/sirrobin/fleeing~~.au

Or will the minstrels be eaten followed by much rejoicing?

Posted: Sat Jun 23, 2007 2:05 pm
by LittleBear
Done a tweaked AI (so installing the OXP gives all ships with the role "trader" this run-away AI). Doing a "sendCommsMessage: [runaway1] [runaway2] [runaway3] [tones] [cargo]" So the trader sends a random word from each list as a message when jumping out such as:-

"Beastly Brigand! I'm bravely running away to save my 7 tones of food!"

Wonder if I could make it play an .ogg at the same time!