Author Topic: How to make a projectile explode [Solved]  (Read 940 times)

How do you make a projectile explode?
Like say if you wanted to make a grenade explode X seconds after it's first bounce or something like that.
This needs to be seperate from the projectile datablock, as in it's not using explodeondeath or lifetime or anything like that.
« Last Edit: December 22, 2011, 03:51:24 PM by Ipquarx »

Is there a %project.explode() function?

I have absolutely no idea, thats why i'm asking.

Well, projectile::explode() is a default function. I don't know how you would detect when the projectile bounced (maybe something like onImpact or onCollision, I don't have time to research that much right now), but manually detonating the projectile can be done with .explode();


Okay, projectile.explode does not work. the function does not exist.
Unless im getting the projectile from the gun wrong, in which case its very possible im wrong.
Here's currently how im getting the projectile:
Code: [Select]
function (imagenameofweaponhere)::onFire(%this, %obj, %slot)
{
    parent::onFire(%this, %obj, %slot);
    %projectile = %this.projectile;
}
Is this correct? if not, how do i get the projectile?

Check the frag grenade script, should have something in there.

You're getting the projectile datablock, not the projectile object.

You're getting the projectile datablock, not the projectile object.
How do I get that?

The parent of onFire should return the projectile. (I think)

So if your right, this should give me the projectile?
Code: [Select]
%projectile = parent::onFire(%this, %obj, %slot);

So if your right, this should give me the projectile?
Code: [Select]
%projectile = parent::onFire(%this, %obj, %slot);
Yes.

EDIT: got it to work.
« Last Edit: December 22, 2011, 03:50:58 PM by Ipquarx »

EDIT: figured it out.
« Last Edit: December 22, 2011, 03:50:44 PM by Ipquarx »