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


Thread Rating:
  • 5 Vote(s) - 3.8 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting, need urgent help!
MrCookieh Offline
Member

Posts: 157
Threads: 8
Joined: Jul 2011
Reputation: 0
#81
RE: Scripting, need urgent help!

OnStart(){
SetEntityCallbackFunc("note", "Func");
}

void Func(string &in asEntity, string &in type){
if(type == "OnPickup"){
PlaySoundAtEntity("", "yourbangsound", "Player", 0, false);
PlaySoundAtEntity("", "gaspingsound", "Player", 0, false);
StartPlayerLookAt(string& asEntityName, float afSpeedMul, float afMaxSpeed, string& asAtTargetCallback);
AddTimer("Func2", 1, "Func2");
}
}
void Func2(string &in asTimer){
StopPlayerLookAt();
}

Explaining time: At first you declare the function to call, when you pickup the note.
Then the system checks, if it's on pickup (since it's a note, it's pickup).
Then it plays the sounds (already said, it plays the sounds after picking up).
After that, the head of the player turns to your entity.
You add a timer, which resets the look, so you can move your view again.

The Well: Descent - Take a look at it!
07-25-2011, 06:40 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#82
RE: Scripting, need urgent help!

O_O Oh my god...

So if I copy and paste that exact thing... what all should I change?

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-25-2011, 06:45 PM
Website Find
MrCookieh Offline
Member

Posts: 157
Threads: 8
Joined: Jul 2011
Reputation: 0
#83
RE: Scripting, need urgent help!

yourbangsound - to your banging sound
gaspingsound - gaspingsound
string& asEntityName - where you have to look at
float afSpeedMul - the speed (smth around 5-6, to have a fast, shocked turn around)
float afMaxSpeed - I always keep it at same speed
string& asAtTargetCallback - function to call. if no function just do ""
Func2 - how you want to name your timer
Func2 - the function to call
1 (AddTimer(...)) - How long the player has to look at the point

The Well: Descent - Take a look at it!
07-25-2011, 06:50 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#84
RE: Scripting, need urgent help!

...Yeah... I'm VERY lost...

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-25-2011, 06:52 PM
Website Find
MrCookieh Offline
Member

Posts: 157
Threads: 8
Joined: Jul 2011
Reputation: 0
#85
RE: Scripting, need urgent help!

What's the problem?
You don't know what to insert?

The Well: Descent - Take a look at it!
07-25-2011, 07:03 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#86
RE: Scripting, need urgent help!

Yes, I have no idea what to put into those areas, or where... sorry :/

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-25-2011, 07:07 PM
Website Find
MrCookieh Offline
Member

Posts: 157
Threads: 8
Joined: Jul 2011
Reputation: 0
#87
RE: Scripting, need urgent help!

Creates a sound on an entity.

asSoundName - internal name
asSoundFile - the sound to use + extension .snt
asEntity - the entity to create the sound at, can be “Player”
afFadeTime - time in seconds the sound needs to fade
abSaveSound - determines whether a sound should “remember” its state. If true, the sound is never attached to the entity! Also note that saving should on be used on looping sounds!

AddTimer(string& asName, float afTime, string& asFunction);

Creates a timer which calls a function when it expires.
Callback syntax: void MyFunc(string &in asTimer)

asName - the name of the timer
afTime - time in seconds
asFunction - the function to call

if you're not sure, look at the amnesia wiki, there are all functions:
http://wiki.frictionalgames.com/hpl2/amn..._functions

The Well: Descent - Take a look at it!
07-25-2011, 07:12 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#88
RE: Scripting, need urgent help!

The thing I am not really understanding is the timer part.

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-25-2011, 07:23 PM
Website Find
MrCookieh Offline
Member

Posts: 157
Threads: 8
Joined: Jul 2011
Reputation: 0
#89
RE: Scripting, need urgent help!

Well, you create a Timer, which resets after 1 second the view, so the player's view isn't focused on your object anymore.
If you would add it after the StartPlayerLookAt(...), the camera panning would stop.

So I added a timer, which executes after 1 second.
the first parameter is just the timername, so this doesn't matter, the second one the time, after
how much seconds the timer expires, and the third is the function to call.

The Well: Descent - Take a look at it!
07-25-2011, 08:58 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#90
RE: Scripting, need urgent help!

Okay, so I am only getting 1 fatal error, (Expected Identifier) its something with line 13,22. Here is that line of code.
SetEntityCallbackFunc("notethree", "Func");

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 07-27-2011, 03:27 AM by JetlinerX.)
07-27-2011, 03:21 AM
Website Find




Users browsing this thread: 10 Guest(s)