Frictional Games Forum (read-only)
Fadein help - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Fadein help (/thread-12290.html)

Pages: 1 2 3 4


Fadein help - eagledude4 - 01-02-2012

Solved


RE: Timer help - Statyk - 01-02-2012

(01-02-2012, 06:03 PM)eagledude4 Wrote:
Code:
if (GetTimerTimeLeft(FadeTimer) == 0));
        FadeIn(5);
        SetPlayerActive(true);
    }

How do I make that work?
I'm not the best with if functions to be honest, but I have an IDEA:

Code:
if (GetTimerTimeLeft("FadeTimer") == 0);{
FadeIn(5);
SetPlayerActive(true);
}




RE: Timer help - Your Computer - 01-02-2012

For starters, you might want to get rid of the semicolon at the end of the if statement. Secondly, timer callbacks get called when they reach 0 time left anyway, so why check for 0 time?


RE: Timer help - eagledude4 - 01-02-2012

(01-02-2012, 08:38 PM)Your Computer Wrote: For starters, you might want to get rid of the semicolon at the end of the if statement. Secondly, timer callbacks get called when they reach 0 time left anyway, so why check for 0 time?

I fixed the semicolon after I pasted the code. I didn't realize the timer launched the function automatically.
Problem is still persisting.



RE: Timer help - eagledude4 - 01-03-2012

Help please?



RE: Timer help - Statyk - 01-03-2012

Did you check my example for testing?



RE: Timer help - Your Computer - 01-03-2012

(01-03-2012, 12:39 AM)eagledude4 Wrote: Help please?

With what? Isn't the code example inside a callback, specifically a timer callback that loops?


RE: Timer help - eagledude4 - 01-03-2012

(01-03-2012, 02:08 AM)Statyk Wrote: Did you check my example for testing?

Yes I did, it didn't work. I ended up fixing what you pasted, and have:
Code:
void StartGame() {
    if (GetTimerTimeLeft("FadeTimer") == 0)) {
        FadeIn(5);
        SetPlayerActive(true);
    }
}

That code gives me two errors though, on these lines:
Code:
PlaySoundAtEntity("big_clock_chime", "Custom\big_clock_chime.snt", "clock_grandfather_1", 0, false);
Code:
if (GetTimerTimeLeft("FadeTimer") == 0)) {


(01-03-2012, 02:37 AM)Your Computer Wrote:
(01-03-2012, 12:39 AM)eagledude4 Wrote: Help please?

With what? Isn't the code example inside a callback, specifically a timer callback that loops?
Help with my timer not calling my function. I don't know what you mean, exactly.




RE: Timer help - Statyk - 01-03-2012

Can I see your whole .hps so I can see your callbacks?


RE: Timer help - eagledude4 - 01-03-2012

(01-03-2012, 04:01 AM)Statyk Wrote: Can I see your whole .hps so I can see your callbacks?

Code:
bool TriggeredEnemy;

void OnStart() {
    if (ScriptDebugOn()) {
        GiveItemFromFile("lantern", "lantern.ent");
        for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
        /*SetEntityActive("invisWall", false);
        SetEntityActive("blockArea", false);*/
    }
    SetPlayerActive(false);
    AddNote("First", "");
    AddTimer("FadeTimer", 5, "StartGame");
    AddEntityCollideCallback("Player", "EnemyTriggerArea", "EnteredEnemyTriggerArea", true, 1);
    AddEntityCollideCallback("Player", "BlockArea", "EnteredBlockArea", true, 1);
    SetEntityPlayerInteractCallback("chest_small_2", "TriggerSpider", true);
    SetEntityCallbackFunc("key_1", "OnPickup");
    PlaySoundAtEntity("big_clock_chime", "Custom\big_clock_chime.snt", "clock_grandfather_1", 0, false);
    SetDeathHint("Death", "StairScare");
}

void OnEnter() {
}

void OnLeave() {
}

/*void StartGame() {
    if (GetTimerTimeLeft("FadeTimer") == 0)) {
        FadeIn(5);
        SetPlayerActive(true);
    }
}*/
    
void EnteredEnemyTriggerArea(string &in asParent, string &in asChild, int alState) {
    SetEntityActive("servant_grunt_1", true);
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
    if(GetEntitiesCollide("Player", "SonRoomArea") == true) {
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 5, "");
    } else if(GetEntitiesCollide("Player", "DadRoomArea") == true) {
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 5, "");
    }
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
}

void EnteredBlockArea(string &in asParent, string &in asChild, int alState) {
    if (HasItem("key_1") == false) {
        SetMessage("PersonalMessages", "Barrier", 6);
    }
}

void OnPickup(string &in asEntity, string &in type) {
    SetEntityActive("invisWall", false);
    SetEntityActive("blockArea", false);
}

void TriggerSpider(string &in asEntity) {
    SetEntityActive("spider_1", true);
}