Frictional Games Forum (read-only)
Activating sanity and makign a level door operate. - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Activating sanity and makign a level door operate. (/thread-4914.html)

Pages: 1 2


RE: Activating sanity and makign a level door operate. - LoneWolf - 10-05-2010

Thanks my map works but sadly the enemy doesnt follow the command, i think i may have done the scripting wrong, ive tried it out many ways but it always says error when i load up. Heres how it looks, everything works apart from the enemy following nodes -

Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "RoomTwoArea", "CollideRoomTwo", true, 1);
AddUseItemCallback("", "StudyKey", "castle_arched01_3", "UsedKeyOnDoor", true);
}
void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(3.0f, true);
SetSwingDoorClosed("castle_arched01_2", true, true);
ShowEnemyPlayerPosition("servant_grunt_1");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_arched01_3", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_arched01_3", 0, false);
RemoveItem("StudyKey");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}


Note i also tried to move the node script to the top just below onstart and just above the add entity script. It wouldnt load up.

Thanks for all the help so far guys.


RE: Activating sanity and makign a level door operate. - Equil - 10-06-2010

What error is it giving you when you load up the game? Also the nodes should be below void OnStart().


RE: Activating sanity and makign a level door operate. - LoneWolf - 10-06-2010

When putting them below onstart do i use } { (tokens i think there called) ?


Also the error i get is - unexpected identifier for the nodes but with the } { (tokens) it says unexpected tokens. So i dont know what to do.


RE: Activating sanity and makign a level door operate. - Chilton - 10-06-2010

(10-06-2010, 05:06 PM)LoneWolf Wrote: When putting them below onstart do i use } { (tokens i think there called) ?


Also the error i get is - unexpected identifier for the nodes but with the } { (tokens) it says unexpected tokens. So i dont know what to do.

Ok - Try saving (EMPHASIS on saving) a copy of the parts of the script related to the nodes and the NPC, then remove them, and place them in another document.

Run the map in Amnesia and make sure it works. If not, they arent the problem.

If so, add the script back in piece by piece until you work out which exact part is the issue.

In my experience, the "Show Enemy Player Position" function can be a bit buggy, so start with that.

If you work out which piece of the script isnt working, we should be able to go from there

The XML Verifier may help


RE: Activating sanity and makign a level door operate. - LoneWolf - 10-06-2010

Ive just recently added in the nodes and all my scriptign worked previously, so its definetly my nodes, i just need to know where to place them to get them to work. Otherwise my map doesnt load, i deleted the nodes nto long ago and everything worked.

Also the validator doesnt seem to work for my .hps files, basically doesnt show it as valiable, btu it works for my lang and .cfg file.


RE: Activating sanity and makign a level door operate. - Chilton - 10-06-2010

Open Map Viewer, then view the map, and make it render/display Path Nodes, and ensure that they are actually joined together.

Failing that, try renaming the NPC in the level editor, then changing the Node part of the script to suit that. Also, rename the nodes.

Or, maybe:

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(3.0f, true);
SetSwingDoorClosed("castle_arched01_2", true, true);
ShowEnemyPlayerPosition("servant_grunt_1");
SetEntityActive("servant_grunt_1", true);
{
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 1.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 1.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 1.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 1.0f, "");
}
}
* with SetEntityActive("servant_grunt_1", false); in OnStart


-

EDIT: Retry with the new ammendums
The following is a piece of script from the Amnesia Story, as a point of reference:
void CollideAreaCP03(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("servant_grunt_9", "PathNodeArea_119", 3.0f, "");
AddEnemyPatrolNode("servant_grunt_9", "PathNodeArea_133", 0.0f, "");

SetEntityActive("servant_grunt_9", true);

PlaySoundAtEntity("door_open", "15_open_door", "cellar_wood01_2", 0.0f, false);
}


RE: Activating sanity and makign a level door operate. - LoneWolf - 10-06-2010

How do i know if the nodes are linked? and how do i link them?
Edit, the enemy reacts to sound now but still doesnt follow the nodes Sad after he breaks the door down he stands still untill he sees me or hears me....


RE: Activating sanity and makign a level door operate. - Chilton - 10-07-2010

(10-06-2010, 06:12 PM)LoneWolf Wrote: How do i know if the nodes are linked? and how do i link them?
Edit, the enemy reacts to sound now but still doesnt follow the nodes Sad after he breaks the door down he stands still untill he sees me or hears me....

In the map viewer, when you render the nodes they should be joined by a grey line if they are linked - If not, theyre too far apart and you need to remove and replace them, possibly adding more

This is still progress though


RE: Activating sanity and makign a level door operate. - LoneWolf - 10-07-2010

Thank you so much Big Grin that was the issue all along, onstead of having 4 i now have 19 and the monster follows it perfectly Big Grin Maybe there should be additional information when using this as i assume others will not know why there path nodes are not working.


RE: Activating sanity and makign a level door operate. - Chilton - 10-07-2010

(10-07-2010, 05:38 PM)LoneWolf Wrote: Thank you so much Big Grin that was the issue all along, onstead of having 4 i now have 19 and the monster follows it perfectly Big Grin Maybe there should be additional information when using this as i assume others will not know why there path nodes are not working.

Im glad i could help - Have a pleasant time with your new knowledge