Frictional Games Forum (read-only)
Get hitted when à object hit you whith certain speed - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Get hitted when à object hit you whith certain speed (/thread-9263.html)



Get hitted when à object hit you whith certain speed - nkmol - 07-20-2011

I'm wondering if it possibe to gain damage by a object that's hitting you whith a x amount of speed. If so, would be possible to measure one part of the model?

Let me explain, like you got a ball whith a rope. The rope and THE ball are attached to each other. Also, THE ball and THE rope are attached to à ceiling.
Would it be possible to measure the speed of that ball, when it release THE ceiling?

I hope you understanded my question :p
Thanks,
Nkmol Big Grin


RE: Get hitted when à object hit you whith certain speed - palistov - 07-20-2011

Very interesting! I feel spoiler'd but that's ok Smile I like your idea, sir.

Unfortunately there is no function (that I'm aware of) to check for the speed of a prop. You can, however, use some clever scripting.

As soon as you release the ball from the ceiling and it starts flying to the player, start a timer. Tweak it so that the timer ends as soon as the ball slows down to the speed at which you do NOT want it to cause player damage.

Then, use this function called by the collision between the ball and the player.

Code:
void BallCollidePlayer(string &in parent, string &in child, int state)
{
    //ball is parent, player is child

    if(GetTimerTimeLeft("ballspeedtimer") > 0) { //Player Gets Damaged! }
    else //Do whatever happens if the player touches it while it is slow (such as LESS player damage)
}



RE: Get hitted when à object hit you whith certain speed - nkmol - 07-20-2011

yes interesting Smile
thanks for the advice, i'll experimate a lil Angel


RE: Get hitted when à object hit you whith certain speed - palistov - 07-20-2011

No problem! Glad to have helped Smile