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 [SOLVED] Using a Single Crowbar on Multiple Doors
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#6
RE: Using a Single Crowbar on Multiple Doors

Oh! I think I get what you mean!! (Not gonna lie, that makes me feel super awesome since I'm still learning the craft of scripting).

I'll test it out and let you know how it goes.

_____________________________________________________________
EDIT:

I don't think I'm doing this correctly. This is the script that I'm running on a test map (to prevent any unsavory things from happening to the rest of the script file).

There are probably some other errors in here as I had previously used this to run another test and I don't think I quite found all the leftovers of that.

void OnStart()
{  
    AddUseItemCallback("", "Crowbar_1", "asEntity", "UseCrowbarOnDoor", true);
    AddEntityCollideCallback("Joint", "AreaBreak", "BreakDoor", true, 1);
}
    
void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
    if(asEntity == "Door_1")
      {
        PlaySoundAtEntity("", "player_crouch.snt", "Player", 0.05, false);
        AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");
      }
      else if(asEntity == "Door_2")
      {
        PlaySoundAtEntity("", "player_crouch.snt", "Player", 0.05, false);
        AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");
      }
}
    
void TimerPlaceCrowbar(string &in asTimer)
{
        SetEntityActive("Joint", true);
        PlaySoundAtEntity("", "puzzle_place_jar.snt", asTimer, 0, false);
}
    
void BreakDoor(string &in asParent, string &in asChild, int alState)
{
        SetEntityActive("Joint", false);
        SetEntityActive("Broken", true);
  
        SetSwingDoorLocked("Door_x", false, false);
        SetSwingDoorClosed("Door_x", false, false);
        SetSwingDoorDisableAutoClose("Door_x", true);
    
        AddPropImpulse("Door_x", 0, 0, 3, "world");
    
        CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "AreaEffect", false);
        PlaySoundAtEntity("", "break_wood_metal", "AreaEffect", 0, false);
    
        GiveSanityBoostSmall();
    
        PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
    
        AddTimer("", 0.1, "TimerPushDoor");
}
    
void TimerPushDoor(string &in asTimer)
{
        AddPropImpulse("Door_x", -4, 2, 1, "world");
        AddTimer("", 1.1, "TimerDoorCanClose");
}
    
void TimerDoorCanClose(string &in asTimer)
{
        SetSwingDoorDisableAutoClose("Door_x", false);
}

(This post was last modified: 09-21-2014, 10:40 PM by AGP.)
09-21-2014, 10:24 PM
Find


Messages In This Thread
RE: Using a Single Crowbar on Multiple Doors - by AGP - 09-21-2014, 10:24 PM



Users browsing this thread: 1 Guest(s)