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


Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some questions on scripting
BlueFury Offline
Senior Member

Posts: 470
Threads: 30
Joined: May 2011
Reputation: 9
#1
Question  Some questions on scripting

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.
10-21-2011, 04:21 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#2
RE: Some questions on scripting

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:

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/amn..._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

(This post was last modified: 10-22-2011, 01:23 AM by flamez3.)
10-21-2011, 04:34 PM
Find
BlueFury Offline
Senior Member

Posts: 470
Threads: 30
Joined: May 2011
Reputation: 9
#3
RE: Some questions on scripting

thank you very much, *MASSIVEBROFIST*
rep+
10-21-2011, 04:59 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#4
RE: Some questions on scripting

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


(This post was last modified: 10-21-2011, 05:03 PM by flamez3.)
10-21-2011, 05:02 PM
Find
BlueFury Offline
Senior Member

Posts: 470
Threads: 30
Joined: May 2011
Reputation: 9
#5
RE: Some questions on scripting

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

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#6
RE: Some questions on scripting

(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

10-21-2011, 07:27 PM
Find




Users browsing this thread: 1 Guest(s)