Author Topic: Tree removal  (Read 7355 times)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Tree removal
« on: May 30, 2011, 08:49:38 PM »
What's the best way to remove a tree?

tree.Active = false and tree:Die() don't seem to work for me.

Maybe asteroid.Active = false, then create a new asteroid without a tree, and renumber its ID to that of the just-deleted asteroid?

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Tree removal
« Reply #1 on: May 30, 2011, 09:36:31 PM »
I don't think there is any proper way to remove stuff by scripting it, but you can, if it is all about the RoidForge, "delete" the asteroid by setting radius to 0, add a new exact copy of it and make it in the output file, replace where the first one should have been. This is actually very simple to do :)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Tree removal
« Reply #2 on: May 30, 2011, 10:14:58 PM »
That means that the old asteroid that was deleted, lets say it's Asteroid(5), would still exist with a radius of 0... and instead you would have a new asteroid with a new ID.  If GetAsteroid(5) is "deleted" in this way in a level with asteroids 0-20, the replacement asteroid will have ID 21.

If you have any kind of advanced scripting going on at all, this can cause problems..  So then you have to start swapping around ID numbers to keep things tidy, and you have to make sure you store the 0 radius asteroid out the way so it doesn't interfere with the sending arrows of the user interface...  it's just not a very elegant method.  There must be a better way.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Tree removal
« Reply #3 on: May 30, 2011, 10:20:30 PM »
No, don't directly affect the IDs, but when the output file will be made you'll have another array, asteroid ids, which is counting upwards untill it reaches the last asteroid. Now when you remove a tree or something just create a new, change the id of the last one to the new one(not directly still!) and the output file will still print out the same ID, just with different amount of trees, hope you got all that :)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Tree removal
« Reply #4 on: May 30, 2011, 10:43:36 PM »
You seem to be talking specifically about RoidForge.  I see how your solution gets around the problem for that application, but what about more generally?


Has anyone ever managed to remove a tree from an asteroid without first removing the asteroid?

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Tree removal
« Reply #5 on: May 30, 2011, 11:11:29 PM »
I haven't. I've actually never tried either though...

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Tree removal
« Reply #6 on: May 31, 2011, 12:22:28 AM »
What about an asteroid?  Is it possible to completely remove an asteroid from play, so it doesn't exist at all?  Not including setting radius to 0.  :>  (because the asteroid still has a valid ID)

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Tree removal
« Reply #7 on: May 31, 2011, 12:51:01 AM »
Experimenting like... like... well, lets just say I try to help :)

Edit: I don't seem to find anything that gives a clue about removing something completely... I tried tree.Remove,but it turned out to give alot of info about intern stuff it seems?

So as far as I see, there is no real  easy and elegant way to remove trees properly. Sorry...
« Last Edit: May 31, 2011, 01:06:03 AM by Aino »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Tree removal
« Reply #8 on: May 31, 2011, 05:29:49 AM »
Ok, in that case which non-easy/non-elegant solution is best? :>

Ideally it would be simple to implement, and doesn't leave mess like misnumbered asteroid ID's.  And it has to remove the tree, of course.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Tree removal
« Reply #9 on: May 31, 2011, 05:35:19 AM »
Good luck with the findings. You can intentionally change the IDs of the asteroids by doing roid.ID = x. Just tellin', but it is very risky and might crash the game.

Good Luck