• 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!

Need Help Striking flags

Status
Not open for further replies.

modernknight1

Field Marshall of Hot Tubs
Staff member
Storm Modder
So I have given up on adapting the AOP1 code for AOP2 surrender. It messes up too many things. I was really wanting surrendered ships to display a white flag like they did in AOP1 Caribbean Tales.

However, I have been thinking about another possibility that I think could work but need help with the command.

In AIShips I have successfully written code that will make the enemy ship strike his flag completely, but I used DeleteClass to achieve this which has the bad effect of deleting all flags on all ships in the area when one enemy ship surrenders.

There has got to be some other item I can insert there that will work. I tried delete entity and delete object already, but the game won't start when I put those in. I may have written them wrong.

Anyone have any ideas? This would be so great if I can get it to work. It looked so cool when the enemy flag disppeared with the alarm and dialogue "Captain she's struck her colors."

Here's the pertinent piece of code. The last line is the magic one I'm looking for. Help. MK

// boal 20.08.06 ïåðåðèñîâêà ôëàãà -->
void Ship_FlagRefresh(ref rCharacter)
{
if (bSeaLoaded)
{
if (CheckAttribute(rCharacter,"surrendered")) {
int iOldNat = sti(rCharacter.nation);
rCharacter.nation = NEUTRAL_NATION;
}
SendMessage(rCharacter, "l", MSG_SHIP_FLAG_REFRESH);

if (CheckAttribute(rCharacter,"surrendered")) {
rCharacter.nation = iOldNat;
rCharacter = DeleteClass(&Flag, "Flag");
}
}
}
 
Is there anywhere that NEUTRAL_NATION has got a different flag defined?
That would probably have to be somewhere here in RESOURCE\INI\rigging.ini:
Code:
[FLAGS]

; TEXTURE PARAMETERS
TextureName = flagall_ship.tga
TextureCount = 10
EnglandPennonTex = 0
SpanishPennonTex = 0
FrenchPennonTex = 0
PiratePennonTex = 0
EnglishFlagTex = 1
SpanishFlagTex = 4
FrenchFlagTex = 2
PirateFlagTex = 5
PortugalFlagTex = 3
DatchFlagTex = 0
Not sure what would need to be modified/added here, but I see no good other method to get this working.

I have no idea how to remove a specific flag from the location and would recommend against trying it.
If there's one thing I've learned of the Storm Engine flags system is that it is EXTREMELY touchy and easy to mess up.

BTW: This line:
Code:
rCharacter = DeleteClass(&Flag, "Flag");
Should at the very least read:
Code:
DeleteClass(&Flag, "Flag");
Otherwise you might get odd effects when using rCharacter further down the line.
 
Thanks Pieter! During my study of the core functions I found out that anytime you delete classes that you run the risk of corrupting saves. So I was trying to look at specifically how you would delete an entity or object. It can be done with the right code. I have been assured of this. I am going to have one of my old coder friends from the military take a look. The only reason I used rCharacter was because my desire was for the enemy flag only to be stricken after surrender.

MK
 
Perhaps indeed it is possible, but I don't know how. I'm not enough of an expert to say. :(
 
Status
Not open for further replies.
Back
Top