Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: Asbestos on November 01, 2014, 10:04:01 PM

Title: Destroying a core to release AC
Post by: Asbestos on November 01, 2014, 10:04:01 PM
How do I make it so that, when a core is destroyed by a sniper, it releases a flood of AC?
Title: Re: Destroying a core to release AC
Post by: planetfall on November 01, 2014, 10:09:17 PM

:destroyed
CurrentCoords -1000 AddCreeper

:awake
Self CONST_SNIPERTARGET 1 SetUnitAttribute
Title: Re: Destroying a core to release AC
Post by: KingGreenYoshi on December 25, 2014, 02:13:51 AM
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?
Title: Re: Destroying a core to release AC
Post by: Asbestos on December 25, 2014, 12:01:42 PM
The second one. The code makes the core targeted by snipers, but if you destroy it another way it still releases AC.
Title: Re: Destroying a core to release AC
Post by: Grayzzur on December 25, 2014, 12:30:12 PM
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.
Title: Re: Destroying a core to release AC
Post by: kwinse on December 25, 2014, 02:50:12 PM
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.