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

Accname

2D-Graphics enthusiast
Reaction score
1,463
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,463
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,463
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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top