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

I was wondering how I can make it look like someone's banging on the door, like it sort of shakes a little.

Anyone got any ideas?

I'm also wondering how you can make the monster chase you around corner.
(This post was last modified: 04-12-2013, 04:20 PM by LulleBulle.)
04-12-2013, 04:01 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: How can I make it look like someone bangs on the door?

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

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 04-12-2013, 04:47 PM by Romulator.)
04-12-2013, 04:42 PM
Find
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
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
RE: How can I make it look like someone bangs on the door? + chase around corner

Also, to make the enemy chase around the corner, you would have to add some pathnodes for which the enemy can use so they dont continuously bump into the wall. To make the chase begin straight away, after the timer ends (say, they collide with the AreaStopPound ScriptArea) add this code in (Assuming the enemy is inactive and behind the door):
SetPropHealth("<door>", 0);
SetEntityActive("<Enemy's name>", true);
ShowEnemyPlayerPosition("<Enemy's name>");

Discord: Romulator#0001
[Image: 3f6f01a904.png]
04-12-2013, 04:55 PM
Find
LulleBulle Offline
Member

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

(04-12-2013, 04:55 PM)ROMul8r Wrote: Also, to make the enemy chase around the corner, you would have to add some pathnodes for which the enemy can use so they dont continuously bump into the wall. To make the chase begin straight away, after the timer ends (say, they collide with the AreaStopPound ScriptArea) add this code in (Assuming the enemy is inactive and behind the door):
SetPropHealth("<door>", 0);
SetEntityActive("<Enemy's name>", true);
ShowEnemyPlayerPosition("<Enemy's name>");

Already done that bit, exactly the same way but thanks.
04-15-2013, 11:09 AM
Find




Users browsing this thread: 3 Guest(s)