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
Script Help Script Help
Knusper. Offline
Member

Posts: 58
Threads: 7
Joined: Feb 2013
Reputation: 2
#12
RE: check if active/ string to int

Yes, it all has to be.
And the timer works now, before i changed it it didnt work.
And I write all scripts myself, just with help of the engine scripts.
Here is the complete script:
void OnEnter()
{
    PlayMusic("Slender 1.ogg", true, 1.0f, 0.0f, 1, true);  
    
}

void OnStart()
{
    
    for (int i = 0; i < 10; i++)
        {
            AddEntityCollideCallback("Player" , "ScriptArea_" + 0 + i , "InArea" , true , 1);
        }
        
        
    for (int i = 11; i < 20; i++)
    
        {
            for (int j = 1; j < 5; j++)
                AddEntityCollideCallback("Player" , "ScriptArea_" + i + "." + j, "FadeOut1" , true , 1);
        }
        
    SetSanityDrainDisabled(true);
    AddEntityCollideCallback("Player" , "Music2" , "secondmusic" , true , 1);    
    AddEntityCollideCallback("Player" , "activeslendy_1" , "Slender1" , true , 1);    
    AddEntityCollideCallback("Player" , "activeslendy_2" , "Slender2" , true , 1);    
}

bool IsInArea = false;
bool Slender_1active = false;
bool Slender_2active = false;
string LastArea = "00";


void secondmusic (string &in asParent, string &in asChild, int alState)
{
    StopMusic(0.0f, 1);
    PlayMusic("Slender 2.ogg", true, 1.0f, 0.0f, 2, true);
}


void Slender1 (string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("Slender_1", true);
    Slender_1active = true;
    AddDebugMessage("active", false);
}

void Slender2 (string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("Slender_2", true);
    Slender_2active = true;
    AddDebugMessage("active2", false);
}

void InArea(string &in asParent, string &in asChild, int alState)
{
    string areanumber1 = StringSub(asChild, 11, 2);
    if ("Slender_" + areanumber1[1] + active)
    {
        AddDebugMessage("InArea > if statement executing", false);
        IsInArea = true;
        LastArea = areanumber1;
        
        AddTimer("Dead", 3, "Dead");
    }
    
}


void Dead(string &in asTimer)
{
    if(IsInArea == true)
    {
        FadeOut(0.5);
        SetPlayerHealth(0);
    }
}


void FadeOut1(string &in asParent, string &in asChild, int alState)
{
    IsInArea = false;
    string areanumber2 = StringSub(asChild, 11, 2);
    int i1, i2;
    
    i2 = areanumber2[0] *10 + areanumber2[1];       //LastArea 2 als int
    i1 = LastArea[0] *10 + LastArea[1];                //LastArea 1 als int
    
    if(i1 == i2 - 10)
    {
        //FadeOut
        AddDebugMessage("fade", false);
        LastArea = areanumber2;
    }
    
}


void OnLeave ()
{
    SetupLoadScreen("", "", 5, "");
}

No one knows, how "I" goes.
(This post was last modified: 03-25-2013, 01:32 PM by Knusper..)
03-25-2013, 01:29 PM
Find


Messages In This Thread
Script Help - by Knusper. - 03-23-2013, 10:02 PM
RE: check if active/ string to int - by Adrianis - 03-24-2013, 01:08 AM
RE: check if active/ string to int - by Rapture - 03-24-2013, 02:18 AM
RE: check if active/ string to int - by Knusper. - 03-24-2013, 01:15 PM
RE: check if active/ string to int - by Adrianis - 03-24-2013, 03:14 PM
RE: check if active/ string to int - by Knusper. - 03-24-2013, 08:51 PM
RE: check if active/ string to int - by Adrianis - 03-24-2013, 10:48 PM
RE: check if active/ string to int - by Knusper. - 03-24-2013, 10:57 PM
RE: check if active/ string to int - by Adrianis - 03-24-2013, 11:03 PM
RE: check if active/ string to int - by Knusper. - 03-25-2013, 10:00 AM
RE: check if active/ string to int - by Adrianis - 03-25-2013, 01:09 PM
RE: check if active/ string to int - by Knusper. - 03-25-2013, 01:29 PM
RE: check if active/ string to int - by Knusper. - 03-25-2013, 05:56 PM
RE: check if active/ string to int - by Adrianis - 03-25-2013, 06:00 PM
RE: check if active/ string to int - by Knusper. - 03-26-2013, 10:44 AM
RE: check if active/ string to int - by Adrianis - 03-26-2013, 11:55 AM
RE: check if active/ string to int - by Knusper. - 03-26-2013, 12:10 PM
RE: check if active/ string to int - by Adrianis - 03-26-2013, 12:52 PM
RE: check if active/ string to int - by Knusper. - 03-26-2013, 01:11 PM
RE: check if active/ string to int - by Adrianis - 03-26-2013, 01:14 PM
RE: check if active/ string to int - by Knusper. - 03-26-2013, 01:19 PM
RE: check if active/ string to int - by Adrianis - 03-26-2013, 01:37 PM
RE: check if active/ string to int - by Knusper. - 03-26-2013, 01:42 PM
RE: check if active/ string to int - by Adrianis - 03-26-2013, 01:54 PM
RE: check if active/ string to int - by Knusper. - 03-26-2013, 02:03 PM
RE: check if active/ string to int - by NaxEla - 03-26-2013, 05:44 PM
RE: check if active/ string to int - by Adrianis - 03-26-2013, 06:11 PM
RE: check if active/ string to int - by Knusper. - 03-26-2013, 06:51 PM
RE: check if active/ string to int - by Adrianis - 03-26-2013, 07:48 PM
RE: check if active/ string to int - by Knusper. - 03-26-2013, 08:44 PM
RE: Script Help - by Adrianis - 03-27-2013, 02:03 PM
RE: Script Help - by Knusper. - 03-27-2013, 02:21 PM
RE: Script Help - by No Author - 03-27-2013, 02:24 PM
RE: Script Help - by PutraenusAlivius - 03-27-2013, 03:04 PM
RE: Script Help - by Knusper. - 03-28-2013, 03:01 PM
RE: Script Help - by PutraenusAlivius - 03-28-2013, 03:07 PM
RE: Script Help - by Knusper. - 03-28-2013, 03:15 PM
RE: Script Help - by PutraenusAlivius - 03-28-2013, 03:21 PM
RE: Script Help - by Knusper. - 03-28-2013, 04:56 PM



Users browsing this thread: 1 Guest(s)