[PRPL] CreateUnit Emergent

Started by planetfall, December 21, 2016, 10:34:27 PM

Previous topic - Next topic

planetfall


"Emergent" CurrentCoords CreateUnit ->u


This creates a small white emergent. Trying to set its IsEnemy status doesn't initialize its movement like it does for a stunner. It loses health each frame and eventually explodes.

Of note, the emergent has a triangle trail graphic attached to it, while the normal emergent has a square trail. This may be of some use diagnosing the issue.
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.

knucracker

Yeah, looks like creating an emergent requires some more setup.  I've made it so that CreateUnit won't create an emergent anymore (it will return -1 and log a warning).  I've added a CreateEmergent(X, Y, Enemy) api instead.  It will do all of the necessary internal setup.  X and Y are pixel coordinates and Enemy is true or false.

The created emergent obeys the map emergent settings, but does not obey the limits.  So you can exceed the max count with the api.