![]() |
How do i make the Sanity script? - 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: How do i make the Sanity script? (/thread-15617.html) Pages:
1
2
|
How do i make the Sanity script? - Clear - 05-25-2012 Hey guys! I'm really new at scripting amnesia custom stories and with HPL editor ![]() My question is how exacly can you make a Sanity Script? Let's say i've set an area (script) and exacly when the players goes in that area that awesome screen zooming with the sound effects happens ![]() Thanks! ![]() And only if it's possible, a script that activates the sanity, AND makes his lantern go off (he can still light it up, just to let the lantern off his hand) RE: How do i make the Sanity script? - Putmalk - 05-25-2012 I don't understand what "Sanity Script" means? Do you want to raise/lower the sanity? Raising, just put one of these lines of code in your script: GiveSanityBoost(); GiveSanityBoostSmall(); To lower it: GiveSanityDamage(int number, bool showeffects); for example: GiveSanityDamage(10, true); Alternatively, you can manually set it, but this is less dynamic and more brute force: SetPlayerSanity(50); 100 - Full Sanity 75 - Slight headache 50 - Head is pounding and hands are shaking 25 - ... RE: How do i make the Sanity script? - Clear - 05-25-2012 (05-25-2012, 01:54 PM)Putmalk Wrote: I don't understand what "Sanity Script" means?By sanity script i mean that, well, kinda hard to explain.... i'll try i guess, it's like one of those creepy custom stories where you enter a room and the author have placed some Area that when you go by pass it your sanity like goes down, when the screen gets blurry for like half a second and the screen zoomes in and that "Boom" sound effect comes. And once again soory if i sound noobish ![]() RE: How do i make the Sanity script? - Obliviator27 - 05-25-2012 You would have to set up a CollideCallback, which calls the function GiveSanityDamage. Like so void OnStart() { AddEntityCollideCallback("Player", "RoomArea", "SanityDamage", true, 1); } void SanityDamage(string &in asParent, string &in asChild, int alState) { GiveSanityDamage(10, true); } RE: How do i make the Sanity script? - Clear - 05-25-2012 (05-25-2012, 02:25 PM)Obliviator27 Wrote: You would have to set up a CollideCallback, which calls the function GiveSanityDamage. Like soThanks! But i have a problem while putting the script down the HPS file, when i put it and load the game it gives me an error wich says function with the same parameters allready exicts... i have 2 void OnStart() in 1 HPS file, is that suppose to be like it? One of it is for a key & door script, what do i need to do? RE: How do i make the Sanity script? - Putmalk - 05-25-2012 (05-25-2012, 02:34 PM)Clear Wrote:No. NEVER have two functions with the same name in it.(05-25-2012, 02:25 PM)Obliviator27 Wrote: You would have to set up a CollideCallback, which calls the function GiveSanityDamage. Like soThanks! A basic script always looks like: Code: void OnStart() RE: How do i make the Sanity script? - Clear - 05-25-2012 (05-25-2012, 02:44 PM)Putmalk Wrote:This is my .HPS so far,(05-25-2012, 02:34 PM)Clear Wrote:No. NEVER have two functions with the same name in it.(05-25-2012, 02:25 PM)Obliviator27 Wrote: You would have to set up a CollideCallback, which calls the function GiveSanityDamage. Like soThanks! //////////////////////////// // Run first time starting map void OnStart() { AddUseItemCallback("", "key1", "DoorName01", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("DoorName01", false, true); PlaySoundAtEntity("", "unlock_door", "DoorName01", 0, false); RemoveItem("key1"); } { AddEntityCollideCallback("Player", "Sanity1", "SanityDamage", true, 1); } void SanityDamage(string &in asParent, string &in asChild, int alState) { GiveSanityDamage(10, true); } I removed the second "void OnStart()" and it looks like this, it gives me an error of Unexpected token in 14,1, what the Hell do i do Q_Q RE: How do i make the Sanity script? - wolfmaster1231 - 05-25-2012 AddEntityCollideCallback("Player", "Sanity1", "SanityDamage", true, 1) this should be under AddUseItemCallback RE: How do i make the Sanity script? - Putmalk - 05-25-2012 (14, 1) refers to line 14, character 1. In this case, you are misusing the "{" "}". They cannot be floating around there. May I suggest reviewing a basic scripting tutorial, as syntax errors like these will stop you from doing anything. When utilizing those brackets, they have to be after a function. Like: void OnStart() { } Alternatively, after an if-else statement: if(whatever) { } else { } or a loop for(int i=0;i<5;i++) { } So, specifically, your error is right here: Code: { Just shift that into the original void OnStart(), so it looks like Code: void OnStart() And remove that line plus the brackets where you had it. RE: How do i make the Sanity script? - Clear - 05-25-2012 (05-25-2012, 02:57 PM)wolfmaster1231 Wrote: AddEntityCollideCallback("Player", "Sanity1", "SanityDamage", true, 1) this should be under Can you write that for me please? |