Make a unit only see 180 degrees in front...

Accname

2D-Graphics enthusiast
Reaction score
1,464
trigger sight range with vision modifers.

you cannot make vision modifiers be half circle shaped.

@gwafu:
does this need to apply for many units in the map? if not i would suggest periodically creating a destructible which blocks the sight behind the unit.
make the destructible have no model but an occulusion hight (or however that was called) and create it right behind the unit, remove, create, remove, create, and so on and so on.

if you want this for many units it might get a little laggy depending on the rest of the game.
 

Laiev

Hey Listen!!
Reaction score
188
so, you want it only for 12 heroes?

If so, i think it will not lag :p
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
course not, you can go with the destructables. creating them isnt taking that much performance, alot less then creating a new unit.

but you have to work around a little bit with the distance towards the unit itself to get the best effects.

another possible glitch might be that other units sight range could be blocked by those destructibles as well, i am not quite sure if you could "kill" them for a local player without risking a desync but maybe it will work.
 

Cheddar

This is the way it was meant to be.
Reaction score
126
Make its sight range inherently 0, then periodically move invisible dummies in front of him.

Diagram time!

X - - - -


X = hero
- = invisible dummy with some sort of sight radius
 

DioD

New Member
Reaction score
57
you can make half circle of many sqr modifers.

actually result will be just like real vision, but very very laggy.
 

Gwafu

Active Member
Reaction score
12
/@ Acc : I'll try using GetLocal... but with unit instead.

/@ Ched : that would delete the purpose of looking behind arcs/gates/doors.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
It's for an shooting-arena map.
One unit per player? Then it's fairly easy. In JASS, the vision modifiers can be set to apply after a unit's vision, so you can use a very large circular fog-of-war modifier centered behind the unit (use polar coordinates) to cut out the vision behind it. With a very large circle, it will be a nearly straight line. You can periodically reposition it as the unit moves.

[edit] This seems to be hindered by the inability of a vision modifier to be centered outside the map bounds. You can avoid this with a wide map border. It also looks best with the black mask disabled.

Trigger:
  • Half Vision Periodic
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units in (Playable map area) owned by (Player((Integer A)))) and do (Actions)
            • Loop - Actions
              • Custom script: local real X = GetUnitX ( GetEnumUnit() ) - 3256 * Cos ( GetUnitFacing ( GetEnumUnit() ) * bj_DEGTORAD )
              • Custom script: local real Y = GetUnitY ( GetEnumUnit() ) - 3256 * Sin ( GetUnitFacing ( GetEnumUnit() ) * bj_DEGTORAD )
              • Visibility - Destroy VisionArray[(Integer A)]
              • Custom script: set udg_VisionArray [ bj_forLoopAIndex ] = CreateFogModifierRadius ( Player ( bj_forLoopAIndex - 1 ) , FOG_OF_WAR_FOGGED , X , Y , 3000 , true , true )
              • Visibility - Enable VisionArray[(Integer A)]
 

Attachments

  • Half Vision.w3x
    37.3 KB · Views: 201

Weep

Godspeed to the sound of the pounding
Reaction score
400
Bump, because I don't know if the OP saw my suggestion and I think it turned out rather well. :D
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
nice weep.....here have a cookie and post it in the turtorials & resources sub-forum.
 

MP®

Member
Reaction score
11
One unit per player? Then it's fairly easy. In JASS, the vision modifiers can be set to apply after a unit's vision, so you can use a very large circular fog-of-war modifier centered behind the unit (use polar coordinates) to cut out the vision behind it. With a very large circle, it will be a nearly straight line. You can periodically reposition it as the unit moves.

[edit] This seems to be hindered by the inability of a vision modifier to be centered outside the map bounds. You can avoid this with a wide map border. It also looks best with the black mask disabled.

Trigger:
  • Half Vision Periodic
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units in (Playable map area) owned by (Player((Integer A)))) and do (Actions)
            • Loop - Actions
              • Custom script: local real X = GetUnitX ( GetEnumUnit() ) - 3256 * Cos ( GetUnitFacing ( GetEnumUnit() ) * bj_DEGTORAD )
              • Custom script: local real Y = GetUnitY ( GetEnumUnit() ) - 3256 * Sin ( GetUnitFacing ( GetEnumUnit() ) * bj_DEGTORAD )
              • Visibility - Destroy VisionArray[(Integer A)]
              • Custom script: set udg_VisionArray [ bj_forLoopAIndex ] = CreateFogModifierRadius ( Player ( bj_forLoopAIndex - 1 ) , FOG_OF_WAR_FOGGED , X , Y , 3000 , true , true )
              • Visibility - Enable VisionArray[(Integer A)]

Nice Weep! +rep for you

There is one thing I want to change, I will explain it with a drawing :)

lineofsightwc3.png


Like you see, I want 2 extra vision modifiers to make it look a bit better, because now you can see that the line isnt straight, which allows the unit to look 'around the corner' :p

What should be the scripts to do this?
 

MP®

Member
Reaction score
11
Also what isnt right about this trigger?

Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        LookingBehind[(Player number of (Player((Integer A))))] Greater than 0
    Then - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                LookingBehind[(Player number of (Player((Integer A))))] Equal to 1
            Then - Actions
                Custom script:   set bj_wantDestroyGroup = true
                Unit Group - Pick every unit in (Units in (Playable map area) owned by (Player((Integer A)))) and do (Actions)
                    Loop - Actions
                        Set LookingBehind[(Player number of (Player((Integer A))))] = 0
                        Animation - Reset (Picked unit)'s body-part facing
                        Custom script:   local real X = GetUnitX ( GetEnumUnit() ) - 3180 * Cos ( GetUnitFacing ( GetEnumUnit() ) * bj_DEGTORAD )
                        Custom script:   local real Y = GetUnitY ( GetEnumUnit() ) - 3180 * Sin ( GetUnitFacing ( GetEnumUnit() ) * bj_DEGTORAD )
                        Visibility - Destroy VisionArray[(Integer A)]
                        Custom script:   set udg_VisionArray [ bj_forLoopAIndex ] = CreateFogModifierRadius ( Player ( bj_forLoopAIndex - 1 ) , FOG_OF_WAR_FOGGED , X , Y , 3000 , true , true )
                        Visibility - Enable VisionArray[(Integer A)]
            Else - Actions
                Custom script:   set bj_wantDestroyGroup = true
                Unit Group - Pick every unit in (Units in (Playable map area) owned by (Player((Integer A)))) and do (Actions)
                    Loop - Actions
                        Set LookingBehind[(Player number of (Player((Integer A))))] = (LookingBehind[(Player number of (Player((Integer A))))] - 1)
                        Custom script:   local real X = GetUnitX ( GetEnumUnit() ) 3180 * Cos ( GetUnitFacing ( GetEnumUnit() ) * bj_DEGTORAD )
                        Custom script:   local real Y = GetUnitY ( GetEnumUnit() ) 3180 * Sin ( GetUnitFacing ( GetEnumUnit() ) * bj_DEGTORAD )
                        Visibility - Destroy VisionArray[(Integer A)]
                        Custom script:   set udg_VisionArray [ bj_forLoopAIndex ] = CreateFogModifierRadius ( Player ( bj_forLoopAIndex - 1 ) , FOG_OF_WAR_FOGGED , X , Y , 3000 , true , true )
                        Visibility - Enable VisionArray[(Integer A)]
    Else - Actions
        Custom script:   set bj_wantDestroyGroup = true
        Unit Group - Pick every unit in (Units in (Playable map area) owned by (Player((Integer A)))) and do (Actions)
            Loop - Actions
                Custom script:   local real X = GetUnitX ( GetEnumUnit() ) - 3180 * Cos ( GetUnitFacing ( GetEnumUnit() ) * bj_DEGTORAD )
                Custom script:   local real Y = GetUnitY ( GetEnumUnit() ) - 3180 * Sin ( GetUnitFacing ( GetEnumUnit() ) * bj_DEGTORAD )
                Visibility - Destroy VisionArray[(Integer A)]
                Custom script:   set udg_VisionArray [ bj_forLoopAIndex ] = CreateFogModifierRadius ( Player ( bj_forLoopAIndex - 1 ) , FOG_OF_WAR_FOGGED , X , Y , 3000 , true , true )
                Visibility - Enable VisionArray[(Integer A)]
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Like you see, I want 2 extra vision modifiers to make it look a bit better, because now you can see that the line isnt straight, which allows the unit to look 'around the corner' :p

What should be the scripts to do this?
I'm not keen to do the triggers right now (plus the forum seems to not have its GUI tags working at the moment), but essentially you'd either make two more arrays of visibility or use 3x the player's index (so you can associate 3*index+0, 3*index+1, and 3*index+2 with each player), and repeat the actions with either a sideways offset, or more simply, a rotational offset from the unit's facing (eg. unit's facing-30, unit's facing+0, and unit's facing+30).

Also what isnt right about this trigger?
It's hard to say because you haven't told us what problem you're experiencing. Looking at what you posted, though, it shouldn't even compile because you merely deleted the - sign from the 3180 in the custom scripts in the middle section of that trigger, instead of changing them to a +.
 

MP®

Member
Reaction score
11
I'm not keen to do the triggers right now (plus the forum seems to not have its GUI tags working at the moment), but essentially you'd either make two more arrays of visibility or use 3x the player's index (so you can associate 3*index+0, 3*index+1, and 3*index+2 with each player), and repeat the actions with either a sideways offset, or more simply, a rotational offset from the unit's facing (eg. unit's facing-30, unit's facing+0, and unit's facing+30).


It's hard to say because you haven't told us what problem you're experiencing. Looking at what you posted, though, it shouldn't even compile because you merely deleted the - sign from the 3180 in the custom scripts in the middle section of that trigger, instead of changing them to a +.
I dont know what the GUI tags are, just used CODE tags
But i only want to know how to determine the point of the other vision modifiers, I dont have JASS skills.. How should the custom script line be?

And about that wrong trigger, I already figured it out :) indeed also the + but also some other dumb things :p but that works perfect now.

thnx for so far!:thup:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top