Gwafu
Active Member
- Reaction score
- 12
...and the remaining 18O not visible.
Is that possible?
Is that possible?
trigger sight range with vision modifers.
/@ Ched : that would delete the purpose of looking behind arcs/gates/doors.
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.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)]
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)]
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).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'
What should be the scripts to do this?
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 +.Also what isnt right about this trigger?
I dont know what the GUI tags are, just used CODE tagsI'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 +.