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 if not looking
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#3
RE: Script if not looking

That didn't occur to me, but thanks for reminding me. My script now looks like this:

PHP Code: (Select All)
void RoomEnter(string &in asParentstring &in asChildint alState)
{
    
SetSwingDoorClosed("mansion_8"truetrue);
    
AddPropForce("door_barricade_1"1000000"world");
    
AddTimer(""20"WallDisappear"); 
}

void WallDisappear(string &in asTimer)
{
    
SetEntityPlayerLookAtCallback("AreaWallLook""WallBloop"false);
    
AddTimer(""0.1f"WallDisappear2"); 
}

void WallDisappear2(string &in asTimer)
{
    if(
GetLocalVarInt("LookingAt") == 0)
    {
        
SetPropActiveAndFade("fake_wall"false0.5f);
        
PlaySoundAtEntity("""10_rock_move.snt""fake_wall"0false);
        
StartScreenShake(0.075f,1.5f,1.0f,0.5f);
        
SetEntityActive("AreaWallLook"false);
    }
}

void WallBloop(string &in asEntityint alState)
{
    if(
alState == 1)
    {
        
SetLocalVarInt("LookingAt"1);
    }
    if(
alState == -1)
    {
        
SetPropActiveAndFade("fake_wall"false0.5f);
        
PlaySoundAtEntity("""10_rock_move.snt""fake_wall"0false);
        
StartScreenShake(0.075f,1.5f,1.0f,0.5f);
        
SetEntityActive("AreaWallLook"false);
    }


That way, when the timer runs out, if the player is looking at the area, it immediately adds a variable to stop the second timer--which would make the wall disappear if you were looking away. I made a second timer with a small value just so it doesn't poof the wall before adding the variable.

Also figured out my second problem along the way, deactivating the LookAt area so there's nothing to trigger the script anymore.

04-26-2012, 08:13 AM
Find


Messages In This Thread
Script if not looking - by Damascus - 04-26-2012, 07:09 AM
RE: Script if not looking - by Your Computer - 04-26-2012, 07:38 AM
RE: Script if not looking - by Sazureth - 04-27-2012, 06:32 PM
RE: Script if not looking - by DRedshot - 04-27-2012, 06:35 PM
RE: Script if not looking - by Damascus - 04-26-2012, 08:13 AM
RE: Script if not looking - by DRedshot - 04-27-2012, 06:13 PM
RE: Script if not looking - by Homicide13 - 04-27-2012, 06:41 PM



Users browsing this thread: 1 Guest(s)