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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Areas
ZRPT Offline
Junior Member

Posts: 17
Threads: 3
Joined: Aug 2011
Reputation: 1
#1
Script Areas

I was wondering what type of script would be used to only activate a features when entering an area in a certain direction. An example would be in the custom story "The Attic" the scene where you get knocked down the stairs. Going up the stairs there are no effects, however when going back down you get pushed and thrown all the way down. After looking at the scrip the author has made I have concluded that this was the script he used.
void Scare(string &in asParent, string &in asChild, int alState)
{
        SetEntityActive("levelchangefade", true);
        SetSwingDoorLocked("mansion_8", false, true);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "Partdoor1", false);    
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "Partdoor1", false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "Partdoor2", false);    
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "Partdoor2", false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "Partdoor3", false);    
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "Partdoor3", false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "Partdoor4", false);    
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "Partdoor4", false);
        PlaySoundAtEntity("", "lurker_hit_Wood", "Player", 0, false);
        GiveSanityDamage(20, true);
        AddPlayerBodyForce(-40000, 25000, 0, false);
        FadePlayerRollTo(75, 3, 2);
        StartPlayerLookAt("mansion_8", 2, 2, "");
        SetPlayerCrouching(true);
        AddTimer("", 2, "Timer1");
        AddTimer("", 10, "Timer2");
        GivePlayerDamage(10, "BloodSplat", false, false);
        PlaySoundAtEntity("", "player_bodyfall", "Player", 0, false);
        FadeRadialBlurTo(1, 0.5);
}
//--------------------------------------------------------------------------------//
void Timer1(string &in asTimer)
{
        StartPlayerLookAt("mansion_8", 0.4, 0.4, "");
        FadePlayerRollTo(-75, 3, 2);
        AddTimer("", 2, "Timer3");
        PlaySoundAtEntity("", "react_sigh", "Player", 0, false);
}
//--------------------------------------------------------------------------------//
void Timer3(string &in asTimer)
{
        PlaySoundAtEntity("", "react_sigh", "Player", 0, false);
        StartPlayerLookAt("mansion_8", 0.4, 0.4, "");
        FadePlayerRollTo(0, 0, 0);
        AddTimer("", 2, "Timer5");
        FadeRadialBlurTo(0, 1);
}
//--------------------------------------------------------------------------------//
void Timer5(string &in asTimer)
{
        PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}
//--------------------------------------------------------------------------------//
void Timer2(string &in asTimer)
{
        SetPlayerCrouching(false);
        StopPlayerLookAt();
}

I can't really explain it but if you watch this video and skip to 10:33 and watch until 12:50, you should get an understanding of what I mean

08-28-2011, 07:28 AM
Find
GreyFox Offline
Member

Posts: 162
Threads: 23
Joined: Jul 2011
Reputation: 2
#2
RE: Script Areas

You would make a script area and add this to your script

AddEntityCollideCallback("Player", "ScriptName", "MyFunc", true, -1);

Player= Means when the Player Collides with the trigger
ScriptName= is what you named the Script Area In the Editor
MyFunc= Could be named anything but this will be used for the syntax
true= It deletes when you go through it once
-1= leaving so the opposite way I believe

alStates = 1 = only enter, -1 = only leave, 0 = both

Hopefully that'll Help

-Grey Fox

Current Project
Forgotten
08-28-2011, 07:55 AM
Find
ZRPT Offline
Junior Member

Posts: 17
Threads: 3
Joined: Aug 2011
Reputation: 1
#3
RE: Script Areas

(08-28-2011, 07:55 AM)GreyFox Wrote: You would make a script area and add this to your script

AddEntityCollideCallback("Player", "ScriptName", "MyFunc", true, -1);

Player= Means when the Player Collides with the trigger
ScriptName= is what you named the Script Area In the Editor
MyFunc= Could be named anything but this will be used for the syntax
true= It deletes when you go through it once
-1= leaving so the opposite way I believe

alStates = 1 = only enter, -1 = only leave, 0 = both

Hopefully that'll Help

-Grey Fox



I don't want the script to activate accidentally, as you can see in the video, the player goes back to check on the door, how would I prevent it from activating early? Would it involve using the timer?
(This post was last modified: 08-28-2011, 08:06 AM by ZRPT.)
08-28-2011, 08:04 AM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#4
RE: Script Areas

Odds are he added the AddEntityCollideCallback in a previous function. Most likely the one where you hear the cave-in, or when the door slams shut behind you.
08-28-2011, 08:12 AM
Find
ZRPT Offline
Junior Member

Posts: 17
Threads: 3
Joined: Aug 2011
Reputation: 1
#5
RE: Script Areas

(08-28-2011, 08:12 AM)Obliviator27 Wrote: Odds are he added the AddEntityCollideCallback in a previous function. Most likely the one where you hear the cave-in, or when the door slams shut behind you.

Hmm, do you know what it means if the PlayerLookATCallBackAutoRemo option is checked?

What me and a partner are currently trying to script is: We walk down a hallway, and we enter a door. In this hallway before entering the door, there will be an event to activate once we have gathered a note in that door. What i don't want to happen is for a player to walk back and accidentally trigger this event before collecting the note and heading back out to the hallway. This event would unlock a door, and cause an earthquake.
(This post was last modified: 08-28-2011, 08:29 AM by ZRPT.)
08-28-2011, 08:27 AM
Find
MegaScience Offline
Member

Posts: 213
Threads: 1
Joined: Aug 2011
Reputation: 2
#6
RE: Script Areas

What I'm thinking is there's some trigger upstairs which makes the falldownstairs trigger start working. If you want to make it work only if certain things are met, use global variables or inventory checks.

Edit: I don't like how that guy places, he definitely missed a lot, like actually trying the key he found on other doors before barreling on through the Custom Story. But I guess that only helps single out what activates those sequences. Still, it does look like there's a script area in one of the rooms ahead which activates the fly down stairs script area. Not that hard to understand from my standpoint.

And then he keeps trying the key on everything because he doesn't realize it probably went to the room right across from where he found it. This guy needs to learn some basics. Sad
(This post was last modified: 08-28-2011, 01:43 PM by MegaScience.)
08-28-2011, 01:11 PM
Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#7
RE: Script Areas

You need to put 2 script areas: when you collide with the first one, it will activate the second one. But if you want it to activate when you pick up a note, then you will only need 1 script area.
Use AddEntityCollideCallback making the entity Player and the entity it collides with the name of the note. Use OnPickup as the function. Place the script area that will trigger your earthquake where you'd like it and make sure it's inactive. Under the AddEntityCollideCallback mentioned above, use SetEntityActive with the name of your script area. Now you just have to make an AddEntityCollideCallback for the now active script area. Smile if you're confused tell me, I'll fire up my computer and make the whole code for you. (I'm using mobile and my memory)
P.S. I worked with JetlinerX to create that scare you're talking about. Smile I also did the door explode in your face scare with him.

Ba-da bing, ba-da boom.
(This post was last modified: 08-28-2011, 02:05 PM by JenniferOrange.)
08-28-2011, 02:04 PM
Find
MegaScience Offline
Member

Posts: 213
Threads: 1
Joined: Aug 2011
Reputation: 2
#8
RE: Script Areas

(08-28-2011, 02:04 PM)JenniferOrange Wrote: You need to put 2 script areas: when you collide with the first one, it will activate the second one. But if you want it to activate when you pick up a note, then you will only need 1 script area.
Use AddEntityCollideCallback making the entity Player and the entity it collides with the name of the note. Use OnPickup as the function. Place the script area that will trigger your earthquake where you'd like it and make sure it's inactive. Under the AddEntityCollideCallback mentioned above, use SetEntityActive with the name of your script area. Now you just have to make an AddEntityCollideCallback for the now active script area. Smile if you're confused tell me, I'll fire up my computer and make the whole code for you. (I'm using mobile and my memory)
P.S. I worked with JetlinerX to create that scare you're talking about. Smile I also did the door explode in your face scare with him.

Do you agree that guy should have slowed down during the playthrough, then? D: I felt bad for him, rushed so hard he missed the most obvious door for the key, then spent the rest of that video and the next trying to use it on all the wrong doors.

My advice: Can you ask the creator to put out an update to Chapter one where there's a key to the next level so you can't skip that room and be stuck with that key? Or have it removed? Because that was frustrating to watch...
08-28-2011, 02:18 PM
Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#9
RE: Script Areas

(08-28-2011, 02:18 PM)MegaScience Wrote: Do you agree that guy should have slowed down during the playthrough, then? D: I felt bad for him, rushed so hard he missed the most obvious door for the key, then spent the rest of that video and the next trying to use it on all the wrong doors.

My advice: Can you ask the creator to put out an update to Chapter one where there's a key to the next level so you can't skip that room and be stuck with that key? Or have it removed? Because that was frustrating to watch...

I'll admit it put you on a wild goose chase, and I believe the assisstants key (if that's the one you're talking about) was meant to be used BEFORE going into the attic. I don't think the guy that played this one even checked all the doors in the beginning. I watched Cry play and he found the assistants room easily. I'll tell him, though.


Ba-da bing, ba-da boom.
08-28-2011, 02:31 PM
Find
MegaScience Offline
Member

Posts: 213
Threads: 1
Joined: Aug 2011
Reputation: 2
#10
RE: Script Areas

(08-28-2011, 02:31 PM)JenniferOrange Wrote: I'll admit it put you on a wild goose chase, and I believe the assisstants key (if that's the one you're talking about) was meant to be used BEFORE going into the attic. I don't think the guy that played this one even checked all the doors in the beginning. I watched Cry play and he found the assistants room easily. I'll tell him, though.

OfficerD82 checked the door, noticing it was locked, so he went across the hall and found the key. What I don't get is how he completely forgot the trail on the door, the locked door itself, and his newly acquired key all at once, then forgetting where he even got it later on. I've actually tried adding him, and just now left messages on his YouTube so hopefully I can get more understanding before I judge him. But since this is a possibility, hopefully JetlinerX will agree to make the change.
08-28-2011, 03:06 PM
Find




Users browsing this thread: 1 Guest(s)