Items grant ability

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi!

I'm trying to make Magic Items that disable the attack of the unit, and replace it with a skill.

I'm using
JASS:
    private function onEquip takes nothing returns nothing
        local integer id = GetTriggeringItemId()
        if id == 'I01I' then
            call UnitRemoveAbilityBJ( 'Aatk', GetEquippingUnit() )
            call UnitAddAbilityBJ( 'A03L', GetEquippingUnit() )
        endif
    endfunction
    
    private function onUnequip takes nothing returns nothing
        local integer id = GetTriggeringItemId()
        if id == 'I01I' then
            call UnitRemoveAbilityBJ( 'A03L', GetEquippingUnit() )
            call UnitAddAbilityBJ( 'Aatk', GetEquippingUnit() )
        endif
    endfunction
In other words: When the unit equips (uses) the item:
Ability 'Aatk' (Attack) is removed, and Ability 'A03L' is added.

When the unit unequips the item, Ability 'Aatk' (Attack) is added, and Ability 'A03L' is removed.

The thing is that the Attack is being removed, but not added afterwards =/

Also, I've been searching for a dummy simple skill like 'Firebolt' to attack units, but without the stun factor, and haven't found one. I just want a spell that shoots a missile and deals damage =/
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Great! Thanks a lot for that one.

What about the skill? Any simple missile model that deals damage and able to modify the misile model and speed?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
But I don't want to change stance melee->ranged. I want, as said, to remove the attack and replace it with a skill (i'll add later the dmg with triggers). A cast-able skill to target a unit, but not stun it. Something like Mortred dagger.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I managed to use Shadow Strike as base ability with no effects.. Now I need to detect when the unit is hit by the missile to deal the damage with triggers based on stats (str + agi + int)... and create the special effects.

I'm using GDD Damage Detection System... I don't know how to use it in this case =/ Since the spell deals no damage, I need to detect when the missile has reached the target (Maybe I could add 1dmg to make it easier) but I don't know how to call the units... Unit is under the effect of ability X? Unit has Buff, deal actions, and remove buff? I Would have to add a buff to every skill =/
 
Level 8
Joined
Dec 9, 2009
Messages
397
  • Game - GDD_Event becomes Equal to 0.00
for event
condition
DmgOff = 0
Check if they have ability

set DmgOff = 1 (so the damage you deal wont set off this trigger again)
cause damage
set DmgOff = 0
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Sorry... I'm not getting it (I feel so dumb...) I understand the DmgOff thing... but I need to detect when the missile reaches target...
 
Level 8
Joined
Dec 9, 2009
Messages
397
Thats what the GDD does, when a unit takes damage it goes off, setting the variables of
GDD_DamageSource
GDD_DamagedUnit

So, check if GDD_DamagedSource has ability
then
  • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing (Real((Strength of GDD_DamageSource (Include bonuses)))) damage of attack type Chaos and damage type Normal
Just make sure you set dmgoff = 1 before damage, and put it back to 0 after.

so Event is:
  • Game - GDD_Event becomes Equal to 0.00
Look at the example of use in the test map you got with that system.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213

  • Energy Staff Dmg
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (Level of Shadow Strike for GDD_DamageSource) Greater than 0
      • int Equal to 0
    • Actions
      • Set int = 1
      • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing ((Real((Strength of GDD_DamageSource (Include bonuses)))) + ((Real((Agility of GDD_DamageSource (Include bonuses)))) + ((Real((Intelligence of GDD_DamageSource (Include bonuses)))) x 2.00))) damage of attack type Spells and damage type Normal
      • Set int = 0

This?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213

  • Energy Staff Dmg
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (Level of Energy Staff for GDD_DamageSource) Greater than 0
      • int Equal to 0
    • Actions
      • Set int = 1
      • Set Temp_Point = (Position of GDD_DamagedUnit)
      • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Human\SpellSteal\SpellStealTarget.mdl
      • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing ((Real((Strength of GDD_DamageSource (Include bonuses)))) + ((Real((Agility of GDD_DamageSource (Include bonuses)))) + ((Real((Intelligence of GDD_DamageSource (Include bonuses)))) x 2.00))) damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation(udg_Temp_Point)
      • Set int = 0

It deals damage, but repeatedly (mmm)

Duration is 0.01, and should deal 5 + 5 + 5(x2) = 20 dmg, but deals around 60...

GDD_DamageDetection said:
A common problem when using any damage detection system occurs when you try to cause the damage source to damage the damaged unit from a damage event - for example, if triggering bonus damage. This causes the unit to repeatedly damage the target, because dealing damage in the trigger causes that trigger to run again, and again in turn, infinitely. One solution is to add the action Turn off (This trigger) before dealing damage and add the action Turn on (This trigger) afterward.

Still deals around 60 dmg when should be ~20
 
Level 8
Joined
Dec 9, 2009
Messages
397
Setting that variable doesn't let that trigger go off on the damage caused, for your damage ammount it's doing the math, then the x2
so your getting the total added, not sure in what order it does it's math i'm having trouble with that myself.

also don't forget to
  • Special Effect - Destroy (Last created special effect)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
The math works between pair of values.

1 + 2 * (3+4)
Same than
1 + 2 * 7

Edit: Lol, how could I forget that xD (Destroying the Effect)

Changed damage type from Spell to Hero, keeps dealing 60 dmg...
 
Level 8
Joined
Dec 9, 2009
Messages
397
Thats what I'm sayin, it's in your math.

If it was really the trigger that was going off itself it would have been and endless loop and your game would have crashed.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
... Just like it did some times xD... Somehow this works. If I remove the Turn Off - Dmg - Turn on, the game crashes. Now it Deals the exact damage. The reason it was dealing damage repeatedly before was because it was... repeatedly dealing the damage :p the trigger was going over and over some times before actually stopping (that's why I added the buff condition). Now it deals the exact damage amount.


  • Energy Staff Dmg
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (Level of Energy Staff for GDD_DamageSource) Greater than 0
      • (GDD_DamagedUnit has buff Energy Staff ) Equal to True
    • Actions
      • Set Temp_Point = (Position of GDD_DamagedUnit)
      • Special Effect - Create a special effect at Temp_Point using Abilities\Weapons\SpiritOfVengeanceMissile\SpiritOfVengeanceMissile.mdl
      • Special Effect - Destroy (Last created special effect)
      • Trigger - Turn off (This trigger)
      • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing ((Real((Strength of GDD_DamageSource (Include bonuses)))) + ((Real((Agility of GDD_DamageSource (Include bonuses)))) + ((Real((Intelligence of GDD_DamageSource (Include bonuses)))) x 2.00))) damage of attack type Hero and damage type Normal
      • Trigger - Turn on (This trigger)
      • Unit - Remove Energy Staff buff from GDD_DamagedUnit
      • Custom script: call RemoveLocation(udg_Temp_Point)


EDIT: Another issue. After casting the attack I need to move the unit in order to make it attack again. I cant cast repeatedly without moving.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Wow... a lot of stuff xD I like the way you customize everything with variables :p

Back to my skill: The Skill Icon remains like 'Active' or 'Being cast' for a while, that's why the hero can cast again right after the first cast, but I don't know why. Cast duration has been in 0, 0.5, and 1, and it's always the same. Takes a while to be able to cast again. Maybe the ability is hardcoded for that..
 
Level 8
Joined
Dec 9, 2009
Messages
397
But I didn't turn trigger off/on and it doesn't do do the damage over and over, so i dunno why yours would be.

so the attack is being turned into an auto cast skill with a buff?

You could add a reset ability cooldown into your trigger.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
The attack is not being turned into autocast :p It looks like 'Channeling'. The icon borders become light green just when the unit is casting the ability. Reset ability cooldown would reset all abilities cooldown, and not just this one.

I'm thinking: Maybe I could create a dummy ability based on Channel, store the caster into a unit variable (u = Caster) and create a dummy unit that casts the spell with the missile on the target. .. Or find a better 'Missile' ability to base the skill on.
 
Status
Not open for further replies.
Top