• 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 Missing character at cave entrances

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
Highwaymen and rapists are supposed to appear in gangs of four. At cave entrances, there's one missing. At best, this spawns an error message. At worst, the rapists' intended victim will only reward you if you kill all four, which can't happen if one of them failed to spawn.

Attached are a savegame at the entrance to a cave on Hispaniola, plus all log files.
 

Attachments

  • -=Player=- Hispaniola.zip
    714.9 KB · Views: 154
  • compile.log
    33.1 KB · Views: 151
  • error.log
    1 KB · Views: 142
  • system.log
    20.3 KB · Views: 153
Code:
ERROR - Missing Character ID: Enc_Char4
ERROR - Missing Character ID: Enc_Char4
Quest name LandEnc_RaidersLogin FOUND in CommonQuestComplete
I think @Black Bart mentioned the same issue?

Does this problem occur only in specific locations though?
Could it be that those locations do not have enough locators for it?
But this is a brand new problem, isn't it? Anyone got any clue on when it started?
 
It's certainly not brand new. I've seen it before, but the problem is that I'm in a battle, and then there's a cave to explore, so I never got round to gathering savegame and log files before. It was indeed @Black Bart's post which reminded me. Since I happened to have a savegame at Hispaniola temple for storyline development purposes and there's a cave two areas away from there, it was an easy matter to go there and watch for the error, then do the necessary.

I'm not sure how highwaymen and rapists work. Highwaymen stand in formation somewhere on a road near an area exit but I don't think they're each on a separate locator. But the problem does seem to happen specifically at cave entrance areas - the one on Barbados is another good place to use for testing this.
 
I'm not sure how highwaymen and rapists work. Highwaymen stand in formation somewhere on a road near an area exit but I don't think they're each on a separate locator. But the problem does seem to happen specifically at cave entrance areas - the one on Barbados is another good place to use for testing this.
Could you post the "LandEnc_RaidersLogin" code from quests_common.c by any chance?
 
Code:
    case "LandEnc_RaidersLogin":
       LAi_group_SetRelation("ENC_RAIDERS_GROUP", LAI_GROUP_PLAYER, LAI_GROUP_NEUTRAL);

       LAi_SetCheckMinHP(characterFromID("Enc_Char1"), (LAi_GetCharacterHP(CharacterFromID("Enc_Char1")) - 1), false, "LandEnc_RaidersFight");
       LAi_SetCheckMinHP(characterFromID("Enc_Char2"), (LAi_GetCharacterHP(CharacterFromID("Enc_Char2")) - 1), false, "LandEnc_RaidersFight");
       LAi_SetCheckMinHP(characterFromID("Enc_Char3"), (LAi_GetCharacterHP(CharacterFromID("Enc_Char3")) - 1), false, "LandEnc_RaidersFight");
       LAi_SetCheckMinHP(characterFromID("Enc_Char4"), (LAi_GetCharacterHP(CharacterFromID("Enc_Char4")) - 1), false, "LandEnc_RaidersFight");
     break;
 
Ah, yes. That might have indeed been the error message i thought related to the item in that location. There were only three bandits in the location.
 
Code:
    case "LandEnc_RaidersLogin":
       LAi_group_SetRelation("ENC_RAIDERS_GROUP", LAI_GROUP_PLAYER, LAI_GROUP_NEUTRAL);

       LAi_SetCheckMinHP(characterFromID("Enc_Char1"), (LAi_GetCharacterHP(CharacterFromID("Enc_Char1")) - 1), false, "LandEnc_RaidersFight");
       LAi_SetCheckMinHP(characterFromID("Enc_Char2"), (LAi_GetCharacterHP(CharacterFromID("Enc_Char2")) - 1), false, "LandEnc_RaidersFight");
       LAi_SetCheckMinHP(characterFromID("Enc_Char3"), (LAi_GetCharacterHP(CharacterFromID("Enc_Char3")) - 1), false, "LandEnc_RaidersFight");
       LAi_SetCheckMinHP(characterFromID("Enc_Char4"), (LAi_GetCharacterHP(CharacterFromID("Enc_Char4")) - 1), false, "LandEnc_RaidersFight");
     break;
Sorry, I should have asked you to also post some of the other quest cases surrounding that.

I wonder if those characters are initialized in the character init entries?
You could also run this through console anywhere:
Code:
characterFromID("Enc_Char4");
If indeed that character truly doesn't exist, that should consistently trigger the error.
 
Here are both "quests_common.c" and "LEnc_login.c", which I suspect may be helpful in finding out why "Enc_Char4" isn't spawning.
 

Attachments

  • quests_common.c
    214.4 KB · Views: 172
  • LEnc_login.c
    9.7 KB · Views: 170
Thanks, @Grey Roger! Indeed it looks like these guys are generated dynamically and not-preinitialized:
Code:
void LEnc_LoginCorrectParams(ref location, aref chr, string group, string locator)
{
ref player;
// Viper - Sword bugfix Begin
//bool IsPistol, IsBlade, isBlade2;
player = GetMainCharacter();
string CurrentChar, CurModel, curAttr;
CurrentChar = "char" + CurLandEnc.CurCharacter;
//CurModel = "model" + (Rand(Makeint(CurLandEnc.(CurrentChar).modelQuantity)-1) + 1);
chr.id = "Enc_Char" + CurLandEnc.CurCharacter;

I am not very familiar with how those types of land encounters work; have to admit I've always been a bit confused on them.

Could you find out if it always happens in specific locations?
My initial thought is that this might happen if there aren't enough "reload" locators available?
It could also be that it requires the "monsters" type instead.
Using VISIBLE_LOCATORS may help.
 
As far as I can tell, it's only cave entrances.

The problem does not seem to be a matter of locators. Partly because there are a lot more locators in the immediate area where raiders spawn in cave entrance areas than where they spawn in other jungle locations. And partly because they don't seem to use locators anyway. Have a look at these:

raiders_cave.jpg raiders_crossroads.jpg

You can't see locators until you're close enough, but you can see that in both pictures there's at least one locator showing up further away than one of the raiders. What you can't see from static screenshots is that, provided you are careful not to get close enough to trigger their response, you can skirt round the raiders to inspect their formation from other angles, and I can tell you that not one of them is standing on a locator.

Looking at "LEnc_login.c", it seems to be doing something with the location template, which I'm guessing means it's placing the raiders according to landscape, not locators. Highwaymen usually start off in a roughly square formation on some random piece of road. In most areas they have plenty of room to spawn, but where they're spawning at the cave entrance, one of them is probably trying to spawn in the rock, and my guess is that's the one who fails to spawn at all and creates the error message.
 
Very curious. Is it at all possible that they DO get spawned on locators, but those locators are hidden somewhere below ground level?
The TOOL/GM Viewer check might be able to answer that question.

Seems unlikely, but before we decide it is definitely the game engine doing fancy mysterious things, it might be better to be absolutely certain.... :oops:
 
"VISIBLE_LOCATORS" shows underground locators as well. I found that out when I was trying to position a locator in Santiago for quest purposes, changed its Y co-ordinate, and found that contrary to everything I'd learned in maths until now, X and Z are the co-ordinates for position along the ground and Y is height, which meant my locator was then about 2 metres below street level. :facepalm

Which means even if there had been underground locators in these jungle areas (and there'd need to be a lot of them to accomodate all the places highwaymen can appear in normal jungle areas), I'd have seen them. If the locators are so far down that I can't see them then they're also so far down that the highwaymen wouldn't show up either.

The other thing is that while locators will trigger events such as quest win conditions if you move to anywhere within their radius, if you place someone on a locator then he appears dead centre on the locator's exact position. Which means if the highwaymen who I spotted not standing on locators had been sent to an underground locator, the highwaymen would be positioned underground. It also means if "Enc_Char4" were placed on such a locator, the error wouldn't be that he doesn't exist, it would be that he can't move. (This is why, when I was writing the wedding scene for "Hornblower", William Bush has to be teleported when he stands up. He's originally placed on a "sit" locator, which is inside the bench, so if he stands up while on that locator, he's stuck in the bench and can't move forward to say his piece. So he gets a 'ChangeCharacterAddressGroup' to a nearby "goto" locator, then he's clear of the bench and can walk.)
 
If the locators are so far down that I can't see them then they're also so far down that the highwaymen wouldn't show up either.
That isn't necessarily true. Characters drop out of the sky on top of their locators when placed.
I've actually seen that happen, though only once or twice. That was a surprise to be sure!
But it did provide the explanation for the sideways sitting character issue we had in the taverns.

That being said, I do believe you are right about it being a "game engine thing".
After some tracking, I found that apparently the "locators" they get placed on are determined with:
Code:
LAi_FindRandomLocator("encdetector")
And "encdetector" does get fed to the game engine at some point:
Code:
    if(CheckAttribute(loc, "locators.encdetector"))
     {
       SendMessage(loc, "lss", MSG_LOCATION_EX_MSG, "TestLocatorsGroup", "encdetector");
       makearef(st, loc.locators.encdetector);
       num = GetAttributesNum(st);
       for(i = 0; i < num; i++)
       {
         at = GetAttributeN(st, i);
         sat = GetAttributeName(at);
         SendMessage(loc, "lss", MSG_LOCATION_EX_MSG, "TestLocatorsGroup", sat);
       }
     }

If it is indeed a problem only in certain locations, the simplest solution might be to add "vcskip" to those locations.
That would mean NO random characters there at all and therefore also no problem.

I never did like random encounters in front of caves anyway.
 
I like the idea of having a 'vcskip' on cave entrances for another reason, though it could probably as easily be handled in the side quest code instead of a general 'vcskip' on all caves. Why would highwaymen, random thugs or rapists be outside the Animists' lair? xD
 
I like the idea of having a 'vcskip' on cave entrances for another reason, [...]. Why would highwaymen, random thugs or rapists be outside the Animists' lair? xD
Valid point as well!

I personally don't mind permanently setting vcskip for those locations where you get issues.
There are plenty of locations still left where you DO get those encounters, so I don't think it would be much of a loss.

So now there are two main questions:
- Does anyone else object to this proposed change?
- What exact location models are affected by this? Is it only cave exits or other ones too?
 
Been looking at this in game in Beta 1 Patch 7.

No error messages. Also there are only ever three NPC's, either as general roaming non-hostile encounters or when static highwaymen/bandits waiting for the trigger if you get too close to them etc. The location of these bandits is as we have seen here (and in my first bug report for the item location error), three guys in a line towards the cave entrance along the edge of the locations boundery. The 'Item' displays correctly under the hand icon near that rock on all occasions, so something that happened after Beta 1 Patch 7 has changed the way these are behaving it seems?
 
No error messages.
No surprises there; doesn't mean the error didn't occur though, because it was me who added that error message.
But it can't have been more than two yeras ago, so that was easily several years later than Beta 1 Patch 7 was released. :wp

Can you confirm that in general jungle areas, it IS four characters?
If so, I basically just need to know in which particular locations you get only three.

The 'Item' displays correctly under the hand icon near that rock on all occasions, so something that happened after Beta 1 Patch 7 has changed the way these are behaving it seems?
What is this "Item location error" you refer to? I think I missed something. :confused:
 
Well i first reported this bug as being connected to the item under the rock at this Barbados cavern entrance location, i had thought that the error message was related to the 'loot' item you find when you get that hand icon and normally under that icon it says 'Item' letting you know something is there to be picked up, but instead i got that ERROR message string thing we have now decided is due to this location only showing 3 bad guys instead of the normal 4 it might be supposed to spawn (but as far back as Beta 1 never did, and maybe earlier, maybe default PotC even? Not tested this, just trying to remember if i ever got jumped by more than 3 guys in this location, like ever.....not sure, but that is not fact!)

And yes in most jungle/wherever locations you do get those neatly arranged (like getting ready for a square dance or morris dancing maybe!) 4 bad guys waiting to speak to you (or get shot from range first). The cave entrance is the exception, with just 3, and where i first saw this ERROR message in my Beta 4 testing.
 
Well i first reported this bug as being connected to the item under the rock at this Barbados cavern entrance location, i had thought that the error message was related to the 'loot' item you find when you get that hand icon and normally under that icon it says 'Item' letting you know something is there to be picked up, but instead i got that ERROR message string thing we have now decided is due to this location only showing 3 bad guys instead of the normal 4 it might be supposed to spawn (but as far back as Beta 1 never did, and maybe earlier, maybe default PotC even? Not tested this, just trying to remember if i ever got jumped by more than 3 guys in this location, like ever.....not sure, but that is not fact!)
Whatever might have happened there, it seems extremely unlikely to me to be related to the "only 3 enemies" issue.
 
Mod Release - Build 14 Beta 4 Internal WIP For Testing | Page 12 | PiratesAhoy!

Ah....ok so my first point in that post (with the screenshot to accompany it at the bottom) where i go to the item location near the rock (as in screenshot) and in stead of getting the hand icon with the word 'Item' underneath the icon as normal for these loot finds in the landscape, i get the error string instead, that is related to the 3 chars (so missing 1 char) instead of 4 spawning and that error message overwrites where the word 'Item' would be?

I see, i think i get the relationship between all this now :)
 
Back
Top