- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
I'd like to make some spells that base their damage on other values (e.g. hero's strength, etc.). I looked into the way the old developer of the map did it (his ability was based on the hero's level, i.e. higher level = more damage), but it seems completely counter intuitive and almost ridiculous, but perhaps this is the norm for JASS.
Here is the trigger:
Now from my understanding, each player has some dummy unit which constantly follows them, but is completely undetectable. When a hero uses this ability, it actually forces the dummy to use the correct leveled version of stormbolt / thunderbolt which does the damage (he has about 60 levels of it for all possible cases).
Now this works, but I don't suppose there's a better way to do this? Obviously there is no general
otherwise this would have been used, right? So is there a way to simply apply a buff/ability to the targeted unit, which then does the additional damage? Or am I going to need a non-intuitive dummy caster?
I'd like to make some spells that base their damage on other values (e.g. hero's strength, etc.). I looked into the way the old developer of the map did it (his ability was based on the hero's level, i.e. higher level = more damage), but it seems completely counter intuitive and almost ridiculous, but perhaps this is the norm for JASS.
Here is the trigger:
JASS:
globals
constant integer DMY_ATTACK_MELEE = 'A03A'
constant integer DMY_ATTACK_RANGED = 'A03B'
constant integer DMY_ATTACK_ID = 'A03D'
private unit caster
private player owner
private integer pid
private integer sid
private real x
private real y
endglobals
private function main takes nothing returns boolean
//Var Init
set sid = GetSpellAbilityId()
if sid == DMY_ATTACK_MELEE or sid == DMY_ATTACK_RANGED then
//Var Setting
set caster = GetTriggerUnit()
set owner = GetOwningPlayer(caster)
set pid = GetPlayerId(owner)
set x = GetUnitX(caster)
set y = GetUnitY(caster)
//Main Action
call SetUnitPosition(pDMY[pid], x, y)
if sid == DMY_ATTACK_MELEE then
call SetUnitAbilityLevel(pDMY[pid], DMY_ATTACK_ID, GetUnitLevel(caster))
else
call SetUnitAbilityLevel(pDMY[pid], DMY_ATTACK_ID, GetUnitLevel(caster) + 30)
endif
call IssueTargetOrder(pDMY[pid], "thunderbolt", GetSpellTargetUnit())
//Clear
set caster = null
set owner = null
endif
//Return
return false
endfunction
Now from my understanding, each player has some dummy unit which constantly follows them, but is completely undetectable. When a hero uses this ability, it actually forces the dummy to use the correct leveled version of stormbolt / thunderbolt which does the damage (he has about 60 levels of it for all possible cases).
Now this works, but I don't suppose there's a better way to do this? Obviously there is no general
JASS:
native damageUnit