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

How do I reduce sight range of a unit when it enters a region?

Status
Not open for further replies.
Level 4
Joined
Nov 16, 2019
Messages
55
I am currently trying to make it so that when a unit enters a cave, that unit's sight range is reduced. When this unit then exits the cave, the sight range goes up again.

I've tried looking for some specific actions that can do this, but can only seem to find visibility modifiers in terms on turning fog on or off, which is not what I am looking for.


Is it even possible to reduce the sight radius?
 
Level 4
Joined
Nov 16, 2019
Messages
55
I think the goblin telescope ability can change a unit's sight range.
I don't think "Reveal" or "Far Sight" can do so in the way I am asking. Reveal only grants vision of a selected area by the player. What I seek is to passively reduce vision of any unit that walks into the "cave-zone". This cannot be done with Reveal.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,199
I suppose it would work?
Would need to be tested. A lot of such actions do exist but do not work.

I don't think "Reveal" or "Far Sight" can do so in the way I am asking. Reveal only grants vision of a selected area by the player. What I seek is to passively reduce vision of any unit that walks into the "cave-zone". This cannot be done with Reveal.
They were likely referring to the Goblin Night Scope item not the Goblin Laboratory neutral building. This provides ultravision which is likely not what you are after.

You can try Item Sight Range Bonus ability as Lordul Dracula suggested. This item ability appears to have been intended for the Goblin Night Scope. Not sure if negative numbers will work with it though.
 
Level 4
Joined
Nov 16, 2019
Messages
55
Would need to be tested. A lot of such actions do exist but do not work.


They were likely referring to the Goblin Night Scope item not the Goblin Laboratory neutral building. This provides ultravision which is likely not what you are after.

You can try Item Sight Range Bonus ability as Lordul Dracula suggested. This item ability appears to have been intended for the Goblin Night Scope. Not sure if negative numbers will work with it though.
Ah okay, makes sense. Yea I thought it was the spell from the neutral building he was referring to.

Will try out both the item and the action to see if either works.
 
Level 4
Joined
Nov 16, 2019
Messages
55
In the current editor there is a function "Unit - Set unit real field" and you can do something like this:

  • Unit - Set Unit: (Triggering unit)'s Real Field: Sight Radius ('usir') to Value: 300.00
I suppose it would work?
I tried your method, and it works.
Only problem is though, for some reason when a hero enters the zone, their stats/attribute skyrocket, despite only changing Sight Radius.

1660581826743.png


This is the trigger I did for the cave.
When a hero enters, their attributes go from fx. 22 Str to 2285 Str. What did I miss?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
I tried your method, and it works.
Only problem is though, for some reason when a hero enters the zone, their stats/attribute skyrocket, despite only changing Sight Radius.

View attachment 405215

This is the trigger I did for the cave.
When a hero enters, their attributes go from fx. 22 Str to 2285 Str. What did I miss?
That doesn't happen for me. Are you sure you don't have another trigger interfering?

I'm on the latest patch.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,199
When a hero enters, their attributes go from fx. 22 Str to 2285 Str. What did I miss?
Probably out of bounds memory writes or memory writes with wrong offset. Such as sight range being an 8 bit value but it writing 32 bits to it. Hero and non-hero memory layout is different so maybe it is applying it as if the hero was a non-hero and so corrupting other fields.

Report as a bug. Maybe it could be fixed in a patch a few months from now. If you cannot find a hacky work around you will have to write off this solution.

A hacky work around might be re-setting the heroe's attributes that are incorrectly modified after running that action. For example you read them, store them in a temporary variable, apply the sight range modification action and then correct the broken values using those stored in the temporary variable. If you go this work around I recommend documenting it so future maintainers, even if yourself, understand why you did that.
 
Status
Not open for further replies.
Top