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
Help Needed! AddTimer Sequence problem
bjaffedj Offline
Junior Member

Posts: 39
Threads: 8
Joined: Aug 2012
Reputation: 0
#1
Help Needed! AddTimer Sequence problem

i have made a timer for a sequence to my custom story. it's the second sequence timer in the map, but this one does not want to go past case 1.
can someone please help me to fix this error/bug or mismade script? it would be a great help!
the timer is activate by a script area, and as i said it works, but just not past case 1.

it is the "WakeUp1" script that does not work

the full Script:



void OnStart()
{
SetMapDisplayNameEntry("Intro");
//User properties
SetPlayerActive(false);
SetSanityDrainDisabled(true);
SetInventoryDisabled(true);
SetPlayerCrouchDisabled(true);
SetPlayerJumpDisabled(true);
ShowPlayerCrossHairIcons(false);
SetPlayerLampOil(0.0f);

//Sound properties
PlayMusic("music/intro_bg.ogg", true, 0.5, 2, 0, true);

//Timers
AddTimer("Intro", 8, "Intro");
AddEntityCollideCallback("Player", "WakeUp_1", "WakeUp", true, 1);

//Finally start
//Finally Start
FadeOut(0);
FadeIn(4);
StartPlayerLookAt("prodlook", 2.0f, 2.0f, "");

AddTimer("Debug", 1, "Debug");

//door unlocks
SetEntityConnectionStateChangeCallback("lever", "unlockdoor");
AddUseItemCallback("", "key", "door_key", "KeyDoor", true);

//monster functions
SetEntityCallbackFunc("key", "OnPickup");
}

void Debug(string &in asTimer)
{
AddLocalVarInt("aq", 1);
AddDebugMessage(" "+ GetLocalVarInt("aq"), false);
AddTimer("Debug", 1, "Debug");
}

void Intro(string &in asTimer)
{
AddLocalVarInt("IntroInt", 1);

switch( GetLocalVarInt("IntroInt") )
{
case 1:
FadeOut(2);
break;
case 4:
FadeIn(4);
TeleportPlayer("PlayerStartArea_2");
StartPlayerLookAt("titellook", 2.0f, 2.0f, "");
break;
case 12:
FadeOut(3);
break;
case 14:
FadeIn(4);
TeleportPlayer("PlayerStartArea_3");
SetLocalVarInt("AllowPlayerPushMove",1); //Say we are allowing the player to be pushed
AddTimer("PushPlayerStart1", 0.01, "PushPlayer1"); //Timer as normal here
StartPlayerLookAt("halllook", 2.0f, 2.0f, "");
break;
case 15:
SetMessage("Messages", "Popup1", 5);
break;
case 22:
SetMessage("Messages", "Popup2", 5);
break;
case 29:
SetMessage("Messages", "Popup3", 5);
break;
case 36:
SetMessage("Messages", "Popup4", 5);
break;
case 43:
SetMessage("Messages", "Popup5", 5);
break;
case 50:
SetMessage("Messages", "Popup6", 5);
break;
case 57:
SetMessage("Messages", "Popup7", 5);
break;
case 62:
FadeOut(3);
break;
case 64:
SetMessage("Messages", "Popup8", 5);
break;
case 69:
FadeIn(4);
TeleportPlayer("PlayerStartArea_4");
SetPlayerActive(true);
SetInventoryDisabled(false);
SetPlayerCrouchDisabled(false);
SetPlayerJumpDisabled(false);
ShowPlayerCrossHairIcons(true);
StopPlayerLookAt();
StopMusic(3.0f , 0.0f);
//Say we are no longer allowing the push timer
//instead of Removing the timer
SetLocalVarInt("AllowPlayerPushMove",0);
break;
}
if( GetLocalVarInt("IntroInt") < 126)
AddTimer("blackout", 1, "Intro");
}

void PushPlayer1(string &in asTimer)
{
AddPlayerBodyForce(0, 0.0f, 435.1f, true);
//Only renew the push loop whilst we are allowing the player to be pushed.
if(GetLocalVarInt("AllowPlayerPushMove")==1)
AddTimer("PushPlayerLoop1", 0.012, "PushPlayer1");
}

void unlockdoor(string &in asEntity, int alState)
{
if(GetLeverState("lever")==1)
{
SetSwingDoorLocked("door_lever", false, true);
PlaySoundAtEntity("", "unlock_door", "door_lever", 0, false);
}
}

void KeyDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_key", false, true);
PlaySoundAtEntity("", "unlock_door", "door_key", 0, false);
RemoveItem("key");
}

void OnPickup(string &in asItem, string &in asEntity)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_2", 0, "");
CheckPoint("", "PlayerStartArea_4", "", "DeathHints", "Death1");
}

void WakeUp(string &in asParent, string &in asChild, int alState)
{
AddTimer("WakeUp1", 0.5, "WakeUp1");
}

void WakeUp1(string &in asTimer)
{
AddLocalVarInt("WakeUpInt", 1);

switch(GetLocalVarInt("WakeUpInt") )
{
case 1:
FadeOut(2);
SetEntityActive("servant_grunt_1", false);
break;
case 3:
PlayMusic("music/WakeUp.ogg", false, 1, 0.1, 1, true);
break;
case 5:
FadeIn(0.3);
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(100, 4);
TeleportPlayer("PlayerStartArea_5");
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220); // "Tilts" the players head
FadeRadialBlurTo(0.15, 2);
SetPlayerCrouching(true); // Simulates being on the ground
SetInventoryDisabled(true);
break;
case 23:
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 33, 33); // Change all settings to defaults
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
break;
}
if(GetLocalVarInt("WakeUpInt") < 126)
AddTimer("blackout", 1, "WakeUp");
}
(This post was last modified: 08-13-2012, 09:24 AM by bjaffedj.)
08-12-2012, 04:42 PM
Find


Messages In This Thread
Help Needed! AddTimer Sequence problem - by bjaffedj - 08-12-2012, 04:42 PM



Users browsing this thread: 1 Guest(s)