The Feudal States

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Re: The Feudal States

Post by Ramirez »

The feudal-challengerhomeAI is only there to return the NPC to the station once the challenge has been completed, so really there's no need to trigger more flee actions. Try removing the following lines from the GO_TO_STATION state:

Code: Select all

ATTACKED = ("setStateTo: FLEE"); 
FIGHTING = ("setStateTo: FLEE");
FLEEING = ("setStateTo: FLEE");
Download Resistance Commander plus many other exciting OXPs HERE
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: The Feudal States

Post by Switeck »

zsozso wrote:
I tried with all setAI replaced by switchAI in feudal-target.js, but the stackOverflow errors still occur. The only difference is that now the log does not mention the script feudal-target.js, only feudal-challengerhomeAI.plist such as :

Code: Select all

[ai.error.stackOverflow]: ***** ERROR: AI stack overflow for <ShipEntity 0xe80eed0>{"Prinz-Class Zerstoerer (Erinain)"} in feudal-challengerhomeAI.plist: FLEE -- stack:

  [ai.error.stackOverflow.dump]:  31: feudal-challenger2AI.plist: ATTACK_SHIP
  [ai.error.stackOverflow.dump]:  30: feudal-challengerhomeAI.plist: FLEE
  [ai.error.stackOverflow.dump]:  29: feudal-challengerhomeAI.plist: FLEE
Then this keeps repeating several times. So there seems to be some internal problem in the AI plist state-machine itself.
This may be distantly related to:
https://bb.oolite.space/viewtopic.php?f=3&t=9638
...Where a Thargoid warship got:
12:42:51.609 [ai.message.failed.overflow]: ***** ERROR: AI pending messages overflow for 'Thargoid Warship 647'; pending messages:
zsozso
Above Average
Above Average
Posts: 23
Joined: Tue Apr 12, 2011 3:54 pm
Location: Toronto, Canada

Re: The Feudal States

Post by zsozso »

Ramirez wrote:
The feudal-challengerhomeAI is only there to return the NPC to the station once the challenge has been completed, so really there's no need to trigger more flee actions. Try removing the following lines from the GO_TO_STATION state:

Code: Select all

ATTACKED = ("setStateTo: FLEE"); 
FIGHTING = ("setStateTo: FLEE");
FLEEING = ("setStateTo: FLEE");
This worked! I see no more error messages after removing those, and the defeated ship now turns around and heads back to the base (Hunting Lodge) while before it kept going away (fleeing) indefinitely.

Thanks a lot!
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Re: The Feudal States

Post by Ramirez »

Version 1.10 of The Feudal States is now up at my site. Changes include:
  • A Japanese-themed set of houses for Galaxy 6
  • fix to the AI stack overflow error
  • improved mission descriptions
  • a new 'Tribute' mission type involving the lesser feudal states
  • improvement to the promotion handling script
  • repositioning of hunting lodges for compatability with FarSun and other such OXPs
  • various minor fixes and cleanups
Enjoy!
Download Resistance Commander plus many other exciting OXPs HERE
zsozso
Above Average
Above Average
Posts: 23
Joined: Tue Apr 12, 2011 3:54 pm
Location: Toronto, Canada

Re: The Feudal States

Post by zsozso »

Playing a bit more with this OXP while also doing some other missions, I found something that bothered me. I understand the rule of no missiles or bombs for the challenge, but I do not like the way it is enforced by simply calling player.ship.awardEquipment("EQ_MISSILE_REMOVAL"). Usually, I have a Missile Machine (5,000Cr, needs high tech level to buy) and other expensive and hard to find bombs equipped, so simply losing them (or even selling them off prior to challenge) is a royal PITA -- meaning Pain In The Armoury, of course. So I'd much prefer a temporary impounding by the Hunting Lodge, so that you get back all your equipment once you dock back after the fight, just like it restores energy bomb and cloaking device that are temporary disabled.

I have managed to add this temporary missile/bomb impounding functionality to the feudal-challenge.js script by extending the following two functions:

Code: Select all

this.disableSystems = function()
{
	if(player.ship.equipmentStatus("EQ_CLOAKING_DEVICE") == "EQUIPMENT_OK")
		{	player.ship.setEquipmentStatus("EQ_CLOAKING_DEVICE", "EQUIPMENT_DAMAGED")
			player.consoleMessage("Cloaking Device disabled")
		}
		
	if(player.ship.equipmentStatus("EQ_ENERGY_BOMB") == "EQUIPMENT_OK")
		{	player.ship.setEquipmentStatus("EQ_ENERGY_BOMB", "EQUIPMENT_DAMAGED")
			player.consoleMessage("Energy Bomb disabled")
		}
	this.storeMissileArray = player.ship.missiles;
	player.ship.awardEquipment("EQ_MISSILE_REMOVAL")
	player.ship.awardEquipment("EQ_FEUDAL_FLARE_MINE")
}

this.restoreSystems = function()
{	if(player.ship.equipmentStatus("EQ_CLOAKING_DEVICE") == "EQUIPMENT_DAMAGED")
		{	player.ship.setEquipmentStatus("EQ_CLOAKING_DEVICE", "EQUIPMENT_OK")
			player.consoleMessage("Cloaking Device re-enabled")
		}
		
	if(player.ship.equipmentStatus("EQ_ENERGY_BOMB") == "EQUIPMENT_DAMAGED")
		{	player.ship.setEquipmentStatus("EQ_ENERGY_BOMB", "EQUIPMENT_OK")
			player.consoleMessage("Energy Bomb re-enabled")
		}
	player.ship.awardEquipment("EQ_MISSILE_REMOVAL")
	for(restoreCounter = 0;restoreCounter<this.storeMissileArray.length;restoreCounter++)
        { 
		player.ship.awardEquipment(this.storeMissileArray[restoreCounter].equipmentKey); 
	}
}
In addition to the above changes, I had to remove all other calls to player.ship.awardEquipment("EQ_MISSILE_REMOVAL") and also make sure that function disableSystems() is only called once -- in release 1.10 it is called twice, once when accepting the challenge and again when the ship is launched from the station, I just kept the later one. The player.ship.awardEquipment("EQ_FEUDAL_FLARE_MINE") call is also moved into the disableSystems() call so it is not needed in its original place.

Ramirez, if you agree with this little tweak, I would be thankful if you included it in future releases.
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: The Feudal States

Post by Zireael »

I think that tweak is nice...
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: The Feudal States

Post by Mauiby de Fug »

Ooh, nice!
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Re: The Feudal States

Post by Ramirez »

Many thanks - I had been putting this off as for some reason I thought it was too difficult to do, but it looks like it's quite simple after all. Plus, I'll need to use the same method for the Guerilla War OXP as well.

I have no problem with putting this in; also I'll look to using it in the tournament script as well as there are instances there where I need to remove a player's missiles temporarily. Will get onto it when I have a moment.
Download Resistance Commander plus many other exciting OXPs HERE
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: The Feudal States

Post by Commander McLane »

Another addition would be to rename the functions to this.$disableSystems and this.$restoreSystems, and generally putting a '$' in front of all self-defined functions (as opposed to event handlers). Don't forget to put it in also in the places where the functions are called.

Ahruman would be grateful.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: The Feudal States

Post by Thargoid »

Rather than damaging them, I would suggest removing the cloak and e-bomb and awarding a dummy piece of equipment in each case that does nothing other than act as a place-holder that the original item has been removed. Then when you want to restore, if the placeholder dummy is present then remove it and re-award the original.

In the code above if the repair system is installed, or if it's done on a Caduceus or a Vortex then the relevant systems will kick in and try and repair (and re-award) the items which isn't what you want.

The placeholder method works well, a few of my OXPs use it (for example the ECM Jammer in TCAT).

The missile removal and re-award technique is basically how the multi-missile bay system works in the Vortex too.
zsozso
Above Average
Above Average
Posts: 23
Joined: Tue Apr 12, 2011 3:54 pm
Location: Toronto, Canada

Re: The Feudal States

Post by zsozso »

Indeed, Thargoid is right, I've seen the MAC kick in and repair my e-bomb during challenge as I use a Vortex ship.

BTW, the Vortex multi-missile bay system was the code that "inspired" me to do the above tweak -- you may call it stealing or borrowing code as well :wink:
But I did make a simplification by skipping the stringification and stored in local variable instead of mission variable.
JD
Deadly
Deadly
Posts: 182
Joined: Thu Nov 25, 2010 10:42 pm
Location: London, UK

Re: The Feudal States

Post by JD »

The disable/repair technique might also present a cheap way of getting some already damaged equipment fixed.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: The Feudal States

Post by Commander McLane »

zsozso wrote:
But I did make a simplification by skipping the stringification and stored in local variable instead of mission variable.
Which is fine, as long as the player cannot save and reload his game between the switches. If he could and would, all local variables would be gone.
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 546
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: The Feudal States

Post by Lone_Wolf »

Commander McLane wrote:
zsozso wrote:
But I did make a simplification by skipping the stringification and stored in local variable instead of mission variable.
Which is fine, as long as the player cannot save and reload his game between the switches. If he could and would, all local variables would be gone.
That sounds like a small change in the challenge duel code is due, since it now states that returning to the lodge (without winning ..) or jumping out of system forfeits the challenge.
Maybe make it so that docking anywhere means you forfeit the challenge ?

(main station alone is not enough, as with save anywhere you can save from other stations also)

Given that the challenge is done 'in the spririt of chivalry' , it seems rude to keep your opponent waiting ...
OS : Arch Linux 64-bit - rolling release

OXPs : My user page

Retired, reachable at [email protected]
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: The Feudal States

Post by Thargoid »

Lone_Wolf wrote:
(main station alone is not enough, as with save anywhere you can save from other stations also)
Actually it is, as even save anywhere does save at the main station. It just cleverly moves you to it, enables the save and then moves you back to where you originally were. So you will be docked at the main station when you do save.
Post Reply