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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with a script file? :)
lbrosious96 Offline
Junior Member

Posts: 4
Threads: 4
Joined: Jun 2012
Reputation: 0
#1
Help with a script file? :)

So i know a lot of amnesia custom stories have things jumping out at them, like random objects or entities jumping out at them after they pick up a crowbar (in the CS: Can't Remember).

So, I have one of those iron maiden things, with the metal head and the wooden body, with spikes inside named 'monstercontain'. It works perfect, I have a HPS file that i am using (below) uses a key with that door, amongst others. I want, when the player opens the door to it to have a monster to spawn behind them, say 10-15 meters.

My HPS file (ask if you need anything else). Also, do you have a different HPS file per level you have in your story? Thanks <3

void OnStart()
{
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "UsedKeyOnDoor", true);
AddUseItemCallback("", "irondoor_key", "irondoor", "UsedKeyOnDoor", true);
AddUseItemCallback("", "monstercontain_key", "monstercontain", "UsedKeyOnDoor", true);
AddUseItemCallback("", "02_key", "02_door", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem(asItem);
}
06-30-2012, 12:30 AM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#2
RE: Help with a script file? :)

Why not try it yourself? Everything you need is in the dev wiki, and most of all, in this site on there:
http://wiki.frictionalgames.com/hpl2/amn..._functions
You can only have 1 .hps file for 1 map. for 2 maps, you have 2 .hps files. Simple as that.
I can't help you with your request, since I have absolutely no idea what you are wanting...
"iron maiden things, with the metal head and the wooden body, with spikes inside named 'monstercontain'." Whaaaaat??
06-30-2012, 12:41 AM
Find
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#3
RE: Help with a script file? :)

So you want to use the key on a locked Iron Maiden, and then a monster appears behind you? I hope I got that right. Anyways, this is the script that hopefully works, I haven't tested it myself.

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("nameofIronMaiden", false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem("nameofkey");
}


You could either choose to let the monster spawn when you unlock the door, or when you open the door after you've unlocked it. The first one is very easy. Just add SetEntityActive("NameofMonster", true); to void UsedKeyOnDoor(string &in asItem, string &in asEntity). Make sure you have an inactive monster in your level editor on the place you want him to spawn.
Here is the second one.



void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("nameofIronMaiden", false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem("nameofkey");
}


void NAMEofFUNCTION(string &in entity)
{
SetEntityActive("NameofMonster", true);
}

Click the iron maiden in the level editor and go to the Entity tab. Write NAMEofFUNCTION in "PlayerInteractCallback".
06-30-2012, 08:14 PM
Find




Users browsing this thread: 2 Guest(s)