• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Capsizing Ships

That does sound good! Thanks very much for taking this one on! :woot

What kind of problem are you having with the crewmembers flying off?

As for the storms being too short, you can change the code in NK.c to happen more easily.
If you decrease these values, it'll be easier to trigger any of the events:
Code:
#define ROLL_ANGLE_WARNING 11
#define ROLL_ANGLE_MORALE  12
#define ROLL_ANGLE_GOODS   13
#define ROLL_ANGLE_DAMAGE  14
#define ROLL_ANGLE_CAPSIZE 15
Just make sure none of them get the same value as another, but if you substract a couple of degrees from all, it should help.

Also, there's a minimum of a ten second delay between each event.
But if you find this:
Code:
sti(rCharacter.Capsize.Time) > 10
And replace it with, say, this:
Code:
sti(rCharacter.Capsize.Time) > 5
It'll be changed to a five-second delay and therefore happen much quicker, so you won't need such a long storm.

A regular (non-extended) storm lasts 60 seconds. There is five events, each with a 10 second delay.
Therefore actual capsizing can only happen in the last 10 seconds of the storm.
Also if after the 10 second delay for the event, you are not (yet) over the roll angle trigger value, you're delaying it further.
As such, preventing the actual capsizing from happening during a regular storm because fairly simple.
However, sometimes a storm will last ANOTHER 60 seconds afterwards, so then it becomes much easier and gameplay-wise more dangerous.

The fact that you're finding it so hard to actually get yourself to capsize does indicate to me that we might have some fairly playable balancing now.
I HAVE seen capsizes with the current code, but it's definitly not all the time and can be countered from what I have observed.
 
I think someone suggested that before and I reckon we should be able to indeed make us of it for that.
We can't actually do it without sinking the player ship, but we can work around that by just giving the ship back afterwards.
It'll just be a while until we get to coding any AWE stuff...
 
That does sound good! Thanks very much for taking this one on! :woot
Not a problem- it's all good practice for me! :dance

What kind of problem are you having with the crewmembers flying off?
Well when I use this code you gave me:
Code:
float fX = stf(rCharacter.Ship.pos.x);
float fY = stf(rCharacter.Ship.pos.y);
float fZ = stf(rCharacter.Ship.pos.z);
CreateParticleSystemX("gunfire",    fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), 6.0, 4.0, 0.0, 0);
and replace 'gunfire' with 'flyers', the game refuses to start and gives a runtime error.
However, I don't yet fully understand it anyway, so something here may not make sense when using 'flyers'...?

The fact that you're finding it so hard to actually get yourself to capsize does indicate to me that we might have some fairly playable balancing now.
I HAVE seen capsizes with the current code, but it's definitly not all the time and can be countered from what I have observed.
It's a good sign- you don't exactly want to capsize in EVERY storm you encounter... that would be very inconvenient.
But for test purposes, I'll use those changes you mentioned- I'm dying to see the effects (at my ship's expense)! :rofl

is anybody else thinking what i'm thinking? rolling the pearl over in AWE!
Now THAT sounds like a good idea... now all we need is to actually make the ship ROLL OVER when it capsizes...
 
and replace 'gunfire' with 'flyers', the game refuses to start and gives a runtime error.
However, I don't yet fully understand it anyway, so something here may not make sense when using 'flyers'...?
AH! I think I know what's wrong. You've got the float-code in there twice, right?
Solution: move the code up like this:
Code:
void UpdateShipRoll()
{
ref rCharacter = GetMainCharacter();
if(Whr_IsStorm() && CheckAttribute(rCharacter,"Capsize") && GetCharacterShipClass(rCharacter) < 8)
{
int RollDamageValue;
int i;
string sshiproll;
float fX = stf(rCharacter.Ship.pos.x);
float fY = stf(rCharacter.Ship.pos.y);
float fZ = stf(rCharacter.Ship.pos.z);
Now don't add these lines anywhere else and just put a CreateParticleSystemX where you want. That should work. :yes

It's a good sign- you don't exactly want to capsize in EVERY storm you encounter... that would be very inconvenient.
Very much agreed. I just got myself in a storm and while I did get close to capsizing, I didn't actually manage. But it IS still possible occasionally.

Now THAT sounds like a good idea... now all we need is to actually make the ship ROLL OVER when it capsizes...
Not a problem. If I increase the value, we can make her do a full 360 or something. It'll look silly, but it'll work. :cheeky
 
AH! I think I know what's wrong. You've got the float-code in there twice, right?
Yes, and I tried your suggestion. The game started, but I didn't see the desired particle effects when testing...
But the sound effects work perfectly!! :yes

[Not a problem. If I increase the value, we can make her do a full 360 or something. It'll look silly, but it'll work. :cheeky
So if this is possible, then why not make it so that when any ship capsizes, the roll angle becomes such that she physically rolls over?
Surely that's what is meant to happen...
 
Yes, and I tried your suggestion. The game started, but I didn't see the desired particle effects when testing...
But the sound effects work perfectly!! :yes
I didn't notice the effect either when I did a quick test, but it should work theoretically.
This code for the Kraken Attack at least DOES work:
Code:
			if(rand(1) == 0) CreateParticleSystem("flyers",      fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), 0.0, 0.0, 0.0, 0);
if(rand(1) == 0) CreateParticleSystem("flyers2",     fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), 0.0, 0.0, 0.0, 0);
if(rand(1) == 0) CreateParticleSystemX("ball_splash",fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), 3.0, 7.0, 0.0, 0);
if(rand(1) == 0) CreateParticleSystemX("ball_splash",fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), 0.0, 7.0, 3.0, 0);
if(rand(1) == 0) CreateParticleSystemX("ball_splash",fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), -2.0, 8.0, 0.0, 0);
if(rand(1) == 0) CreateParticleSystemX("ball_splash",fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), 0.0, 9.0, -3.0, 0);
if(rand(1) == 0) CreateParticleSystemX("gunfire",    fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), 6.0, 4.0, 0.0, 0);
if(rand(1) == 0) CreateParticleSystemX("gunfire",    fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), 0.0, 4.0, 7.0, 0);
if(rand(1) == 0) CreateParticleSystemX("gunfire",    fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), -6.0, 5.0, 0.0, 0);
if(rand(1) == 0) CreateParticleSystemX("gunfire",    fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), 0.0, 5.0, -7.0, 0);

So if this is possible, then why not make it so that when any ship capsizes, the roll angle becomes such that she physically rolls over?
Surely that's what is meant to happen...
Indeed the capsizing doesn't completely roll over anymore.
Let me increase the value and see if I can get anything better.
I think I decreased it because it was starting to look silly to me... :?
 
So if this is possible, then why not make it so that when any ship capsizes, the roll angle becomes such that she physically rolls over?
Surely that's what is meant to happen...
In PROGRAM\SEA_AI\AIShip.c find:
Code:
		if(rDead.Capsize.Angle > 0) // Capsizing to Starboard
{
aSink.Speed.y = 0.25 + (frnd() * 0.05 ); // speed of sink y
aSink.Speed.x =  0.025 - 0.05 * frnd(); // speed sink angle rotate around x
aSink.Speed.z = -0.05; // speed sink angle rotate around z
}
else // Capsizing to Port
{
aSink.Speed.y = 0.25 + (frnd() * 0.05 ); // speed of sink y
aSink.Speed.x =  0.025 - 0.05 * frnd(); // speed sink angle rotate around x
aSink.Speed.z =  0.05; // speed sink angle rotate around z
}
Replace it with:
Code:
		if(rDead.Capsize.Angle > 0) // Capsizing to Starboard
{
aSink.Speed.y = 0.25 + (frnd() * 0.05 ); // speed of sink y
aSink.Speed.x =  0.025 - 0.05 * frnd(); // speed sink angle rotate around x
aSink.Speed.z = -0.15; // speed sink angle rotate around z
}
else // Capsizing to Port
{
aSink.Speed.y = 0.25 + (frnd() * 0.05 ); // speed of sink y
aSink.Speed.x =  0.025 - 0.05 * frnd(); // speed sink angle rotate around x
aSink.Speed.z =  0.15; // speed sink angle rotate around z
}
This speeds up the capsizing and makes the ships roll over into the water completely.
For the AWE part, we'd just have to increase the value some more. :cheeky
 
I've used that code and the ship now seems to capsize as it should do- it looks about right. :onya

Still confused about the particle effects, though. They should work. :modding
Would I need to change some numbers at the end of the 'CreateParticleSystemX' line?
And I noticed that for the 'flyers', there is no X after 'CreateParticleSystem' in the Kraken code. Is that significant?
 
And I noticed that for the 'flyers', there is no X after 'CreateParticleSystem' in the Kraken code. Is that significant?
You've got a good eye, mate. I hadn't even noticed that myself at the moment.
I think that indeed IS significant. I know the Kraken attack version works, so I recommend you go with that one. :yes
 
It's kinda hard to hold my arms down when reading about this \o/

Great idea, Pieter - I really think your work with this mod is much appreciated. I personally look forward to update 3 and will help you test it further. The current storm code in the beta version seem alright, I personally never crashed in a storm so I think testing will be rewarding in the matters of bughunting on this one.
 
Thanks, mate. Depending on whether I'll have time and internet or not,
I'll try to make a patch 3 later today or tomorrow morning before I heard back to sea.
I do think I quite like how this mod turned out. :)
 
You've got a good eye, mate. I hadn't even noticed that myself at the moment.
Aye aye, me eye's well trained tah spy on them enemy ships through me trusty spyglass! Argh! :keith
I'll remove the X for the 'flyers' line, then. What are the numbers at the end of the line for?

I do think I quite like how this mod turned out. :)
You're not the only one, mate! :2up
 
I'll remove the X for the 'flyers' line, then. What are the numbers at the end of the line for?
I'm not 100% sure. The lines with x,y,z in them are coordinates and the other ones, I think, have something to do with the angle at which the particle effect is executed.
 
If you have anything working yet and you want it included in the Patch 3 I'm trying to release tomorrow morning,
please post your file as soon as you can. This will be the last patch by me for a few months, because I'll be away at sea.
 
Argh! Sorry I'm late for the Patch 3 release!! :modding

Oh well; here's the latest version of the file with working sound effects as described before.
Still NO working particle effects as far as I know :modding but I've left in the code which I tried anyway.
I've also put a comment explaining that, for test purposes, one can adjust the required roll angles to make it easier to experience each warning.

Oh, and I'll also upload the AIShip.c while I'm at it, which now makes the ship physically roll over when capsizing.

If anyone wishes to test and comment, you'd be most welcome to!

[attachment=5210:NK.c] (Goes in PROGRAM folder)

[attachment=5211:AIShip.c] (Goes in PROGRAM \ SEA_AI)
 
I tried your addons to patch 3 and just now managed to capsize my first ship. :drunk It was a trade brig that refused to turn right, so I turned left until things got interesting. Everything seemed to work ok with crew yelling, goods falling overboard, and hull damage from shifting cargo. :onya
 
That's what I like to hear! :woot
As long as all the sound effects work fine with the events, that's great.
Do you like them, or do you have any other suggestions? I tried to make it sound as realistic as possible. :onya
 
Thanks very much; I definitly like them! :onya
I wonder... for the cargo going overboard, is there some sort of "splash" sound you could use somewhere?

As for the particle effects, I reckon they might be working, but are so subtle they're hardly noticed.
If you execute this through the console, you'll see it does work:
Code:
		float fX = stf(pchar.Ship.pos.x);
float fY = stf(pchar.Ship.pos.y);
float fZ = stf(pchar.Ship.pos.z);
CreateParticleSystem("flyers",    fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), 0.0, 0.0, 0.0, 0);
Especially if you press F12 lots of times. :wp
 
Thanks very much; I definitly like them! :onya
I wonder... for the cargo going overboard, is there some sort of "splash" sound you could use somewhere?
Probably- I'll look for one, I think it exists somewhere.

As for the particle effects, I reckon they might be working, but are so subtle they're hardly noticed.
If you execute this through the console, you'll see it does work:
Code:
		float fX = stf(pchar.Ship.pos.x);
float fY = stf(pchar.Ship.pos.y);
float fZ = stf(pchar.Ship.pos.z);
CreateParticleSystem("flyers",    fX+4-rand(8), fY+4-rand(8), fZ+4-rand(8), 0.0, 0.0, 0.0, 0);
Especially if you press F12 lots of times. :wp
Oh, so you just need MULTIPLE CreateParticleSystem lines... that makes sense. :facepalm
I'll look at it tomorrow, or if not, Sunday. Kinda busy tomorrow.
 
Back
Top