I originally wrote this spell using handlevars and now i want it in ABC. I don't care about whose system is better or if theres a better one than ABC. I just want this spell in ABC. I want consistency in my map. I want all of the spells to use the same attachment system or whatever.
The spells targets heroes, ally or enemy. The spell creates a permanent lightning effect between caster and target. The only way to break the spell is by the caster dying, the target dying, or putting a certain amount of distance between the caster and target, or by the caster using the spell again but on a different target.
If it is cast on an enemy hero: When ever the caster takes damage a percentage of that damage is transfered to the target. When ever the target takes damage, it recieves a percentage of bonus damage.
If it is cast on an ally hero: When ever the target takes damage a percentage of that damage is transfered to the caster. When ever the target takes damage, it takes reduced damage.
I can't post any code because I've already started trying to convert it over, I don't have the original code any more. The new code is unfinished and doesn't work right.
The problem I'm having is, I used to attach things to the caster using handlevars. Whenever the spell is cast I get the target unit attached to the caster and remove the dummy ability from the target (just a slow aura ability that does nothing other than provides a buff). I get the timer attached to the caster that loops to update the lightning effect positions and destroy that timer. I get the local triggers that are attached to the caster and used to amplify/reduce damage and transfer damage and destroy those triggers. I get the lightning effect attached to the caster and destroy that. Then i create new timer, triggers, and lightning effect for the new cast.
I can't do this in ABC because you can't attach to units. I modified ABC to allow you to attach things to units and i do it like this:
but now i'm getting errors like:
by the way, before anyone claims that ABC cannot be used to attach structs to units, i've already tested it in a different way. I created 2 triggers with 2 regions, when a unit enters 1 region i create a struct that contains a string and a location. the location is the unit's location and the string is the unit's name. then i had a second trigger for when a unit enteres a different region it gets the struct attached to the unit, clears out that attachment, spits out a BJDebugMsg with the string inside the struct and it moves the unit to the location inside the struct. it worked perfectly. so the problem isnt attaching to units, it is detecting wether or not there is something already attached to that unit.
can anyone come up with a better way to make this spell?
The spells targets heroes, ally or enemy. The spell creates a permanent lightning effect between caster and target. The only way to break the spell is by the caster dying, the target dying, or putting a certain amount of distance between the caster and target, or by the caster using the spell again but on a different target.
If it is cast on an enemy hero: When ever the caster takes damage a percentage of that damage is transfered to the target. When ever the target takes damage, it recieves a percentage of bonus damage.
If it is cast on an ally hero: When ever the target takes damage a percentage of that damage is transfered to the caster. When ever the target takes damage, it takes reduced damage.
I can't post any code because I've already started trying to convert it over, I don't have the original code any more. The new code is unfinished and doesn't work right.
The problem I'm having is, I used to attach things to the caster using handlevars. Whenever the spell is cast I get the target unit attached to the caster and remove the dummy ability from the target (just a slow aura ability that does nothing other than provides a buff). I get the timer attached to the caster that loops to update the lightning effect positions and destroy that timer. I get the local triggers that are attached to the caster and used to amplify/reduce damage and transfer damage and destroy those triggers. I get the lightning effect attached to the caster and destroy that. Then i create new timer, triggers, and lightning effect for the new cast.
I can't do this in ABC because you can't attach to units. I modified ABC to allow you to attach things to units and i do it like this:
JASS:
local unit uCaster = GetSpellAbilityUnit()
local unit uTarget = GetSpellTargetUnit()
local spelldata sd = GetUnitStructA(uCaster)
//thinking if there is no struct then sd will be null...
//so if there is a struct it won't be null
if sd != null then
//get rid of the struct so a new one can be attached
call ClearUnitStructA(uCaster)
endif
set sd = spelldata.create(uCaster,uTarget)
call SetUnitStructA(uCaster)
but now i'm getting errors like:
when there is no struct attached to the unit and i get:Error: Hash[A]: get request on unknown handle
Error: Hash[A] attchment overwrite on unit #1046847
when there is a struct attached to the unit. It doesnt like the GetUnitStructA() if there is no struct attached and it doesnt like ClearUnitStructA() even if there IS a struct attached.Error: Hash[A]: clear request on unknown handle
Error: Hash[A] attchment overwrite on unit #1046847
by the way, before anyone claims that ABC cannot be used to attach structs to units, i've already tested it in a different way. I created 2 triggers with 2 regions, when a unit enters 1 region i create a struct that contains a string and a location. the location is the unit's location and the string is the unit's name. then i had a second trigger for when a unit enteres a different region it gets the struct attached to the unit, clears out that attachment, spits out a BJDebugMsg with the string inside the struct and it moves the unit to the location inside the struct. it worked perfectly. so the problem isnt attaching to units, it is detecting wether or not there is something already attached to that unit.
can anyone come up with a better way to make this spell?