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


Activating sanity and makign a level door operate. - LoneWolf - 10-04-2010

I think i have found the right scripting but have no idea what to do with it please write down exactly what i should do this is my script already please copy paste the scripting you do into mine so i know hwo it is set out, Thanks.

Edit: and scripting for a quest woudl also be good, i think the script is this -

void AddQuest(string& asName, string& asNameAndTextEntry);
void CompleteQuest(string& asName, string& asNameAndTextEntry);
bool QuestIsCompleted(string& asName);

My script already(please add scripting you do into it).

////////////////////////////
// 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)
{
SetSwingDoorClosed("castle_arched01_2", true, true);
ShowEnemyPlayerPosition("servant_grunt_1");
}

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()
{
}


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

What do you mean "Activating Sanity"? The functions "GiveSanityDamage" and "GiveSanityBoost" can both be used to increase/decrease sanity respectively.

Also there's a tutorial here explaining how to use level doors:
http://www.frictionalgames.com/forum/thread-4782.html


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

Thanks i knew i had seen a thread before btu couldnt find it. What i mean by activiating sanity is when my script activates so that the door behind me closes and the monster finds me i want my sanity to decrease a little.


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

Simply add
"GiveSanityDamage(<amount of damage here>, <use distort effect true/false> )"

Here's an example from your script:
Code:
void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(1.0f, true);
SetSwingDoorClosed("castle_arched01_2", true, true);
ShowEnemyPlayerPosition("servant_grunt_1");
}



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

Thanks much appreciated, everythign works except the monster cannot seem to open doors, he just stays in the one room even when ithrow stuff at the door, only way he gets me is if i open door for him or if i constantly hit door for a minute.

Any idea how to sort this out as it makes my first map overall poor.

what does 1.0 f stand for? how high can it go? i put it onto 2.0f but it doesnt seem to do too much to sanity.


RE: Activating sanity and makign a level door operate. - HakePT - 10-04-2010

(10-04-2010, 12:04 PM)LoneWolf Wrote: Thanks much appreciated, everythign works except the monster cannot seem to open doors, he just stays in the one room even when ithrow stuff at the door, only way he gets me is if i open door for him or if i constantly hit door for a minute.

Any idea how to sort this out as it makes my first map overall poor.

Pathnodes. Just before a monster spawns you can set a pathnodes that the enemy will follow when he spawns. I believe if he has a door blocking his way he will destroy it.

If you have trouble making the script go to the map Guest room (the official)
there a monster spawns and destroys a door if it is open.


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

Yeah but im not quite sure what to write down, i wrote down the enemy name though but thats all i know.

AddEnemyPatrolNode(servant_grunt_1, string& asNodeName, float afWaitTime, string& asAnimation);


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

AddEnemyPatrolNode(servant_grunt_1, string& asNodeName, float afWaitTime, string& asAnimation);

Firstly, the name should be in quotations("servant_grunt_1").

asNodeName = The path node you want the grunt to move to e.g "PathNodeArea_1".

afWaitTime = How long you want the grunt to wait after reaching this node before moving onto the next, 0 auto calculates.

asAnimation = The animation to use I think, just leave this as "".

So we have:

AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");


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

Thanks, so i assume the enemy goes to the area 1 then back to its original starting point then back to area 1..................... etc. ?


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

Put several of them into your onstart if you want it to walk a specific path. For example, if you wanted it to walk through pathnodes 1 through to 4, you'd have:

Code:
void OnStart()

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, "");

The grunt will now walk through path nodes 1-4. I think there's another way to make them dissapear after they've walked their path, but I just tell them to walk to a node placed inside a collide area as their last path node which sets them inactive.

Answering your question though yes, I think they do just continue back and forth along their path then eventually vanish if they don't see the player, though I'm not sure of this.