Frictional Games Forum (read-only)
Some questions on scripting - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Some questions on scripting (/thread-10906.html)



Some questions on scripting - BlueFury - 10-21-2011

Guys, yeah me again XD
I have some things i just cant find on the script functions page
Rep+ for the people who help me

1) jump scares, yeah i really need to know how to make those
which include...
-doors suddenly going open when your in front of them
-monster sounds when you enter a room
-bodies/objects flying towards you

2) sanity effects when you look at something

3) monsters coming towards you and dissapearing when close

4) change your spawn location

Yes i am stupid and sorry for my bad english


Thanks in advance.


RE: Some questions on scripting - flamez3 - 10-21-2011

Jump Scares:

Door:

void OnStart()
{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "doorclose" , true , 1);
}

void doorclose(string &in asParent, string &in asChild, int alState)
{
AddPropForce("door1", 0, 0, 0, "world");
}

That should work, when your adding a prop force, the first 0 stands for X, next 0 stand for Y, next 0 stands for Z. go into your level editor and check which way you want your door to open. (also, in the door entity settings tab, make sure that the door is open a little bit, like 0.1) <----------Actually, i checked and it didn't work for me, sorry :/

Monster sounds:

void OnStart()
{
AddEntityCollideCallback("Player" , "ScriptArea_2" , "MonsterSound" , true , 1);
}

void MonsterSound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "the monster of your choice's sound", "Player", 0, false);
}

Bodies/objects flying at you

void OnStart()
{
AddEntityCollideCallback("Player" , "ScriptArea_3" , "BodyThrow" , true , 1);
}

void BodyThrow(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("corpse_male_1", true);
AddPropImpulse("corpse_male_1", 0, 0, 0, "world");
}

Same deal as the door when it comes to the 0's, and I've added the SetEntityActive so that it doesn't stay there until you collide with the scriptarea. Make sure the guy is inactive.

Sanity Effects:

To the best of my knowledge:

void OnStart()
{
SetEntityPlayerLookAtCallback("internal name", "ScriptArea_4, bool abRemoveWhenLookedAt);
}

void InsanityScare(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(70);
}

Note: Don't add too much sanity as it can crash people's computers.

Monster coming towards you and dissapearing:

No script involved really, just go to the enemy in the editor, then once that is done; go to his Entity tab, and check "Hallucination"

Change your spawn location:

For this is pretty hard.

You need to add checkpoints for this, I have never done it personally so I got this from the script functions page:

Code:
void CheckPoint (string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry);Sets a checkpoint at which the player will respawn in case he dies.Callback syntax: void MyFunc(string &in asName, int alCount) Count is 0 on the first checkpoint load!
asName - the internal nameasStartPos - the name of the StartPos in the editorasCallback - the function to call when the player dies/respawnsasDeathHintCat - the category of the death hint message to be used in the .lang fileasDeathHintEntry - the entry in the .lang file


You're not stupid, you need experience before you can get into these things and do it without thought. Smile

All this was found in the http://wiki.frictionalgames.com/hpl2/amnesia/script_functions page. Sorry I didn't go all out and explain what they all do. It's very late XD. If you need any more help just reply or PM meSmile


RE: Some questions on scripting - BlueFury - 10-21-2011

thank you very much, *MASSIVEBROFIST*
rep+


RE: Some questions on scripting - flamez3 - 10-21-2011

(10-21-2011, 04:59 PM)BlueFury Wrote: *MASSIVEBROFIST*
NP
Wink




RE: Some questions on scripting - BlueFury - 10-21-2011

(10-21-2011, 05:02 PM)flamez3 Wrote:
(10-21-2011, 04:59 PM)BlueFury Wrote: *MASSIVEBROFIST*
NP
Wink
nice redemption story btw Smile


RE: Some questions on scripting - flamez3 - 10-21-2011

(10-21-2011, 06:21 PM)BlueFury Wrote:
(10-21-2011, 05:02 PM)flamez3 Wrote:
(10-21-2011, 04:59 PM)BlueFury Wrote: *MASSIVEBROFIST*
NP
Wink
nice redemption story btw Smile
Thanks Big Grin