Frictional Games Forum (read-only)

Full Version: Explosions!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey Dear Forum members Idea

Today, I've been tweaking an explosion effect I've been developing. So far, I'm liking the effects, but I wanted to make it autentic by making the player fly backwards and hitting a wall!


But something that bothers me is my function: AddBodyForce("Player", -21.238f, 2.0f, -25.407f, "world");
is supposed to send the player to coordinates -21.238, 2.0 (for height) and -25.407 and I followed the tutorial on http://wiki.frictionalgames.com/hpl2/tut...ript/force . But when I call it, nothing happends? Is there a way to just send the player backwards until a wall hits him? Maybe with a script area that will stop him Smile ?


The second thing is, how the heck do I turn off FadeSepiaColorTo(3,0.2f); once I called it Huh ?


Kind Regards,

//Twitchez
the numbers aren't coordinates is the amount of force you hit the body with
Yeah, I read now and I must have missunderstood it. Is it possible to call the AddBodyForce and then make it stop when I hit a Script area?

Ive also tried increasing AddBodyForce("Player", -500.0f, 2.0f, -500.0f, "world"); but nothing happends.
Well if he is supposed to hit the wall it will stop at the wall if not the force is too strong then it may fly through the wall x)

Try AddBodyImpulse
Still doesn't work :/ Even though I try really high numbers.

For example: AddBodyImpulse("Player", -500.0f, 2.0f, -500.0f, "world"); or AddBodyForce("Player", -500.0f, 2.0f, -500.0f, "world");

My Code:

void function_explode(string &in asChild, string &in asParent, int alState)
{
PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0, false);
SetPropHealth("Stone", 0.0f);
StartScreenShake(0.7f, 1.0f, 0.2f, 0.7f);
StartEffectFlash(0.2, 1.0, 0.2);

//To make him fly...
AddBodyForce("Player", -500.0f, 2.0f, -500.0f, "world");

CreateParticleSystemAtEntity("", "ps_area_fog_falling.ps", "Exp_area", false);
AddTimer("", 0.01, "Exp_Flash");
}
AddPlayerBodyForce
AddBodyForce is for bodies in an entity. For instance, you would use AddBodyForce open an individual desk drawer; since the main body of the desk is static, simply using AddPropForce likely won't yield any sort of desirable result.

You'll need values in the thousands to see movement. Try something like 15,000 instead of 500. Tweak the 2 until you get the appropriate movement. I'd wager a 4000 might give you the upwards jump you're looking for.
Thanks Smile It worked out very fine now! Thanks a lot!

Now, to the second question I wrote, how do I turn off these screen effects?


FadeSepiaColorTo
FadeImageTrailTo
FadeRadialBlurTo

You fade them to their default value, which for these three's case, is 0.0f

FadeSepiaColorTo(0.0f , 1.0f);
FadeImageTrailTo(0.0f , 1.0f);
FadeRadialBlurTo(0.0f , 1.0f);
Aha, thanks again DRedshot, you helped me again today lol.

Weird that using "(0.0f , 0.0f)" didn't work, that you would have to wait a second before the screen effects take off.




Anyway, thanks again everyone Smile




//Twitchez