04-26-2012, 07:09 AM
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
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?
--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:
void RoomEnter(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_8", true, true);
AddPropForce("door_barricade_1", 10000, 0, 0, "world");
AddTimer("", 20, "WallDisappear");
}
void WallDisappear(string &in asTimer)
{
SetEntityPlayerLookAtCallback("AreaWallLook", "WallBloop", false);
}
void WallBloop(string &in asEntity, int alState)
{
if(alState == -1)
{
SetPropActiveAndFade("fake_wall", false, 0.5f);
PlaySoundAtEntity("", "10_rock_move.snt", "fake_wall", 0, false);
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?