Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New at HPS need help
p1nky1337 Offline
Junior Member

Posts: 2
Threads: 1
Joined: Feb 2012
Reputation: 0
#1
Exclamation  New at HPS need help

Hey.
i've have startet making a custom story in Amnesia.
but something i dont understand is following:

1: The scripting i make, should i make it in 1 .hps file or multiple?

2: if only in 1 file, what is the problem here:

void OnStart()
{
AddUseItemCallback("", "key01", "Door01", "KeyOnDoor", true);
    }

void KeyOnDoor(string &in asItem, string &in asEntity)
    {
    SetSwingDoorLocked("Door01", false, true);
    PlaySoundAtEntity("", "unlock_door", "Door01", 0, false);
    RemoveItem("key01");
    
}


{
AddEntityCollideCallback("Player", "Script_slam01", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_slam01", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}



The problem with the code is that when i only have the code for slamming the door, it works. but when i have the code for key to a door in there at same time it wont work. Game crashes.

I have attached a .txt file with the code in.


Thanks for the help! Big Grin


Attached Files
.txt   problem.txt (Size: 736 bytes / Downloads: 117)
(This post was last modified: 02-28-2012, 03:19 PM by p1nky1337.)
02-28-2012, 03:18 PM
Find
jessehmusic Offline
Senior Member

Posts: 423
Threads: 102
Joined: Dec 2011
Reputation: 8
#2
RE: New at HPS need help

void OnStart()
{
AddUseItemCallback("", "key01", "Door01", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "Script_slam01", "func_slam", true, 1);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door01", false, true);
PlaySoundAtEntity("", "unlock_door", "Door01", 0, false);
RemoveItem("key01");
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door01", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}

This works for me


Attached Files
.txt   New Text Document.txt (Size: 706 bytes / Downloads: 114)

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
(This post was last modified: 02-28-2012, 04:37 PM by jessehmusic.)
02-28-2012, 04:25 PM
Website Find
p1nky1337 Offline
Junior Member

Posts: 2
Threads: 1
Joined: Feb 2012
Reputation: 0
#3
RE: New at HPS need help

(02-28-2012, 04:25 PM)jessehmusic Wrote: void OnStart()
{
AddUseItemCallback("", "key01", "Door01", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "Script_slam01", "func_slam", true, 1);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door01", false, true);
PlaySoundAtEntity("", "unlock_door", "Door01", 0, false);
RemoveItem("key01");
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door01", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}

This works for me
Thanks! this works perfectly!

Great help thanks!
02-28-2012, 05:03 PM
Find
jessehmusic Offline
Senior Member

Posts: 423
Threads: 102
Joined: Dec 2011
Reputation: 8
#4
RE: New at HPS need help

(02-28-2012, 05:03 PM)p1nky1337 Wrote:
(02-28-2012, 04:25 PM)jessehmusic Wrote: void OnStart()
{
AddUseItemCallback("", "key01", "Door01", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "Script_slam01", "func_slam", true, 1);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door01", false, true);
PlaySoundAtEntity("", "unlock_door", "Door01", 0, false);
RemoveItem("key01");
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door01", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}

This works for me
Thanks! this works perfectly!

Great help thanks!

No problem dude , btw check your private messages Smile
When you got problem just send me Pm or ask in this forum


http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
02-28-2012, 10:28 PM
Website Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#5
RE: New at HPS need help

I would suggest send me PM's since I have helped Jesseh and Alento and a few others with scripting Wink

02-28-2012, 10:35 PM
Find
jessehmusic Offline
Senior Member

Posts: 423
Threads: 102
Joined: Dec 2011
Reputation: 8
#6
RE: New at HPS need help

(02-28-2012, 10:35 PM)SilentStriker Wrote: I would suggest send me PM's since I have helped Jesseh and Alento and a few others with scripting Wink

hahahha yeah but i wanna help to Wink cuz you learned me alot!

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
02-29-2012, 05:15 PM
Website Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#7
RE: New at HPS need help

True true Wink

02-29-2012, 06:06 PM
Find




Users browsing this thread: 2 Guest(s)