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
How can I make it look like someone bangs on the door? + chase around corner
LulleBulle Offline
Member

Posts: 101
Threads: 33
Joined: Feb 2012
Reputation: 0
#3
RE: How can I make it look like someone bangs on the door?

(04-12-2013, 04:42 PM)ROMul8r Wrote: Well, if we look at the coding for Justine, there is an event like this in the library. Some of the code is below.
void CollidePoundDoor(string &in asParent, string &in asChild, int alState)
{
AddTimer("DoorPoundLoop", 1, "TimerDoorPoundLoop");
}
//No more door pounding.
void CollideAreaStopPoundDoor(string &in asParent, string &in asChild, int alState)
{
RemoveTimer("DoorPoundLoop");

AddDebugMessage("No More Quarter Pounder. Veggie of course.", false);
}void TimerDoorPoundLoop(string& asTimer)
{
AddLocalVarInt("PoundDoorCount", 1);
if(GetLocalVarInt("PoundDoorCount") == 5) return;

AddPropImpulse("mansion_1", -2,0,0,"World");
PlaySoundAtEntity("pound", "hit_wood", "AreaPoundDoorEffect", 0, false);
PlaySoundAtEntity("enemy", "L02_attack", "AreaPoundDoorEffect", RandFloat(0.0f, 0.5f), false);
CreateParticleSystemAtEntity("pound_dust","ps_hit_wood","AreaPoundDoorEffect", false);

AddTimer("DoorPoundLoop", RandFloat(14, 50), "TimerDoorPoundLoop");

AddDebugMessage("Pound pound", false);
}

Assuming you want this in your CS and the script is there from the start, we can put the callback adding function in the OnStart area and adjust the code as needed;

void OnStart()
{
       AddEntityCollideCallback("Player", "AreaPoundDoor", "CollidePoundDoor", true, 1);
       AddEntityCollideCallback("Player", "AreaStopPound", "CollideAreaStopPoundDoor", true, 1);
}    
      //The Player character must collide with a scriptarea named AreaPoundDoor which is
      //done from the level editor, then later can optionally collide with a script called AreaStopPound
      //which will stop the banging. Then we chuck in the rest of the code.

void CollidePoundDoor(string &in asParent, string &in asChild, int alState)
{
        AddTimer("DoorPoundLoop", 1, "TimerDoorPoundLoop");
}
//No more door pounding.
void CollideAreaStopPoundDoor(string &in asParent, string &in asChild, int alState)
{
        RemoveTimer("DoorPoundLoop");
}void TimerDoorPoundLoop(string& asTimer)
{
        AddLocalVarInt("PoundDoorCount", 1);
        if(GetLocalVarInt("PoundDoorCount") == 5) return;
        AddPropImpulse("mansion_1", -2,0,0,"World");
        CreateParticleSystemAtEntity("pound_dust","ps_hit_wood","AreaPoundDoorEffect", false);
        AddTimer("DoorPoundLoop", RandFloat(14, 50), "TimerDoorPoundLoop");
        AddDebugMessage("Pound pound", false);
}
Some things you may need to do to the above:
AddPropImpulse("mansion_1", -2,0,0,"World");

1. Change mansion_1 to the name of your door if needed.
2. (You May need to) Change the way the door is supposed to move. In this code, the door will move along the x axis at -2. It should not have to move along the y, but may need to be moved along the z coordinate.

CreateParticleSystemAtEntity("pound_dust","ps_hit_wood","AreaPoundDoorEffect", false);
1. Create a ScriptArea named AreaPoundDoorEffect and place it in the middle of the door.
Ask again if you have any questions :-) Good luck

Thanks, I'll give it a try.
04-12-2013, 04:45 PM
Find


Messages In This Thread
RE: How can I make it look like someone bangs on the door? - by LulleBulle - 04-12-2013, 04:45 PM



Users browsing this thread: 1 Guest(s)