Jump to content

Recommended Posts

I'm trying to make an item function like a Bee Mine where it explodes when it's walked over, but it does damage like Gunpowder rather than release bees. 

 

I can't figure out how to get it to explode and do damage, but it's letting me plant it like a Bee Mine. 

 

Can anyone help?

stopsign.lua

There is basically nothing in your OnExplode function except producing an exploding sound and spawning a smoke cloud. You should add stuffs in there to handle dealing damages and stuffs like that.

 

I have damage in there, but can you explain, or show me what you mean? I can't get it to do anything. It's not even exploding.

Well as far as I saw, you just set the explosive damage of your explosive component. But if you look inside the OnExplode function you'll see just a SoudEmmiter stuff which is obviously for the sound of the explosion, as well as SpawnPrefab("explode_small") which is for poping a smoke cloud, and that's it.

You need to add stuffs in there to trigger the damage dealing or whatever you want your mine to do.

 

BIG WARNING : I checked that stuff in 1min and a half so I may say incorrect stuffs but from what I saw :

 

You can see in the explosive component that you have a OnBurnt function, which is where the damages are applied to target(s). But from your code this is never called. You have the mine component which uses the TestMine functions to check wether there is a target nearby. If there is a target nearby it triggers the OnExplode function which is just doing what I said above. You need to check for valid target in the proximity of your explosion point and apply the damages consequently. Or check if a function is already doing that. But in any case you need to call something, either your own function or an already existing one.

You can see that the OnExplode function of the beemine.lua is doing much more stuffs than you are.

 

Hope this clarifies stuffs and that I'm not saying too many BS.

Well as far as I saw, you just set the explosive damage of your explosive component. But if you look inside the OnExplode function you'll see just a SoudEmmiter stuff which is obviously for the sound of the explosion, as well as SpawnPrefab("explode_small") which is for poping a smoke cloud, and that's it.

You need to add stuffs in there to trigger the damage dealing or whatever you want your mine to do.

 

BIG WARNING : I checked that stuff in 1min and a half so I may say incorrect stuffs but from what I saw :

 

You can see in the explosive component that you have a OnBurnt function, which is where the damages are applied to target(s). But from your code this is never called. You have the mine component which uses the TestMine functions to check wether there is a target nearby. If there is a target nearby it triggers the OnExplode function which is just doing what I said above. You need to check for valid target in the proximity of your explosion point and apply the damages consequently. Or check if a function is already doing that. But in any case you need to call something, either your own function or an already existing one.

You can see that the OnExplode function of the beemine.lua is doing much more stuffs than you are.

 

Hope this clarifies stuffs and that I'm not saying too many BS.

It took a while, but I got it to work. Thank you!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...