• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Help me with my spell Devotion (just the damage part)

Status
Not open for further replies.
Level 7
Joined
Apr 18, 2010
Messages
102
Ok, so i have been making a devotion spell, heres the description:
The Paladin creates a holy link on an allied unit that lasts for up to 10 seconds. The link can break once a certain distance between the target and Arthas is met, or when one of them dies. While linked, every damage that the target recieves will be transfered to Arthas. |n|n|cffffcc00Level 1|r - Max Distance of the Link is 1000 units. |n|cffffcc00Level 2|r - Max Distance of the Link is 2000 units. |n|cffffcc00Level 3|r - Max Distance of the Link is 3000 units. |n|n|cFF6667C0Cooldown|r: 130/120/90 seconds

I have already made the first 2 triggers, the MUI cast and its Loop, the only problem that i am facing is the part where when the target recieves damage and heals that damage (solved) then the damage is transfered to Arthas (not solved)

Here are the triggers:
Also i need the last part to be fully MUI

  • Devotion Mui
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Devotion
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DevotionIndex Equal to 0
        • Then - Actions
          • Trigger - Turn on Devotion Loop <gen>
        • Else - Actions
      • Set DevotionIndex = (DevotionIndex + 1)
      • Set DevotionMui = (DevotionMui + 1)
      • Set DevotionTurnOn[DevotionMui] = True
      • Set DevotionCaster[DevotionMui] = (Casting unit)
      • Set DevotionTarget[DevotionMui] = (Target unit of ability being cast)
      • Set DevotionMaxDistance[DevotionMui] = (1000.00 x (Real((Level of Devotion for DevotionCaster[DevotionMui]))))
      • Set DevotionDistance[DevotionMui] = 0.00
      • Set DevotionCount[DevotionMui] = 250
      • Unit Group - Add DevotionTarget[DevotionMui] to DevotionTargetGroup
      • Set DevotionCasterLoc = (Position of DevotionCaster[DevotionMui])
      • Set DevotionTargetLoc = (Position of DevotionTarget[DevotionMui])
      • Lightning - Create a Healing Wave - Primary lightning effect from source DevotionCasterLoc to target DevotionTargetLoc
      • Set DevotionLightning[DevotionMui] = (Last created lightning effect)
      • Custom script: call RemoveLocation(udg_DevotionCasterLoc)
      • Custom script: call RemoveLocation(udg_DevotionTargetLoc)
  • Devotion Loop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DevotionLoop) from 1 to DevotionMui, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DevotionTurnOn[DevotionLoop] Equal to True
            • Then - Actions
              • Set DevotionCasterLoc = (Position of DevotionCaster[DevotionLoop])
              • Set DevotionTargetLoc = (Position of DevotionTarget[DevotionLoop])
              • Lightning - Move DevotionLightning[DevotionLoop] to source DevotionCasterLoc and target DevotionTargetLoc
              • Set DevotionCount[DevotionLoop] = (DevotionCount[DevotionLoop] - 1)
              • Set DevotionDistance[DevotionLoop] = (Distance between DevotionCasterLoc and DevotionTargetLoc)
              • Custom script: call RemoveLocation(udg_DevotionCasterLoc)
              • Custom script: call RemoveLocation(udg_DevotionTargetLoc)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • DevotionDistance[DevotionLoop] Greater than or equal to DevotionMaxDistance[DevotionLoop]
                      • (DevotionTarget[DevotionLoop] is dead) Equal to True
                      • (DevotionCaster[DevotionLoop] is dead) Equal to True
                      • DevotionCount[DevotionLoop] Equal to 0
                • Then - Actions
                  • Set DevotionTurnOn[DevotionLoop] = False
                  • Unit Group - Remove DevotionTarget[DevotionLoop] from DevotionTargetGroup
                  • Lightning - Destroy DevotionLightning[DevotionLoop]
                  • Set DevotionCaster[DevotionLoop] = No unit
                  • Set DevotionTarget[DevotionLoop] = No unit
                  • Set DevotionMaxDistance[DevotionLoop] = 0.00
                  • Set DevotionDistance[DevotionLoop] = 0.00
                  • Set DevotionCount[DevotionLoop] = 0
                  • Set DevotionIndex = (DevotionIndex - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DevotionIndex Equal to 0
                    • Then - Actions
                      • Set DevotionMui = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
On the damage trigger i am using GDD's damage system
  • Devotion Damage
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamagedUnit is in DevotionTargetGroup) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) + GDD_Damage)
      • Special Effect - Create a special effect attached to the origin of GDD_DamagedUnit using Abilities\Spells\Undead\ReplenishHealth\ReplenishHealthCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Trigger - Turn on (This trigger)

To cut it short, the part the i dont know how to do is to select the caster in the DEVOTION DAMAGE TRIGGER so that i can damage him by the amount of damage the target took, thus kinda transfering it.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
- create a hashtable HASH and initialize it...
- in your DevotionMui trigger, save the caster by...
  • Custom script: call SaveUnitHandle(udg_HASH,GetHandleId(GetSpellTargetUnit()), 0, GettriggerUnit())
- then in your DevotionDamage, it'll look like this...
  • Custom script: local unit u = udg_GDD_DamagedUnit
  • Custom script: local unit hero
  • Trigger - Turn off (This trigger)
  • Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) + GDD_Damage)
  • Custom script: if HaveSavedHandle(udg_HASH,GetHandleId(u),0) then
  • Custom script: set hero = LoadUnitHandle(udg_HASH,GetHandleId(u),0)
  • Custom script: SetWidgetLife(hero,GetWidgetLife(hero)-udg_GDD_Damage)
  • Custom script: endif
  • Special Effect - Create a special effect attached to the origin of GDD_DamagedUnit using Abilities\Spells\Undead\ReplenishHealth\ReplenishHealthCaster.mdl
  • Special Effect - Destroy (Last created special effect)
  • Trigger - Turn on (This trigger)
  • Custom script: set u = null
  • Custom script: set hero = null
suggestion: instead of SetLife, you should use Damage target
 
Level 7
Joined
Apr 18, 2010
Messages
102
- create a hashtable HASH and initialize it...
- in your DevotionMui trigger, save the caster by...
  • Custom script: call SaveUnitHandle(udg_HASH,GetHandleId(GetSpellTargetUnit()), 0, GettriggerUnit())
- then in your DevotionDamage, it'll look like this...
  • Custom script: local unit u = udg_GDD_DamagedUnit
  • Custom script: local unit hero
  • Trigger - Turn off (This trigger)
  • Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) + GDD_Damage)
  • Custom script: if HaveSavedHandle(udg_HASH,GetHandleId(u),0) then
  • Custom script: set hero = LoadUnitHandle(udg_HASH,GetHandleId(u),0)
  • Custom script: SetWidgetLife(hero,GetWidgetLife(hero)-udg_GDD_Damage)
  • Custom script: endif
  • Special Effect - Create a special effect attached to the origin of GDD_DamagedUnit using Abilities\Spells\Undead\ReplenishHealth\ReplenishHealthCaster.mdl
  • Special Effect - Destroy (Last created special effect)
  • Trigger - Turn on (This trigger)
  • Custom script: set u = null
  • Custom script: set hero = null
suggestion: instead of SetLife, you should use Damage target

Oh yeah how to use Damage Target in custom script? or is is like the normal way?

Custom script: call SaveUnitHandle(udg_HASH,GetHandleId(GetSpellTargetUnit()), 0, GettriggerUnit()) its expecting a name =(

^NVM the call SaveUnit.... I fixxed it, turns out the trigger in Gettriggerunit should by capitalized.
 
Status
Not open for further replies.
Top