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
Code not working for no apparent reason!
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#1
Code not working for no apparent reason!

I tried working with the wiki and engine scripts but I have no freaking clue what is happening for it not to work maybe it's a bug, no errors are appearing at least.
Let me talk about the code and level editor. I made this code where when you walk in this script area, it will make the door open quickly with wind particles and stuff.

So this is the code of it

void OnStart()

{
AddEntityCollideCallback("JumpscareDoor", "AreaJumpscare", "SanityDec", true, 1);
AddEntityCollideCallback("Handle", "AreaConnect", "AttachLever", true, 1);
wakeUp();
}

void wakeUp()
{
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(10); // Amount of seconds the fade in takes
FadeImageTrailTo(2, 2);
PlayGuiSound("react_pant3.ogg", 1);
FadeSepiaColorTo(0, 2);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220); // "Tilts" the players head
FadeRadialBlurTo(0.5, 2);
SetPlayerCrouching(true); // Simulates being on the ground
AddEntityCollideCallback("Player", "AreaCollide", "EventCollide", true, 1);
AddTimer("trig1", 11.0f, "beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last
}

void beginStory(string &in asTimer)
{
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 33, 33); // Change all settings to defaults
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
SetPlayerLampOil(34);
GiveSanityDamage(80, false);
GivePlayerDamage(30 , "" , false, false);
SetPlayerMoveSpeedMul(0.75f);
SetPlayerRunSpeedMul(0);
//SetPlayerLookSpeedMul(0.5);
AddUseItemCallback("", "HollowNeed", "CellDoor", "UseHollowNeedOnDoor", true);
}

void UseHollowNeedOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("CellDoor", false, true);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
GiveSanityBoostSmall();
RemoveItem(asItem);
}

void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("CellGuardGrunt", true);
AddEnemyPatrolNode("CellGuardGrunt", "Node_1",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_4",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_6",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_10",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_15",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_18",0.001f, "");
}


void AttachLever(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("Lever", true);

    SetEntityActive(asParent, false);
    PlayGuiSound("04_place_wood.ogg", 1);
    SetEntityActive("Mount", false);

}

void UnlockDoor(string &in asEntity, int LeverState)
{
    if(LeverState == 1)
    {
        SetSwingDoorLocked("Open", false, true);
    SetPropStaticPhysics("Open", false);
      SetEntityActive("Message", false);
        GiveSanityBoostSmall();
        PlaySoundAtEntity("", "unlock_door.ogg", "Open", 0, false);
        SetLeverStuckState(asEntity, LeverState, false);
    }
}


void SanityDec(string &in asParent, string &in asChild, int alState)
{
PlayGuiSound("react_scare1.ogg", 1);
GiveSanityDamage(15, true);
}

void int01(string &in asEntity)
{
SetMessage("Messages", "Message", 5);
}


void CollideOpeningDustDoor(string &in asParent, string &in asChild, int alState)
{
    
    CreateParticleSystemAtEntity("PSDoor_1", "ps_dust_paper_blow.ps", "AreaDoor_1", false);
    CreateParticleSystemAtEntity("PSDoor_2", "ps_dust_push.ps", "AreaDoor_1", false);
    
    PlaySoundAtEntity("SoundDoor_1", "scare_wind_reverse", "AreaDoor_1", 1.0f, false);
    PlaySoundAtEntity("creaking_door", "joint_door_move_special.snt", "Door_1", 1.0 / 2.5f, false);
    PlaySoundAtEntity("SoundBong", "scare_tingeling.snt", "Player", 0.0f, false);
    
    AddTimer("opendoor_1", 0.25f, "TimerOpenDoor01");
    AddTimer("lightsout", 1, "TimerOpenDoor01");
    AddTimer("stopeffect", 2, "TimerOpenDoor01");
    
    StartScreenShake(0.007f,2, 0.25f,1);
    
    FadePlayerFOVMulTo(1.5, 0.5f);
    
    /*For CollideBeginSwirl
     */
    PlaySoundAtEntity("SoundFeet1", "01_tiny1", "AreaBeginSwirl", 15.0f, false);
    
    /*DEBUG
     */
    AddDebugMessage("The door at "+asChild+" opens with dust", true);
}
void TimerOpenDoor01(string &in asTimer)
{
    if(asTimer == "stopeffect"){
        FadePlayerFOVMulTo(1, 1);
        PlaySoundAtEntity("breath", "react_breath.snt", "Player", 1.0 / 0.75f, false);
        AddTimer("lookloop", 1, "TimerRandomLook");    //Re-activate the spinning head
        return;
    }
    
    if(asTimer == "lightsout"){
        for(int i=1;i<=4;i++) SetLampLit("torch_static01_"+i, false, true);
        for(int i=1;i<=4;i++) FadeLightTo("LightOff_"+i, 0, 0, 0, 0, 0, 1.5f);
        PlaySoundAtEntity("breath2", "react_breath.snt", "Player", 1.0 / 1, false);
        return;
    }
    
    PlaySoundAtEntity("Wind", "general_wind_whirl", "Player", 2, false);
    PlaySoundAtEntity("scare", "react_scare.snt", "Player", 0.75f, false);

    StopSound("creaking_door", 1.0f);
    
    PlayMusic("18_amb.ogg", true, 1.0f, 0, 0, true);
    
    CreateParticleSystemAtEntity("PSDoor_3", "ps_dust_push.ps", "AreaDoor_2", false);
    CreateParticleSystemAtEntity("PSDoor_4", "ps_dust_push.ps", "AreaDoor_3", false);
    
    SetSwingDoorClosed("Door_1", false, false);
    SetSwingDoorDisableAutoClose("Door_1", true);
    
    AddTimer("Door_1", 0.01f, "TimerSwingDoor");
    
    GiveSanityDamage(10, true);
}

and I made every name in the level editor, comparing to this code. So I have no clue why it is not working at all, or no unknown reason. the code looks fine and nothing is missing. so I am confused, Literally!!!!!!
(This post was last modified: 02-07-2014, 05:47 PM by Radical Batz.)
02-07-2014, 05:43 PM
Find


Messages In This Thread
Code not working for no apparent reason! - by Radical Batz - 02-07-2014, 05:43 PM



Users browsing this thread: 1 Guest(s)