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
Question for the pros.
Tiero Offline
Member

Posts: 126
Threads: 13
Joined: Mar 2011
Reputation: 11
#5
RE: Question for the pros.

I did it! Big GrinDD

If someone be useful, I post this here!

void OnStart()
{
    AddEntityCollideCallback("crowbar_joint_1", "crowbar_broke_zone1", "CrowbarFunc", true, 1);     AddEntityCollideCallback("crowbar_joint_2", "crowbar_broke_zone2", "CrowbarFunc2", true, 1);

      AddUseItemCallback("", "key_1", "mansion_6", "KeyFunc", true);
    AddUseItemCallback("", "key_1", "mansion_7", "Key1Func", true);

    AddUseItemCallback("", "hammer_1", "mansion_6", "HammerFunc", true);
    AddUseItemCallback("", "hammer_1", "mansion_7", "Hammer1Func", true);
}

void CrowbarFunc(string &in asParent, string &in asChild, int alState)
{
    if(GetEntityExists("key_1")==false)
    {
        if(GetEntityExists("hammer_1")==false)
        {
            if(HasItem("key_1")==false)
            {
                if(HasItem("hammer_1")==false)
                {
                    SetEntityActive("crowbar_joint_1", false);
                    SetEntityActive("crowbar_joint_1_broke", true);
                    SetSwingDoorLocked("mansion_6", false, true);
                    AddPropImpulse("mansion_6", 0, 0, -10, "World");
                    CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p1", true);
                    PlaySoundAtEntity("BR", "break_wood_metal", "crowbar_p1_1", 0, false);
                    SetMessage("Things", "S22", 5);
                    RemoveTimer("KillMe");
                }
                else
                {
                    SetEntityActive("crowbar_joint_1", false);
                    SetEntityActive("crowbar_joint_1_broke", true);
                    AddPropImpulse("mansion_6", 0, 0, -10, "World");
                    CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p1", true);
                    PlaySoundAtEntity("BR", "break_wood_metal", "crowbar_p1_1", 0, false);
                    SetMessage("Things", "S21", 5);
                }
            }
            else
            {
                SetEntityActive("crowbar_joint_1", false);
                SetEntityActive("crowbar_joint_1_broke", true);
                AddPropImpulse("mansion_6", 0, 0, -10, "World");
                CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p1", true);
                PlaySoundAtEntity("BR", "break_wood_metal", "crowbar_p1_1", 0, false);
                SetMessage("Things", "S21", 5);
            }
        }
        else
        {
            SetEntityActive("crowbar_joint_1", false);
            SetEntityActive("crowbar_joint_1_broke", true);
            AddPropImpulse("mansion_6", 0, 0, -10, "World");
            CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p1", true);
            PlaySoundAtEntity("BR", "break_wood_metal", "crowbar_p1_1", 0, false);
            SetMessage("Things", "S21", 5);
        }
    }
    else
    {
        SetEntityActive("crowbar_joint_1", false);
        SetEntityActive("crowbar_joint_1_broke", true);
        AddPropImpulse("mansion_6", 0, 0, -10, "World");
        CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p1", true);
        PlaySoundAtEntity("BR", "break_wood_metal", "crowbar_p1_1", 0, false);
        SetMessage("Things", "S21", 5);
    }
}

void CrowbarFunc2(string &in asParent, string &in asChild, int alState)
{
    if(GetEntityExists("key_1")==false)
    {
        if(GetEntityExists("hammer_1")==false)
        {
            if(HasItem("key_1")==false)
            {
                if(HasItem("hammer_1")==false)
                {
                    SetEntityActive("crowbar_joint_2", false);
                    SetEntityActive("crowbar_joint_2_broke", true);
                    SetSwingDoorLocked("mansion_7", false, true);
                    AddPropImpulse("mansion_7", 0, 0, -10, "World");
                    CreateParticleSystemAtEntity("HW2", "ps_hit_wood.ps", "crowbar_p2", true);
                    PlaySoundAtEntity("BR2", "break_wood_metal", "crowbar_p2_2", 0, false);
                    RemoveTimer("KillMe");
                    SetMessage("Things", "S22", 5);
                    
                }
                else
                {
                    SetEntityActive("crowbar_joint_2", false);
                    SetEntityActive("crowbar_joint_2_broke", true);
                    AddPropImpulse("mansion_7", 0, 0, -10, "World");
                    CreateParticleSystemAtEntity("HW2", "ps_hit_wood.ps", "crowbar_p2", true);
                    PlaySoundAtEntity("BR2", "break_wood_metal", "crowbar_p2_2", 0, false);
                    SetMessage("Things", "S21", 5);
                }
            }
            else
            {
                SetEntityActive("crowbar_joint_2", false);
                SetEntityActive("crowbar_joint_2_broke", true);
                AddPropImpulse("mansion_7", 0, 0, -10, "World");
                CreateParticleSystemAtEntity("HW2", "ps_hit_wood.ps", "crowbar_p2", true);
                PlaySoundAtEntity("BR2", "break_wood_metal", "crowbar_p2_2", 0, false);
                SetMessage("Things", "S21", 5);
            }
        }
        else
        {
            SetEntityActive("crowbar_joint_2", false);
            SetEntityActive("crowbar_joint_2_broke", true);
            AddPropImpulse("mansion_7", 0, 0, -10, "World");
            CreateParticleSystemAtEntity("HW2", "ps_hit_wood.ps", "crowbar_p2", true);
            PlaySoundAtEntity("BR2", "break_wood_metal", "crowbar_p2_2", 0, false);
            SetMessage("Things", "S21", 5);
        }
    }
    else
    {
        SetEntityActive("crowbar_joint_2", false);
        SetEntityActive("crowbar_joint_2_broke", true);
        AddPropImpulse("mansion_7", 0, 0, -10, "World");
        CreateParticleSystemAtEntity("HW2", "ps_hit_wood.ps", "crowbar_p2", true);
        PlaySoundAtEntity("BR2", "break_wood_metal", "crowbar_p2_2", 0, false);
        SetMessage("Things", "S21", 5);
    }
}

void KeyFunc(string &in asItem, string &in asEntity)
{
    if(GetEntityExists("crowbar_1")==false)
    {
        if(GetEntityExists("hammer_1")==false)
        {
            if(HasItem("crowbar_1")==false)
            {
                if(HasItem("hammer_1")==false)
                {
                    SetSwingDoorLocked("mansion_6", false, true);
                    PlaySoundAtEntity("BR", "KeyUnlocke.snt", "crowbar_p1_11", 0, false);
                    SetMessage("Things", "S22", 5);
                    RemoveItem("key_1");
                    RemoveTimer("KillMe");
                }
                else
                {
                    CreateParticleSystemAtEntity("KeyP", "ps_dust_drilling.ps", "KeyP1", true);
                    PlaySoundAtEntity("BR", "KeyCrash.snt", "crowbar_p1_11", 0, false);
                    SetMessage("Things", "S23", 5);
                    RemoveItem("key_1");
                }
            }
            else
            {
                CreateParticleSystemAtEntity("KeyP", "ps_dust_drilling.ps", "KeyP1", true);
                PlaySoundAtEntity("BR", "KeyCrash.snt", "crowbar_p1_11", 0, false);
                SetMessage("Things", "S23", 5);
                RemoveItem("key_1");
            }
        }
        else
        {
            CreateParticleSystemAtEntity("KeyP", "ps_dust_drilling.ps", "KeyP1", true);
            PlaySoundAtEntity("BR", "KeyCrash.snt", "crowbar_p1_11", 0, false);
            SetMessage("Things", "S23", 5);
            RemoveItem("key_1");
        }
    }
    else
    {
        CreateParticleSystemAtEntity("KeyP", "ps_dust_drilling.ps", "KeyP1", true);
        PlaySoundAtEntity("BR", "KeyCrash.snt", "crowbar_p1_11", 0, false);
        SetMessage("Things", "S23", 5);
        RemoveItem("key_1");
    }
}

void Key1Func(string &in asItem, string &in asEntity)
{
    if(GetEntityExists("crowbar_1")==false)
    {
        if(GetEntityExists("hammer_1")==false)
        {
            if(HasItem("crowbar_1")==false)
            {
                if(HasItem("hammer_1")==false)
                {
                    SetSwingDoorLocked("mansion_7", false, true);
                    PlaySoundAtEntity("BR", "KeyUnlocke.snt", "crowbar_p1_12", 0, false);
                    SetMessage("Things", "S22", 5);
                    RemoveItem("key_1");
                    RemoveTimer("KillMe");
                }
                else
                {
                    CreateParticleSystemAtEntity("KeyP2", "ps_dust_drilling.ps", "KeyP2", true);
                    PlaySoundAtEntity("BR", "KeyCrash.snt", "crowbar_p1_12", 0, false);
                    SetMessage("Things", "S23", 5);
                    RemoveItem("key_1");
                }
            }
            else
            {
                CreateParticleSystemAtEntity("KeyP2", "ps_dust_drilling.ps", "KeyP2", true);
                PlaySoundAtEntity("BR", "KeyCrash.snt", "crowbar_p1_12", 0, false);
                SetMessage("Things", "S23", 5);
                RemoveItem("key_1");
            }
        }
        else
        {
            CreateParticleSystemAtEntity("KeyP2", "ps_dust_drilling.ps", "KeyP2", true);
            PlaySoundAtEntity("BR", "KeyCrash.snt", "crowbar_p1_12", 0, false);
            SetMessage("Things", "S23", 5);
            RemoveItem("key_1");
        }
    }
    else
    {
        CreateParticleSystemAtEntity("KeyP2", "ps_dust_drilling.ps", "KeyP2", true);
        PlaySoundAtEntity("BR", "KeyCrash.snt", "crowbar_p1_12", 0, false);
        SetMessage("Things", "S23", 5);
        RemoveItem("key_1");
    }
}

void HammerFunc(string &in asItem, string &in asEntity)
{
    if(GetEntityExists("key_1")==false)
    {
        if(GetEntityExists("crowbar_1")==false)
        {
            if(HasItem("key_1")==false)
            {
                if(HasItem("crowbar_1")==false)
                {
                    SetSwingDoorLocked("mansion_6", false, true);
                    AddPropImpulse("mansion_6", 0, 0, -100, "World");
                    SetSwingDoorDisableAutoClose("mansion_6", true);
                    SetSwingDoorClosed("mansion_6", false, false);
                    SetMoveObjectState("mansion_6", 1);
                    CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p1", true);
                    PlaySoundAtEntity("BRHammer1", "break_wood_metal", "crowbar_p1_1", 0, false);
                    SetMessage("Things", "S22", 5);
                    RemoveItem("hammer_1");
                    RemoveTimer("KillMe");
                }
                else
                {
                    CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p1", true);
                    PlaySoundAtEntity("BRHammer1", "break_wood_metal", "crowbar_p1_1", 0, false);
                    SetMessage("Things", "S24", 5);
                    RemoveItem("hammer_1");
                }
            }
            else
            {
                CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p1", true);
                PlaySoundAtEntity("BRHammer1", "break_wood_metal", "crowbar_p1_1", 0, false);
                SetMessage("Things", "S24", 5);
                RemoveItem("hammer_1");
            }
        }
        else
        {
            CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p1", true);
            PlaySoundAtEntity("BRHammer1", "break_wood_metal", "crowbar_p1_1", 0, false);
            SetMessage("Things", "S24", 5);
            RemoveItem("hammer_1");
        }
    }
    else
    {
        CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p1", true);
        PlaySoundAtEntity("BRHammer1", "break_wood_metal", "crowbar_p1_1", 0, false);
        SetMessage("Things", "S24", 5);
        RemoveItem("hammer_1");
    }
}

void Hammer1Func(string &in asItem, string &in asEntity)
{
    if(GetEntityExists("key_1")==false)
    {
        if(GetEntityExists("crowbar_1")==false)
        {
            if(HasItem("key_1")==false)
            {
                if(HasItem("crowbar_1")==false)
                {
                    SetSwingDoorLocked("mansion_7", false, true);
                    AddPropImpulse("mansion_7", 0, 0, 100, "World");
                    SetSwingDoorDisableAutoClose("mansion_7", true);
                    SetSwingDoorClosed("mansion_7", false, false);
                    SetMoveObjectState("mansion_7", 1);
                    CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p2", true);
                    PlaySoundAtEntity("BRHammer1", "break_wood_metal", "crowbar_p2_2", 0, false);
                    SetMessage("Things", "S22", 5);
                    RemoveItem("hammer_1");
                    RemoveTimer("KillMe");
                }
                else
                {
                    CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p2", true);
                    PlaySoundAtEntity("BRHammer1", "break_wood_metal", "crowbar_p2_2", 0, false);
                    SetMessage("Things", "S24", 5);
                    RemoveItem("hammer_1");
                }
            }
            else
            {
                CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p2", true);
                PlaySoundAtEntity("BRHammer1", "break_wood_metal", "crowbar_p2_2", 0, false);
                SetMessage("Things", "S24", 5);
                RemoveItem("hammer_1");
            }
        }
        else
        {
            CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p2", true);
            PlaySoundAtEntity("BRHammer1", "break_wood_metal", "crowbar_p2_2", 0, false);
            SetMessage("Things", "S24", 5);
            RemoveItem("hammer_1");
        }
    }
    else
    {
        CreateParticleSystemAtEntity("HW1", "ps_hit_wood.ps", "crowbar_p2", true);
        PlaySoundAtEntity("BRHammer1", "break_wood_metal", "crowbar_p2_2", 0, false);
        SetMessage("Things", "S24", 5);
        RemoveItem("hammer_1");
    }
}

It was fucking hard! +_+

[Image: 111.jpg]
12-01-2012, 09:44 AM
Website Find


Messages In This Thread
Question for the pros. - by Tiero - 11-29-2012, 03:27 PM
RE: Question for the pros. - by The chaser - 11-29-2012, 04:05 PM
RE: Question for the pros. - by Tiero - 11-29-2012, 05:23 PM
RE: Question for the pros. - by Your Computer - 11-29-2012, 07:50 PM
RE: Question for the pros. - by Tiero - 12-01-2012, 09:44 AM



Users browsing this thread: 1 Guest(s)