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

Fixed Bug with isfriend attribute not set for officers.

Tingyun

Corsair
Storm Modder
@Levis We have a bug in some hired officer functions (tavern dialogue hires being the most notable), where they use the enemy rank formula rather than the proper officer formula because apparently the isfriend check does not come back true.

Until we fix that, we better go back to the old formula for random enemy ranks (before deleveling it or strengthening it to compensate for randchar officertype being weakened to serve as merchant crew).

The levels they get will still be wrong in multiple ways, but it will be better in the meantime. For the present version, let's sub in the file I have attached for now, which comments out the new changes and brings back the old formula, until we can get that bug sorted out.
 
It comes from here:
Code:
void LAi_Create_Officer(int rankch, ref Npchar)
{
   DeleteAttribute(Npchar,"skillsetup"); //just in case
   DeleteAttribute(Npchar,"completeinit"); //just in case
   Npchar.rank = GetRandomRank(CharacterIsFriend(Npchar), GetAttribute(Npchar,"quest.officertype"), rankch);

Which refers to this function:
Code:
bool CharacterIsFriend(ref _refCharacter)
{
   if(GetAttribute(_refCharacter,"friend")==true) return true;
   return false;
}

That attribute gets set, for example, in 'LAi_CreateFantomCharacterExOtAt' .

I have NO CLUE why this even exists. What need is there to treat "friends" and "enemies" any differently from each other?

Anyway, probably what happens is that since the officer is not created as being part of the player group, he isn't a "friend" and therefore ends up as the opposite.
 
I have NO CLUE why this even exists. What need is there to treat "friends" and "enemies" any differently from each other?

It seems to make sense for difficulty level to increase the level of opponents, but decrease the level of hired officers. Also, a world where bandits are a consistent level makes sense, but we want officers hired to go up in level as the player level does (though for hired officers, player fame might eventually make more sense than player level, and give some realistic effect to the player increasing their fame)
 
So I think we should just add the isFriend to officer generation?
Even for enemy captains this attribute probably should been set then because else they use the other type of getting levels.
Or we should just change the whole random level function so it's not depended on isFriend anymore but we use something else instead ?
 
I'm not sure when "isfriend" is or isn't set. That is set in the function that starts the call stack, so there are a LOT of cases where it could be the one or the other.

I don't think this is a "bug" per se, by the way. Seems more some sort of intentional design.
It is just unclear, confusing and we might want to just get rid of it and treat all characters the same, regardless of whether they're "enemy" or "friend".
 
I'm not sure when "isfriend" is or isn't set. That is set in the function that starts the call stack, so there are a LOT of cases where it could be the one or the other.

I don't think this is a "bug" per se, by the way. Seems more some sort of intentional design.
It is just unclear, confusing and we might want to just get rid of it and treat all characters the same, regardless of whether they're "enemy" or "friend".
I did that when I first started with the leveling system but it caused some comotion back then if I remember right. thats why this came in place eventually. But maybe now with the officer types getting level bonusses etc it shouldn't be needed anymore ...
 
I did that when I first started with the leveling system but it caused some comotion back then if I remember right.
That whole 'isfriend' situation has been in the game for a long, long time.

If I recall, somebody (maybe you), changed the formulas to be identical between "friend" and "not friend". I don't remember that causing commotion though.
I do seem to remember it causing commotion when those formulas were made different from each other.
So I assume they're still identical and this doesn't actually matter.

Am I misremembering?
 
I don't know anymore. I don't mind actually having 1 formula for all characters. but what @Tingyun tried to archieve was actually to have bandits etc be character level independend and I think we should aim for that.
Now the GetRandomRank is depended on the main character. we should try to get this out and have it depended on something else ...

Officers should have a function of their own where the captain is determined and their level should be depended on their captain instead I think.
Boarding crew should also be depended on the captain level.

Some enemies you might want to scale while other you might not want to, so thats where the tricky part will comes in ...
We could for example make a function like

GetRankForCharacter(ref Referece_Character, int offset)

Where the Reference_Character could be a captain or the main player and it will look at the rank of this character and determined the level based on that.
But I don't think that's what we eventually want ...

So I'm still thinking what would be best here.
 
Summarizing the above ideas from @Levis , what about this as a first outline?

(already included) 1) Captain on seperate function, player level not involved, just ship tier

(already included) 2) Boarding crew depends on their captain's level (this is already in I think?), player level only matters for player boarding crew

3) AI officers level depends on their captain level, or their ship tier (should work out about the same either way, you could even use the boarding crew formula for them)

4) All other characters on a function that is player level independent, and has a large random variation (not enough randomness in current one I think). True of bandits, guards, everyone. (I noticed street vendor merchants seem to somehow be getting around level 25 no matter what I do with those functions, can see from their perk points when I was debugging, not sure what is going on there)

5) Tavern table or dialogue officer hiring candidates use the same function, but get a bonus level amount determined by player fame (makes sense, more famous, more top candidates look for you, and gives fame real value so player will want it)

That shouldn't be too hard to code, it is almost what we have, and would create the kind of world we want, where player level isn't looked at, but players can get better officers by taking action (building up their fame).
 
I like the idea of fame having a positive effect. Right now it is only a drawback as it reduces your false flag detection chance.
Will be interesting to hear what @Grey Roger thinks of that idea.

As for random enemies, are you proposing to make their level fully random?
That gives one issue in that you won't know you should run away from tough enemies until it is too late.
Was it not the idea to always have them relatively low level instead?

With optionally specific dungeons getting higher ones?
 
@Pieter Boelen I mean a random function that generates relativelly low levels.

Guards would then become higher level because of their rank bonus (they get +10 on whatevever they otherwise get, currently that bonus is subject to random reduction, we can make it the full bonus and derandomize that part)

Bandits would become lower level because of their rank penalty (they get -5 if they randcaharcters, not sure if they always are)

Shopkeepers are defined seperately.

Officers would also be relatively low level, but without the bandit penalty, and with the fame bonus.

I think that is everyone the player should care about the levels of, since crew are on a seperate system determined by their captain's level.

Bonus levels for dungeon enemies I am not sure how to code, but yes I would love that. :) Actually, maybe just tell the dungeons to use the template for sailors instead of randcharacters, that would already give them higher level without the penalty?
 
I mean a random function that generates relativelly low levels.
Always, regardless of player level then, right?

Bonus levels for dungeon enemies I am not sure how to code, but yes I would love that. :) Actually, maybe just tell the dungeons to use the template for sailors instead of randcharacters, that would already give them higher level without the penalty?
Just add an optional attribute to locations and, if present, add that level value to all random enemies being generated there.
Should not be very difficult.
 
Yep, independent of player level. If the player hunts bandits at high level, it will be easy, but then they won't get much for their trouble.

(Equiped weapons being based on the enemy level, not the player, as is gold)
 
it sounds nice at first glance but how are you going to determine what level the enemies at a certain location should be? should the location have a attribute set to it to state how difficulty it is, and if nothing is set it will revert to the default level?
 
should the location have a attribute set to it to state how difficulty it is, and if nothing is set it will revert to the default level?
That was indeed pretty much what I was thinking of. :yes
 
That was indeed pretty much what I was thinking of. :yes
great minds think alike :).
maybe do it the same way as we dit with vskip so questmaker can also temporary up the random encounter level. This could then also be used for boarding.

So the location can have a attribute, or the mainplayer can have a attribute. depending on this the level of the enemy is determined. if not set it will default to a default value
 
If it is a location attribute, then that would indeed be possible.


In theory, I suppose. But why would you want that? :unsure
because then the boarding can just use the getrandomrank function and we can set the attribute depending on the ship tier class which I think makes the code more readable and reduces the amount of functions.
I prefer not to have an function for each situation to determine the level.
 
Currently the boarder rank is determined by their captain rank I think, which is in turn determined by tier for the AI, so the only balance change we would look at from that is that the player characters boarders would then be determined by the player character's ship tier, rather than his level.

That seems reasonable theoritically to me, but it would probaly make boarding much easier though--the player usually doesn't keep pace with the AI captain levels for a given ship tier. Ie, the player probably won't be level 30 when he gets his first tier 4. So the player will be getting better boarders relative to the AI, if we push it to a tier based function, and generally will find boarding easier.

The second balancing effect, perhaps more worrisome, is that it will make it less viable for the player to stick to a smaller ship tier. Indeed, with crew costs a pittance, smaller vessels will become even less attractive to the player, as going up in tier now gives the player better boarders in addition to more.

These effects leads me to doubt whether it would be a good idea to unify boarder generation with the general random character function. Unless I am misunderstanding something about how it currently works?
 
Back
Top