Frictional Games Forum (read-only)
Enemy patrol nodes not added - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Enemy patrol nodes not added (/thread-10408.html)



Enemy patrol nodes not added - Your Computer - 09-20-2011

They work for enemies previously set in the level editor. However, when creating a monster dynamically (e.g. with CreateEntityAtArea) the monster doesn't do anything. I'm not sure why, but i'm guessing it is because of the monster's "wait" state, since the other, pre-set monsters are in an "idle" state. Anyone know why dynamically created monsters don't want to follow paths given to them?

I need monsters to be dynamically created because the game doesn't seem to allow monsters to be reset, and this is the only workaround i could think of.

HPL.log showing: "ERROR: There is no node container in enemy 'servant_grunt_2'! (probably no nodes in map!);" not sure what this means and there are plenty of nodes in the map.


RE: Enemy patrol nodes not added - Tanshaydar - 09-20-2011

Dynamically created monsters cannot be directed with path nodes unfortunately. I tried many thigns to make it work.
I had a monster and setting it inactive was not enough for some reason; so I tried to dynamically create it. However that didn't quite work. So I had to change the monster, to a less attractive one.

Engine tends to link the nodes to existing enemies in the start of the map, not in the middle of the game.


RE: Enemy patrol nodes not added - Apjjm - 09-20-2011

It's a shame you can't use path nodes with the dynamicly created monsters. The only solution to this I have tried is to make the enemy's .nodes file - this still doesn't work though, as it appears the error comes up before the nodes file is check/created.

Edit:
Does translating the player below -500 in y get the game to load an autosave? This may reset the enemies. Really can't remember if this loads the auto-save or the checkpoint.


RE: Enemy patrol nodes not added - Your Computer - 09-20-2011

Well, there is still one more method i have in mind in attempting to get what i want, but it is a very extreme method (being sure to lag the level editor to no end) and it means the player will not have unlimited retries. It seems like i'll have to put this on the end of my to do list, therefore.


RE: Enemy patrol nodes not added - Apjjm - 09-20-2011

Actually, (I blame having just woken up when i last posted for not suggesting this) but there is a really simple solution. Use LoadMap in conjunction with your player start area to re-load the level. The load times should be really short as the level is already loaded (if it isn't use the Create Cache methods?).

Obviously you can duplicate a few enemies here and there so you only have to reload every 10 tries or so if loading the level still breaks the flow significantly.




RE: Enemy patrol nodes not added - Your Computer - 09-20-2011

Well, this is only required for Amnesia's Creed (which will be part of Teamnesia), and the goal is to avoid long pauses caused by deaths (i.e. death hints) and loading--that is, after the main course has been initiated (since that is the only time the player would be prone to failure). Reloading the map and using, perhaps, local variables to keep track of checkpoints is more than what i am willing to put the player through.

Also, would you happen to know if the other enemy types available in the model editor can follow path nodes? I don't really need a monster that can attack the player (in fact, i would prefer if it didn't, at least for the part i'm working on), i just need one that can follow path nodes and reacts to the player by temporarily disregarding the path nodes. I know the graveyard corpse reacts to the player and doesn't attack the player, but i haven't tested if it can be reset or made to follow path nodes.


RE: Enemy patrol nodes not added - Apjjm - 09-20-2011

Just tested out ChangeMap() to the same map - It behaves just like a " Quick Map Reload " except with a short fadein/fadeout. It actually doesn't reset the state of the enemy though. Will see if i can find a workaround.

Edit 2: Problem is caused by map state persisting over level load. This can be fixed with the following approach which switched between two maps, however I am unsure if this will still load quickly - DO test it out though!

To elaborate (though i'm not entirely sure it is necessary) i made a map called "test", and a map called "test_throwback". Test was just a simple map involving a plane and a patrolling enemy:
Code:
void OnStart() {
    SetSanityDrainDisabled(true);
    GiveItemFromFile("lantern","lantern.ent");
    SetLanternLitCallback("onLit");
        for(int i=1; i<=3; i++) AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_"+i,0.1f,"");
}

void OnEnter() {
AddDebugMessage("Currently on Test map!",false);
}

void onLit(bool abLit) {
ClearSavedMaps();
if(abLit) resetMap("test.map","");
}

void resetMap(string &in asMap, string &in asPos) {
SetGlobalVarString("_DESTINATIONMAP",asMap);
SetGlobalVarString("_DESTINATIONPOS",asPos);
DestroyDataCache(); CreateDataCache();
ChangeMap("test_throwback.map","","","");
}

The throwback map was literally just a copy with a different hps file - for the fastest loading times a completely blank map with just 1 start area may be better.
Code:
void OnEnter() {
ClearSavedMaps();
ChangeMap(GetGlobalVarString("_DESTINATIONMAP"),GetGlobalVarString("_DESTINATIONPOS"),"","");
AddDebugMessage("Entered Test Throwback map",false);
}

Of course, finding some way to get the game to "forget" the state of the map without transitioning to another blank map first will be tonnes better, as there will be no loading screen - this would actually be exactly what you are looking for. However, as it is I'm not suggesting you solely use this solution as it clearly doesn't meet your requirements, but it could be an effective solution to the problem of the finite number of resets with the "tonne of deactivated grunts" approach.

Edit again:
Graveyard corpse is just a permutation of "enemy_grunt" type - it will follow path nodes but still have the same problems with not being able to add them dynamically. You may be able to simulate path nodes by using a water lurker style enemy + invisible food if the game doesn't allow path nodes to be added to lurkers?


RE: Enemy patrol nodes not added - Your Computer - 09-21-2011

Hmm, after a bit of thinking, i suppose i have no choice but to go with a set number of monsters and temporarily changing maps. I'll manage to work this into the "story" where it shouldn't bother the player much.



RE: Enemy patrol nodes not added - GraphicsKid - 09-21-2011

Yea I had this same problem a while back too. I ended up just having to make 256 monsters in the same spot... though if it takes them 256 tries... I don't care anymore, they can move on... they've earned it for sticking with it 256 times without dying.

Then I accidentally overwrote the code for the map and I haven't been the same since... Sad