Some cool script for your custom story

The forums have been archived. Please read this thread for more information.

  • Some cool script for your custom story

    Hey there sugar tits :3. I'm here to help you bros to script some stuff to make a good custom story in amnesia.
    There's a lot of people , i think who wants to know how to make jumpscares and etc.
    So here it is:

    Jumpscares:
    Well , if you want to spawn an object or an event to scare players , i'll explain you:
    -First, put the object which you want to spawn for jumpscares , for example A bro head, take the head of the bro in the organic entities, we gonna rename the head "bro_1", in general uncheck the case "Active" (the object is invisible , it will appears with the script). After the placement of the head, create an area where the player will contact and the jumpscare will spawn, go in"Areas",and select "Script" , create the area and rename it for example "Jumpscare_1".
    Now it's time to script (check a tutorial to begin the script). In the file of you map .hps , edit it with notepad, and place this script:

    Source Code

    1. void OnStart()
    2. {
    3. AddEntityCollideCallback("Player", "Jumpscare_1", "Jump1", true, 1);
    4. }
    5. void Jump1(string &in asParent, string &in asChild, int alState)
    6. {
    7. SetEntityActive("bro_1", true);
    8. AddTimer("", 0.7, "scared");
    9. }
    10. void scared(string &in asTimer)
    11. {
    12. SetEntityActive("bro_1", false);
    13. }
    Display All

    If you want to add a sound when jumpscare appears, just copy this and place it at the top of "SetEntityActive("bro_1", true);":

    PlaySoundAtEntity("", "soundname(.ogg)", "Player", 0, false);

    I just made one script helping , because i don't have much time , But :

    YOU CAN ASK ME SOME QUESTIONS FOR THE SCRIPT (like , door and key, lever, how to change map , anything!) THIS IS A POST TO HELP YOU.
    Awesome signature is awesome.
    My name is lightysound , check my channel soundcloud.com/lightysound
  • Just a word of warning, when using floats or other numbers, it doens't hurt to add the f on the end.

    So instead of 0.7

    it will be

    0.7f

    : D

    Also, you might wanna tell people what the scripts mean, otherwise you are spoonfeeding them (someone i did too much ;D). Explain why the function is linked to the callback using a syntax and stuff like why AddEntityCollideCallback works. Otherwise they won't know what their doing and will just copy and paste and not learn. c:
  • Hey I'm new to scripting and all that and I'm trying to learn but for now I'm just looking for stuff like you posted - thanks for the script btw. I was wondering if someone could help me with that jumpscare first though. I go into the game and all is well but when I walk into the area I know I placed the scare doesn't spawn (I used a hanging prisoner for this one) to make things easier I named them bro_1 and Jumpscare_1 as you did but it still doesn't happen. Maybe I just forgot something and you guys can point it out to me, here's my script so far;

    void Onstart()
    {
    AddEntityCollideCallback("Player", "Jumpscare_1", "Jump1", true, 1);
    }
    void UseKey(string &in asItem, string &in asEntity)
    {
    SetSwingDoorLocked(asEntity, false, true);

    RemoveItem(asItem);
    }


    void OnStart()
    {

    AddUseItemCallback("useexit", "key_1", "locked", "UseKey",true);

    }
    void Jump1(string &in asParent, string &in asChild, int alState)
    {
    SetEntityActive("bro_1", true);
    AddTimer("", 0.7, "scared");
    }
    void scared(string &in asTimer)
    {
    SetEntityActive("bro_1", false);
    }


    The door and the lock work fine so don't worry about that I was just confused as to where to place the jumpscare in this.
  • Use this:

    void Onstart()
    {
    AddEntityCollideCallback("Player", "Jumpscare_1", "Jump1", true, 1);
    AddUseItemCallback("useexit", "key_1", "locked", "UseKey",true);
    }
    void UseKey(string &in asItem, string &in asEntity)
    {
    SetSwingDoorLocked(asEntity, false, true);

    RemoveItem(asItem);
    }

    void Jump1(string &in asParent, string &in asChild, int alState)
    {
    SetEntityActive("bro_1", true);
    AddTimer("", 0.7, "scared");
    }

    void scared(string &in asTimer)
    {
    SetEntityActive("bro_1", false);
    }

    Make sure not to make a void OnStart for each function/callback.
  • Thanks for your script bro!

    But what if! I want the "script" to appear when a player enters a door way? Like, i want a monster to appear at another door when the player enters the door. Do i have to use Script Area or what?

    Please, i'm really struggling with my custom story because of this :(
  • Stenkilde wrote:

    Thanks for your script bro!

    But what if! I want the "script" to appear when a player enters a door way? Like, i want a monster to appear at another door when the player enters the door. Do i have to use Script Area or what?

    Please, i'm really struggling with my custom story because of this :(


    Make a new thread asking for that kind of help.