01-02-2012, 06:03 PM
01-02-2012, 06:16 PM
(01-02-2012, 06:03 PM)eagledude4 Wrote: [ -> ]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);
}
How do I make that work?
Code:
if (GetTimerTimeLeft("FadeTimer") == 0);{
FadeIn(5);
SetPlayerActive(true);
}
01-02-2012, 08:38 PM
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?
01-02-2012, 11:09 PM
(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.
01-03-2012, 12:39 AM
Help please?
01-03-2012, 02:08 AM
Did you check my example for testing?
01-03-2012, 02:37 AM
(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?
01-03-2012, 03:55 AM
(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: [ -> ]Help with my timer not calling my function. I don't know what you mean, exactly.(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?
01-03-2012, 04:01 AM
Can I see your whole .hps so I can see your callbacks?
01-03-2012, 04:04 AM
(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);
}