Page 1 of 1

I finally figured it out... about three weeks ago

Posted: Sat Mar 12, 2011 4:28 pm
by Phasted
The solution to my posting-ships-relative-to-the-Behemoth-problem:

Code: Select all

this.postFrigates = function()
{
	if(this.ship.hasHostileTarget) {return;}
	if((!this.myF1) || (!this.myF1.isValid)) {this.shipIdentifiers();}

	var vector000, vector120, vector240;
	var F1_post, F2_post, F3_post;
	var pi_by_3 = (Math.PI / 3), pi_by_n3 = (Math.PI / -3);
	var cos_60 = Math.cos(pi_by_3);
	var sin_60 = Math.sin(pi_by_3), sin_n60 = Math.sin(pi_by_n3);
	var quat1 = [cos_60, 0, sin_60, 0];
	var quat2 = [cos_60, 0, sin_n60, 0];

	vector000 = this.ship.heading.direction();
	vector120 = vector000.rotateBy(quat1);
	vector240 = vector000.rotateBy(quat2);
	F1_post = this.ship.position.add(vector000.multiply(10375));
	F2_post = this.ship.position.add(vector240.multiply(10187.5));
	F3_post = this.ship.position.add(vector120.multiply(10187.5));
	if(this.myF1)
	{
		this.myF1.savedCoordinates = F1_post;
		this.myF1.reactToAIMessage("POST");
		log(this.name, 	"\n** " + this.myF1.displayName + " has been posted... **");
	}
	if(this.myF2)
	{
		this.myF2.savedCoordinates = F2_post;
		this.myF2.reactToAIMessage("POST");
		log(this.name, 	"\n** " + this.myF2.displayName + " has been posted... **");
	}
	if(this.myF3)
	{
		this.myF3.savedCoordinates = F3_post;
		this.myF3.reactToAIMessage("POST");
		log(this.name, 	"\n** " + this.myF3.displayName + " has been posted... **");
	}
}
The function for posting the Transports is a bit more elaborate, but essentially the same.

I had a small problem with the Behemoth wanting to change course a little whenever the lead Frigate jumped directly into his path. The fix was to reduce the Behemoth's scanner_range to 7,500 meters.

Many thanks to Professor Walch (without his BuoyRepair OXP, the answer would likely have eluded me forever!), and everyone else who offered assistance.

Re: I finally figured it out... about three weeks ago

Posted: Sat Mar 12, 2011 4:34 pm
by Gimi
Phasted wrote:
I had a small problem with the Behemoth wanting to change course a little whenever the lead Frigate jumped directly into his path. The fix was to reduce the Behemoth's scanner_range to 7,500 meters.
Question, (possibly a stupid one). What happens if the player starts sniping at the Behemoth from lets say 15000m. Will it know who is hitting it, and also, will any ships launched from the behemoth know where you are, or doesn't it matter.

Re: I finally figured it out... about three weeks ago

Posted: Sat Mar 12, 2011 4:47 pm
by Phasted
Gimi wrote:
Question, (possibly a stupid one). What happens if the player starts sniping at the Behemoth from lets say 15000m. Will it know who is hitting it, and also, will any ships launched from the behemoth know where you are, or doesn't it matter.
Not a stupid question, at all...

I don't think the AI command "setTargetToPrimary Aggressor" depends on the range of the scanner. (If it does, then I guess I have some more thinking to do :roll: [aaarrrgh!])

Re: I finally figured it out... about three weeks ago

Posted: Sat Mar 12, 2011 5:24 pm
by Commander McLane
Phasted wrote:
I don't think the AI command "setTargetToPrimary Aggressor" depends on the range of the scanner.
I tend to think it does, inasmuch as NPCs cannot target anything outside their scanner range/lose their targets as soon as these are outside scanner range.

That's at least what I think about how targeting works.

Re: I finally figured it out... about three weeks ago

Posted: Sat Mar 12, 2011 5:52 pm
by Eric Walch
Phasted wrote:
Gimi wrote:
Question, (possibly a stupid one). What happens if the player starts sniping at the Behemoth from lets say 15000m. Will it know who is hitting it, and also, will any ships launched from the behemoth know where you are, or doesn't it matter.
Not a stupid question, at all...

I don't think the AI command "setTargetToPrimary Aggressor" depends on the range of the scanner. (If it does, then I guess I have some more thinking to do :roll: [aaarrrgh!])
I think you should change the range in the AI and not in the ships definition. The AI line:

Code: Select all

"setDesiredRangeTo: 50000.0", checkCourseToDestination
means is looks for a free course for 50000 meters. Just lower that value to 7500. The ship will now only anticipate to close by obstacles and normal scanner range is unaffected.