The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
#1
Script if not looking

I'm trying to set up a script so that when a certain timer runs out, the following happens:

--If you're not looking at an Area, a script triggers
--If you ARE looking at the Area, the script triggers as soon as you look away

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);
}

void WallBloop(string &in asEntityint alState)
{
    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);
    }


I have two huge problems with my approach, though. Firstly, WallBloop doesn't trigger if you are looking away when the timer runs out. You have to look at the Area, and THEN look away, before it triggers.

The second problem is that--in the LookAtCallback--if abRemoveWhenLookedAt is set to "false" the function triggers every time you look at the area and away. If it's set to "true" it doesn't do anything at all because the script is removed when you look at the area, so there's nothing set when you look away. I want it to stop as soon as you look away, but there are no scripts to remove a LookAtCallback independently.

Anyone help me out?

(This post was last modified: 04-26-2012, 08:15 AM by Damascus.)
04-26-2012, 07:09 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)