Jump to content

Destroyable static object?


Code_Man
 Share

Recommended Posts

I tried creating a staticshape instance however for some reason it is indestructable despite having health and isinvincible attribute set properly.

For the object i used same values as cheetah but i simply cannot destroy it.

I skimmed over t3d code, documentations and forum already for answers.


Would much appreciate any hints.

Link to comment
Share on other sites

Well the issue is probably pretty simple.

The ShapeCharge for example can be destroyed by shooting at it, then it will explode and be removed, this is done through the line

"%obj.schedule(50, "delete");"

in "function ShapeChargeDeployed::onDestroyed"


So you have to see that you add a delete function on destroyed or spawn a destroyed shape. I think the platform disappears if you pick it up again, maybe for the case of destruction it was just forgotten to remove it from the world as well.

Link to comment
Share on other sites

I hadnt thought the shape charge could be destroyed, i think i tried at one point but maybe i screwed up.


Also i found the actual error, the onDestroyed override i used had a check for renderWhenDestroyed set to true resulting in the OnDestroyed function not being called, same for your platform, assuming its not intentional.


All in all it should have been obvious for me, but lesson learned and mission accomplished, thanks for the help.

Link to comment
Share on other sites

The reason i tried to make this is to introduce destructable objects and even objetive based gameplay to ubergame.

Is there some reason uebergame doesnt have destructable objects builtin?

I think it would add some good spice to the game.


This is offtopic but since im on top of this section anyhow and the issue is closed better than making a new.

Link to comment
Share on other sites

As said I have destructible objects, but I had no use for them yet, so I disabled them. Sure you can let players build objects, but this would require a lot more code to avoid ugly scenarios like objects floating around in the air or blocking things, since static objects are not rigid objects and rigid objects have their own issues, mostly performance.

Link to comment
Share on other sites

Most objects are not suitable for that, because they are either vegetation or important structures or objects that are too complex. You can try adding destructible objects and see how it works, but I do not see much potential yet.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...