MrCookieh
Member
Posts: 157
Threads: 8
Joined: Jul 2011
Reputation:
0
|
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.
|
|
07-25-2011, 06:40 PM |
|
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
|
RE: Scripting, need urgent help!
O_O Oh my god...
So if I copy and paste that exact thing... what all should I change?
|
|
07-25-2011, 06:45 PM |
|
MrCookieh
Member
Posts: 157
Threads: 8
Joined: Jul 2011
Reputation:
0
|
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
|
|
07-25-2011, 06:50 PM |
|
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
|
RE: Scripting, need urgent help!
...Yeah... I'm VERY lost...
|
|
07-25-2011, 06:52 PM |
|
MrCookieh
Member
Posts: 157
Threads: 8
Joined: Jul 2011
Reputation:
0
|
RE: Scripting, need urgent help!
What's the problem?
You don't know what to insert?
|
|
07-25-2011, 07:03 PM |
|
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
|
RE: Scripting, need urgent help!
Yes, I have no idea what to put into those areas, or where... sorry :/
|
|
07-25-2011, 07:07 PM |
|
MrCookieh
Member
Posts: 157
Threads: 8
Joined: Jul 2011
Reputation:
0
|
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
|
|
07-25-2011, 07:12 PM |
|
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
|
RE: Scripting, need urgent help!
The thing I am not really understanding is the timer part.
|
|
07-25-2011, 07:23 PM |
|
MrCookieh
Member
Posts: 157
Threads: 8
Joined: Jul 2011
Reputation:
0
|
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.
|
|
07-25-2011, 08:58 PM |
|
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
|
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");
(This post was last modified: 07-27-2011, 03:27 AM by JetlinerX.)
|
|
07-27-2011, 03:21 AM |
|
|