Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

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

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

Moderators: winston, another_commander

Post Reply
User avatar
Phasted
Competent
Competent
Posts: 51
Joined: Wed Jun 09, 2010 3:56 pm

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

Post 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.
User avatar
Gimi
---- E L I T E ----
---- E L I T E ----
Posts: 2073
Joined: Tue Aug 29, 2006 5:02 pm
Location: Norway

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

Post 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.
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
User avatar
Phasted
Competent
Competent
Posts: 51
Joined: Wed Jun 09, 2010 3:56 pm

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

Post 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!])
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: I finally figured it out... about three weeks ago

Post 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.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

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

Post 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.
Post Reply