Frictional Games Forum (read-only)

Full Version: Scripting, need urgent help!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13
Code:
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.
O_O Oh my god...

So if I copy and paste that exact thing... what all should I change?
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
...Yeah... I'm VERY lost...
What's the problem?
You don't know what to insert?
Yes, I have no idea what to put into those areas, or where... sorry :/
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 thing I am not really understanding is the timer part.
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.
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");
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13