• 🏆 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!

Pause Unit + Make Unit Invulnerable

Status
Not open for further replies.
Level 7
Joined
May 11, 2010
Messages
278
Help me out here, Hive.
The game Messages return the correct info, but the "else" part of the second trigger intantly executes, leaving the message and turning it off.

  • Sanctuary
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sanctuary (Kroya)
    • Actions
      • Hashtable - Save 4.00 as (Key sanctuaryduration) of (Key (Target unit of ability being cast)) in AbilityTable
      • Game - Display to (All players) the text: Sanctuary Cast
      • Set unit = (Target unit of ability being cast)
      • Unit - Pause unit
      • Unit - Make unit Invulnerable
      • Game - Display to (All players) the text: ((Proper name of unit) + is targeted.)
      • Unit Group - Add (Target unit of ability being cast) to KroyaSanctuaryGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Sanctuary Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Sanctuary Loop <gen>
        • Else - Actions
  • Sanctuary Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in KroyaSanctuaryGroup and do (Actions)
        • Loop - Actions
          • Set AbilityDuration = (Load (Key sanctuaryduration) of (Key (Picked unit)) from AbilityTable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AbilityDuration Greater than 0.00
            • Then - Actions
              • Hashtable - Save (AbilityDuration - 0.02) as (Key sanctuaryduration) of (Key (Picked unit)) in AbilityTable
            • Else - Actions
              • Game - Display to (All players) the text: (Sanctuary for + ((Proper name of (Picked unit)) + has ended.))
              • Unit - Make (Picked unit) Vulnerable
              • Unit - Unpause (Picked unit)
              • Unit Group - Remove (Picked unit) from KroyaSanctuaryGroup
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in KroyaSanctuaryGroup) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Level 7
Joined
May 11, 2010
Messages
278
.....i'm an idiot. No, i just checked my initialization trigger, and i have not created the hashtable >.>

The idea of the spell is to make a unit completely invulnerable at the cost of it not beeing able to act. Have i gone about this in a bad way?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Instead of pause unit, you could cast Silence on the unit. Make the silence disable spells an attacks.

  • Custom script: call SetUnitPropWindow(udg_unitVariable, 0)
  • Custom script: call SetUnitTurnSpeed(udg_unitVariable, 0)
With the first one, the unit won't be able to move, only to turn. With the second, the unit can turn very very slowly.

You can store unit's turn speed, get it with GetUnitTurnSpeed(unit) or GetUnitDefaultTurnSpeed(unit). For the prop window there's GetUnitPropWindow and GetUnitDefaultPropWindow
 
Level 7
Joined
May 11, 2010
Messages
278
Thanks, Maker. I've encountered another problem though.

  • Quite a Catch
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Quite a Catch (Nachopup)
    • Actions
      • Hashtable - Save 6.00 as (Key catchduration) of (Key (Target unit of ability being cast)) in AbilityTable
      • Unit - Add Spell Book (Nachopup (Quite a Catch)) to (Target unit of ability being cast)
      • Unit - Set level of Armor Penalty (Nachopup (Quite a Catch)) for (Target unit of ability being cast) to (Level of Quite a Catch (Nachopup) for (Triggering unit))
      • Unit Group - Add (Target unit of ability being cast) to NachoCatchGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Quite a Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Quite a Loop <gen>
        • Else - Actions
  • Quite a Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in NachoCatchGroup and do (Actions)
        • Loop - Actions
          • Set AbilityDuration = (Load (Key catchduration) of (Key (Picked unit)) from AbilityTable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AbilityDuration Greater than 0.00
            • Then - Actions
              • Hashtable - Save (AbilityDuration - 0.02) as (Key catchduration) of (Key (Picked unit)) in AbilityTable
            • Else - Actions
              • Unit - Remove Spell Book (Nachopup (Quite a Catch)) from (Picked unit)
              • Unit Group - Remove (Picked unit) from NachoCatchGroup
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in NachoCatchGroup) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
It's supposed to add an spellbook containing an aura to target of ability, and then set the level of the aura to the level of cast spell. However, it applies the level 1 aura, and when it has faded, it applies the correct level aura for the duration, as if you cast it again. I added a game message, it retrieves the correct level of the aura at first. but then, magic happens.

EDIT: Did some extra testing, the wrong level aura is only applied to the target, nearby units get the right aura effect. However, the fact that it is recast once after fading still boggles my mind.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
@Maker
What can you do if the unit has magic-immune ?
Silence is broken.

For Physical Attack, you can add this to disable its attack;
  • Custom script: call UnitAddAbility(udg_Caster, 'Abun')
Well, to enable it back, simply remove the ability;
  • Custom script: call UnitRemoveAbility(udg_Caster, 'Abun')
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
@Maker
What can you do if the unit has magic-immune?

Setting required level to 6 makes it affect spell immune units.

Silence can als odo the same as setting prop window to 0, by setting movement speed modifier to -1.

How is Silence broken?

@Shoto:
  • Custom script : call UnitRemoveAbility(GetSpellTargetUnit(), 'B000')
Replace B000 with the buff raw code, hit ctrl+D in boject editor to see raw codes.
 
Status
Not open for further replies.
Top