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

Is it possible to temporarily reduce Sight Range?

Status
Not open for further replies.
Level 19
Joined
Oct 15, 2008
Messages
3,231
Hmm... What about by creating a function to replace that unit with the exact same unit but with a different sight range?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I have attached a test map

Targeted units will get its sight vision reduced by 500, lasts 10 seconds.

If you doesn't know what each function of those custom script, you can ask me, or even the senior here, good luck :)

TRIGGER
  • Target
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Reducing Sight Ability
    • Actions
      • Custom script: local unit Target = GetSpellTargetUnit()
      • Custom script: call UnitAddAbility(Target, 'A002')
      • Custom script: call TriggerSleepAction(10.00)
      • Custom script: call UnitRemoveAbility(Target, 'A002')
      • Custom script: set Target = null
Gonna explain all of those function:
1. local unit Target = GetSpellTargetUnit() is setting local variable of "Target" by setting Target = (Target unit of ability being cast)
2. call UnitAddAbility(Target, 'A002') is giving the spell book ability to the "Target" (A002 is the Spell Book ability ID)
3. call TriggerSleepAction(10.00) is Wait for 10 seconds (this will make the trigger MUI because we use local variable
4. call UnitRemoveAbility(Target, 'A002') is removing the spell book ability from the "Target"
5. set Target = null is cleaning "leak" in JASS (even setting a unit variable, we will need to null/clean it)
 

Attachments

  • Simple Reducing Sight System (Target Unit).w3x
    13.2 KB · Views: 165
Last edited:
Level 26
Joined
Aug 18, 2009
Messages
4,097
...but, since it doesn't stack with itself, you will need: http://www.wc3c.net/showthread.php?t=107940

Different abilities of this type stack up and it also has the same glitch as max life/max mana bonus where you can set the ability's level on a unit without it updating the bonus but subtracting the new level's value when the ability is removed.
 
Status
Not open for further replies.
Top