• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Destructable Spell

Status
Not open for further replies.
Level 17
Joined
Jun 17, 2010
Messages
2,275
I am making a set of abilities that represent the units stats (like endurance or armor) and they level up by doing certain things, like armor gets exp for taking damage. Now i want to make it where the spell has health and will break and requires a repair. I already have a general idea of how to do this, make an index system for the spells and set a hp real number, and detect damage to remove this hp. But how do i retain the spells former abilities and stats (because it can be upgraded and imbued) once its repaired.
 
Let's say you have the spell as follows:
  • Set Abilities[1] = Storm Bolt
  • Set Abilities[2] = Death Coil
A way to store values in them are:
  • Custom script: call SaveReal (udg_Hash, udg_Abilities[1], StringHash("damage"), 300)
Let's say your Death Coil damages for 300, the line above will save this value. To save the level of it,
  • Custom script: call SaveInteger (udg_Hash, udg_Abilities[2], StringHash("level"), GetUnitAbilityLevel(GetTriggerUnit()))
 
Level 9
Joined
May 27, 2006
Messages
498
The only way to store ALL stats of a spell (those from Object editor) is to save ability handle. But since that function doesn't work (it will crash your WE), you have no possibility of doing so.

The only solution is to trigger every ability you want to have "hp" and weaker effect based on its "durability" left. In this case, you could simply do something like this:
JASS:
SPELL_DAMAGE * durability (like 0.68, 1.00 being max)
SPELL_DURATION * durability
SPELL_AMOUNT_OF_TARGETS * durability
And so on. You could use structs to store various information about a spell, if you had JNGP.
 
Status
Not open for further replies.
Top