Causing sanity damage to yourself - 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: Causing sanity damage to yourself (/thread-4459.html) Pages:
1
2
|
Causing sanity damage to yourself - RaptorRed - 09-17-2010 I am completely new to this level editor, I made my own level to mess around in, well in the level I have a lever, how can I make it so by using the lever the player's sanity gets damaged, is it possible? I have zero experience when it comes to scripting, do I need to script something in order for this thing to work? Help is appreciated. RE: Causing sanity damage to yourself - jens - 09-17-2010 Yes, you will need scripting for this. But it is fairly simply, if you begin by making a script file as on the wiki in the first step in the script tutorial 1. Then you only have to do 1 thing in the script and 1 thing in the editor. In the editor, select the lever, click the Entity tab. For ConnectionStateChangeCallback enter a name for a function, like PullLever Then in the script file, anywhere that is not within OnStart, OnEnter or OnLeave you add Code: //Function as you specified in ConnectionStateChangeCallback I think this will work, this is not the 100% intended use of ConnectionStateChangeCallback, but I think I used it like this in one of the levels. As you say 0 experience, to make sure you are not confused, all the lines that start with // are comments I added to explain what is going on, those do not actually have to be in the script. RE: Causing sanity damage to yourself - RaptorRed - 09-17-2010 Well, What am I doing wrong, I get a fatal error claiming it couldn't load script file "yy.hps" main (31, 35) : ERR because it expected data type I have no idea what it is referring to when it says Data type This is my code: Code: //////////////////////////// RE: Causing sanity damage to yourself - RaptorRed - 09-17-2010 This is frustrating, I tried almost everything and I still can't get it to work RE: Causing sanity damage to yourself - jens - 09-17-2010 You changed the script here, Void PullLever(string &in lever1, in -1) and that is incorrect. I also noticed my original had an error, it should not say "in" at all for alState so the correct is: Code: void PullLever(string &in asEntity, int alState) It is meant to be like that, so do not edit that part at all! To explain: alState can be either 0, -1 or 1 and that is why in the script you say IF alState is -1 or 1 then you should do GiveSanityDamage. RE: Causing sanity damage to yourself - Cgturner - 09-17-2010 (09-17-2010, 08:28 AM)jens Wrote: You changed the script here, Void PullLever(string &in lever1, in -1) and that is incorrect. I also noticed my original had an error, it should not say "in" at all for alState so the correct is: This works very nicely! What script do you use to make the player's head turn at the same time as the insanity effect? I've got a squeal coming from behind the player once he walks into an area, and I want him to look when the noise starts. RE: Causing sanity damage to yourself - Armored Cow - 09-17-2010 I think the function is SetPlayerLookAt. RE: Causing sanity damage to yourself - iTIMMEH - 09-17-2010 To start pointing the player at a desired entity: Code: StartPlayerLookAt(string& asEntityName, float afSpeedMul, float afMaxSpeed, string &asAtTargetCallback; To stop it: Code: StopPlayerLookAt(); RE: Causing sanity damage to yourself - Armored Cow - 09-17-2010 I would make a function that sets the player to look at an area as well as play a sound at that area when the player steps into the trigger area. Also include in the function a timer, maybe 3 seconds, that then triggers a function to stop the player looking. Code: void Onstart() RE: Causing sanity damage to yourself - RaptorRed - 09-19-2010 (09-17-2010, 07:40 PM)Cgturner Wrote:(09-17-2010, 08:28 AM)jens Wrote: You changed the script here, Void PullLever(string &in lever1, in -1) and that is incorrect. I also noticed my original had an error, it should not say "in" at all for alState so the correct is: It works for you?, thats odd mine says identifier alState is not of data type and that it should be of boolean type. |