Hey guys, I want to make a script where if the player walks towards this door, the door starts being smashed like when the monster smashes down the door, however I don't want any damage to the door. Just for it to be hit about 2 or 3 times.
Does anyone have any ideas?
Like someone is pounding on the door ?
Yeah exactly like that. Just hitting it 2 or 3 times, with dust coming off it as it's being hit.
Here's the script :
void OnStart()
{
AddEntityCollideCallback("Player", "AreaStartPoundingDoor", "StartPoundDoor", true, 1);
}
void StartPoundDoor(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("pound", "hit_wood", "AreaPoundDoorEffect", 0, false);
CreateParticleSystemAtEntity("pound_dust","ps_hit_wood","AreaPoundDoorEffect", false);
AddTimer("PoundLoop", 3, "TimerDoorPound");
}
void TimerDoorPound(string& asTimer)
{
PlaySoundAtEntity("pound", "hit_wood", "AreaPoundDoorEffect", 0, false);
CreateParticleSystemAtEntity("pound_dust","ps_hit_wood","AreaPoundDoorEffect", false);
}
That's brilliant thanks! I'll give the code a try when I'm at my PC next.
Right I've added all that and the script in the level, but still nothing happens
I've put the script in front of the door, but when I move through it, no script activates
(07-07-2012, 05:21 PM)BrooksyFC Wrote: [ -> ]I've put the script in front of the door, but when I move through it, no script activates
I think I forgot to tell you that you need to make a script area(AreaPoundDoorEffect) on the door.
Oh yeah, you should put AddPropImpulse("YourDoorName", -2,0,0,"World"); in the void StartPoundDoor and in the void TimerDoorPound , to make the door move like it's been hit.