Destroying a core to release AC

Started by Asbestos, November 01, 2014, 10:04:01 PM

Previous topic - Next topic

Asbestos

How do I make it so that, when a core is destroyed by a sniper, it releases a flood of AC?

planetfall


:destroyed
CurrentCoords -1000 AddCreeper

:awake
Self CONST_SNIPERTARGET 1 SetUnitAttribute
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.

KingGreenYoshi

As in, it can be destroyed by multiple things but it only releases AC if its destroyed by  a sniper or it can only be destroyed by a sniper and will release AC when destroyed?
HASHTAGS ARE OVERRATED!!!
QuoteThen why do you use them :P

Asbestos

The second one. The code makes the core targeted by snipers, but if you destroy it another way it still releases AC.

Grayzzur

Then Planetfall has your answer. Detecting WHAT a core has been destroyed by is not something supported by the API. A core can't tell what has damaged it, it just has health that can go up or down.

Different weapons do different amounts of damage. It might be possible to rig a core to have more health and play with the numbers, but that's quite a bit of work. An easier approach may be to have multiple linked hidden cores, each one damageable by a different weapon, and syncing their health. Whichever one goes triggers the appropriate effect and removes its siblings.
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

kwinse

Quote from: Grayzzur on December 25, 2014, 12:30:12 PMAn easier approach may be to have multiple linked hidden cores, each one damageable by a different weapon, and syncing their health. Whichever one goes triggers the appropriate effect and removes its siblings.

One problem that comes to mind- it's down to execution order which effect plays if the core stack is killed in multiple ways on the same frame. Something to keep in mind if you do that.