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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lever Puzzle Scripting
3gamers Offline
Junior Member

Posts: 10
Threads: 6
Joined: Oct 2013
Reputation: 0
#1
Lever Puzzle Scripting

Hey guys, I'm working on my first mod for Amnesia and I've looked up tons of videos to help me with this but none of them tell me everything.

I have one of those four lever puzzle things that I want that when you pull each lever you hear a chick screaming and when you have pulled all of them, the prison door unlocks so you can go to the next level.

I'm new to scripting so can someone please help? I really have no idea what to do. I've already got the sound files and I've tried scripting it myself but nothings worked. Any advice would help.

Nepenthe- WIP
(This post was last modified: 10-29-2013, 05:31 PM by 3gamers.)
10-28-2013, 07:47 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Lever Puzzle Scripting

Just whipped this out. It's not tested yet so I *think* you'll find some troubles. You have to change some names too.
Spoiler below!

PHP Code: (Select All)
//Your levers must be Lever_1, Lever_2, and so on until Lever_4.
void OnStart()
{
    
SetEntityConnectionStateChangeCallback("Lever_*""Scream");
    
SetLocalVarInt("Levers"0);
}

void Scream(string &in asEntitystring &in type)
{
    if(
alState = -1)
    {
    
PlaySoundAtEntity("Screams""SoundFile.snt""Player"0.1ffalse);
    
AddLocalVarInt("Levers"1);
    
CheckLevers();
    }
}

void CheckLevers()
{
    if(
GetLocalVarInt("Levers") == 4)
    {
    
SetSwingDoorLocked("DoorName"falsetrue);
    }



"Veni, vidi, vici."
"I came, I saw, I conquered."
10-29-2013, 08:04 AM
Find
3gamers Offline
Junior Member

Posts: 10
Threads: 6
Joined: Oct 2013
Reputation: 0
#3
RE: Lever Puzzle Scripting

Hey, the code definitely worked but the sound syntax I had to use was PlayGuiSound because it was an .ogg file. Thanks a bunch though!

This is what I ended up using:

PlayGuiSound("girlscream3.ogg", 70)

Nepenthe- WIP
10-29-2013, 03:15 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#4
RE: Lever Puzzle Scripting

That works too.

EDIT:
That script is wrong.
It's
PHP Code: (Select All)
PlayGuiSound("girlscream3.ogg"70.0f

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 10-29-2013, 03:19 PM by PutraenusAlivius.)
10-29-2013, 03:17 PM
Find




Users browsing this thread: 3 Guest(s)