RE: Timer help - Statyk - 01-03-2012
You have no syntax after StartGame! Try this:
/*void StartGame(string &in asTimer)
{
FadeIn(5);
SetPlayerActive(true);
}*/
RE: Timer help - eagledude4 - 01-03-2012
(01-03-2012, 04:16 AM)Statyk Wrote: You have no syntax after StartGame!
Added the syntax, and moved the FadeIn to OnStart, but the screen doesn't fade in.
RE: Timer help - Your Computer - 01-03-2012
Here's a basic example on how to use a timer:
PHP Code: void OnStart(){ AddTimer("timer_name", 5, "TimerCallback"); }
void TimerCallback(string &in timer_name){ // do something... }
RE: Timer help - Statyk - 01-03-2012
(01-03-2012, 05:34 AM)eagledude4 Wrote: (01-03-2012, 04:16 AM)Statyk Wrote: You have no syntax after StartGame!
Added the syntax, and moved the FadeIn to OnStart, but the screen doesn't fade in. did you make sure to remove the " /* " and " */ "
They tell the script to ignore anything within it. If you don't take those out, the script will ignore the whole function I gave you.
void StartGame(string &in asTimer)
{
FadeIn(5);
SetPlayerActive(true);
}
RE: Timer help - eagledude4 - 01-05-2012
(01-03-2012, 04:16 AM)Statyk Wrote: did you make sure to remove the " /* " and " */ "
They tell the script to ignore anything within it. If you don't take those out, the script will ignore the whole function I gave you.
I'm aware of the function of the /*.
The code I pasted earlier was an earlier version when I was testing something else, and the method was giving an error. Don't worry, I'm not testing commented out functions 
The new code:
Code: void StartGame(string &in asTimer) {
SetPlayerActive(true);
}
I have
Code: SetPlayerActive(false);
FadeIn(5);
AddTimer("FadeTimer", 5, "StartGame");
in my OnStart, so the player is both frozen, gets the fade from black, and then starts the timer to initate the StartGame function so the player is able to move.
RE: Timer help - Statyk - 01-05-2012
So it works now?
RE: Timer help - eagledude4 - 01-05-2012
(01-05-2012, 02:03 AM)Statyk Wrote: So it works now?
No, I was just describing what was supposed to happen.
RE: Timer help - Statyk - 01-05-2012
It looks correct. Are you saving in the correct .hps?... Could you perhaps post all of your .hps? If everything seems fine, I don't understand what the issue could be.
RE: Timer help - eagledude4 - 01-05-2012
(01-05-2012, 02:21 AM)Statyk Wrote: It looks correct. Are you saving in the correct .hps?... Could you perhaps post all of your .hps? If everything seems fine, I don't understand what the issue could be. I'm only using one .hps file.
Code: 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);
FadeIn(5);
AddTimer("FadeTimer", 5, "StartGame");
AddNote("First", "");
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", "big_clock_chime.snt", "clock_grandfather_1", 0, false);
SetDeathHint("Death", "StairScare");
}
void OnEnter() {
}
void OnLeave() {
}
void StartGame(string &in asTimer) {
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, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
if(GetEntitiesCollide("Player", "SonRoomArea") == true) {
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
} else if(GetEntitiesCollide("Player", "DadRoomArea") == true) {
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_16", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_17", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_18", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_19", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_20", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_21", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_22", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_23", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_24", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_25", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_26", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_27", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_28", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_29", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_30", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_29", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_28", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_27", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_26", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_25", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_24", 8, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_23", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_22", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_21", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_19", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_18", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_17", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_16", 0, "");
}
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_31", 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);
}
lang:
Code: <LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">You are awoken by the chimes of a grandfather clock.</Entry>
</CATEGORY>
<CATEGORY Name="PersonalMessages">
<Entry Name="Barrier">I should investigate my father's room before heading downstairs.</Entry>
</CATEGORY>
<CATEGORY Name="Death">
<Entry Name="StairScare">Wardrobes make good hiding places.</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="First">See what's up.</Entry>
</CATEGORY>
</LANGUAGE>
I have skype, so remote assistance is a possibility if you do as well.
RE: Timer help - flamez3 - 01-05-2012
Ok, I have not read every single reply to this thread, so I'm going to throw this out there. Delete the FadeIn(5); from the void on start and put this in:
Quote:void OnStart()
{
AddTimer("fadein", 0.1f, "fadeinTimer");
}
void fadeinTimer(string &in asTimer)
{
FadeIn(4.9f);
}
|