Trying to make something ascend and drop from orbit, then do it again

Started by Asbestos, March 16, 2014, 12:17:59 PM

Previous topic - Next topic

Asbestos

30 Delay
AscendToOrbit
do
   RandCoords DropFromOrbit
   300 Delay
   AscendToOrbit
   200 Delay
loop

I'm not sure why it's not working. The core goes up, but then it doesn't come back down. What did I do wrong?

J

If I remember correctly ascending to orbit is the same as destroying it

kwinse

Quote from: J on March 16, 2014, 01:19:54 PM
If I remember correctly ascending to orbit is the same as destroying it

Quoth the wiki...
QuoteOnce the unit is ascended it counts as destroyed, as in it is no longer on the map, but it can be recovered by pushing DropFromOrbit.

Does your code work if you remove the do loop and put the initial delay and ascend in a once endonce block?

J

So dropping should work? Still found a problem with the script:
The 'do' command takes arguments, try something like '9000 0 do ... loop' or use a while loop.
It also might be the case that you can't drop it if it's still rising up into the air. You probably have to add another '91 Delay' after the first AscendToOrbit command.
Code (not tested) Select
30 Delay
AscendToOrbit
91 Delay
9000 0 do
  RandCoords DropFromOrbit
  300 Delay
  AscendToOrbit
  200 Delay
loop

knucracker

I'm not so sure about the "drop from orbit will recover" part.  From my recollection ascend to orbit destroys the unit at the end of the cycle.  "Orbit" is purely an imaginary place and I don't recall keeping units around in any state or data structures when they ascend.  A quick look at the code shows that at the end of the ascension sequence, "Destroy" is called on the unit...

Clean0nion

So for a descent, create a new core at a random location, push the required variables to it, have it descend, then you ascend.


Clean0nion

Quote from: Asbestos on March 16, 2014, 03:42:22 PM
I don't know how to do that.

Quote from: Clean0nion on March 16, 2014, 03:22:04 PM
So for a descent, create a new core at a random location, push the required variables to it, have it descend, then you ascend.
So, you want to make a core ascend. THIS CORE is Core1.
Core1 does whatever it needs to do. It then creates a new core, Core2, at a random location, and makes it invisible (sets its main image to NONE).
Core1 takes its variables (eg emit amount, rotation speed, whatever variables it has) and pushes them to Core2.
Then Core1 begins to ascend.

All that happens in a single frame.

In the next frame, Core2's script comes into action. It waits for Core1 to ascend (90 frames or 3 seconds) then it sets itself an image, then descends.
Core1 is destroyed from the ascent - but from the player's perspective, it has ascended then descended.

Core2 becomes Core1 and the process repeats.

Lost in Nowhere

Don't die! :)