• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Fog editing

Status
Not open for further replies.
Level 13
Joined
Sep 29, 2008
Messages
672
I was wondering if the sight of a unit can be modified by maybe JASS or any method?

angle.jpg


fogs.jpg

by creating dummy units that fogs up the main unit's sight behind and moving those units periodically. if this is the only way, can anyone help me what settings should set to let those dummy fog units so that they can block the sight of the unit.

but if there is a better way than this please do tell me.

+rep to those who help.
 
I tried it to do with line of sight blokers but unfortunately destructables can't be moved only killed and created new
this results in massive lags
and I don't know what makes the line of sight blocker actually block sight but I know which options DO NOT make it:
-shadow
-model file
-fat line of sight
-fog radius
-and now I became tired and I think it is caused by nothing but some hardcoded stuff but it works with custom destructables too

edit: you could make some very complicated trigger which moves regions behind every unit and fogs the region if it can't be seen by any other unit but it will lag too (not as laggy as this but still a lot)

edit2: I remember some anti maphack system which was quite powerful and could make shadows around a unit
maybe it will help you

however
map:
 

Attachments

  • Sight.w3x
    16.8 KB · Views: 59
Level 4
Joined
Mar 23, 2008
Messages
87
You could do something like this:
JASS:
function Trig_SightModefier_Actions takes nothing returns nothing
    local fogmodifier array SMArr
    local real uX
    local real uY
    local integer i = 0
    set uX = GetLocationX(GetUnitLoc(gg_unit_hrif_0000))
    set uY = GetLocationY(GetUnitLoc(gg_unit_hrif_0000))
    set SMArr[i] = CreateFogModifierRect(Player(0), FOG_OF_WAR_MASKED, Rect(uX-512.00, uY-512.00, uX+512.00, uY-32.00), true, true)
    call FogModifierStart(SMArr[i])
    call TriggerSleepAction(0.30)
    call FogModifierStop(SMArr[i])
endfunction

//===========================================================================
function InitTrig_SightModefier takes nothing returns nothing
    set gg_trg_SightModefier = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_SightModefier, 0.20 )
    call TriggerAddAction( gg_trg_SightModefier, function Trig_SightModefier_Actions )
endfunction
This just makes a block of fog under the unit, but you could do some calculations to figure out how to put an array of blocks in a circular fashion with a pie cut out.
 

Attachments

  • SightTest.w3x
    12.9 KB · Views: 347
units don't block fog after I moved them
not with Move Unit Instantly and not with SetUnitX/Y
Ideas?

of cause I gave them the stuff I just said but it seems like the Occluder Height is stuck at the position where it was created
so you have to create a new unit every time what causes leaks
-> the idea mentioned above is better

edit: units are crap.....the vision block is not instant, they leak and so on....

however here is the map
might be nice if you are adding something like "if unit moves then...." but like I said the JASS version above is better (but complicated)
 

Attachments

  • Sight.w3x
    17.5 KB · Views: 44
Last edited:
Make your unit have a sight range of 0. Then have an invisible, unselectable dummy unit with your desired sight range "follow" your unit around using a timer. When you need to change sight ranges, just change the dummy unit to another dummy unit with a different sight range.

as far as I got it (and as far as it is seen on this nice picture on the top) he wanted a triangle shaped view in front of a unit

ofc this idea with a little modification is great

edit: just tried it with far sight and it refuses to work properly without any reason oO
 

Attachments

  • view.JPG
    view.JPG
    11.7 KB · Views: 75
Last edited:
Level 4
Joined
Mar 23, 2008
Messages
87
It took some time, but now I've got a working solution for you.

NB! Unit (Rifleman) only have 128.00 sight range
JASS:
function Trig_SightModefier_Actions takes nothing returns nothing
    local fogmodifier array Pie
    local real uX
    local real uY
    local real pX = 0.00
    local real pY = 0.00
    local real dist = 0.00
    local real radi = 1024.00
    local real rot = 0.00
    local real view = 60.00
    local integer i = 0
    set uX = GetLocationX(GetUnitLoc(gg_unit_hrif_0000))
    set uY = GetLocationY(GetUnitLoc(gg_unit_hrif_0000))
    
    loop
        set rot = GetUnitFacing(gg_unit_hrif_0000)-(view/2)
        set rot = rot+(360.00*dist/((22.00/7.00)*2.00*radi))
        
        set pX = uX+CosBJ(rot)*radi
        set pY = uY+SinBJ(rot)*radi
        set Pie[i] = CreateFogModifierRadius(Player(0), FOG_OF_WAR_VISIBLE, pX, pY, 128.00, true, true)
        call FogModifierStart(Pie[i])
        set i=i+1
        set dist=dist+128.00
        if rot > GetUnitFacing(gg_unit_hrif_0000)+(view/2) then
            set dist = 0
            set radi = radi - 128.00
        endif
        exitwhen radi<256.00
    endloop
    call TriggerSleepAction(0.30)
    loop
        set i=i-1
        call FogModifierStop(Pie[i])
        exitwhen i <=0
    endloop
endfunction

//===========================================================================
function InitTrig_SightModefier takes nothing returns nothing
    set gg_trg_SightModefier = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_SightModefier, 0.20 )
    //call TriggerRegisterTimerEventSingle( gg_trg_SightModefier, 5.00 )
    call TriggerAddAction( gg_trg_SightModefier, function Trig_SightModefier_Actions )
endfunction
 

Attachments

  • SightTest.w3x
    13.2 KB · Views: 41
It took some time, but now I've got a working solution for you.

NB! Unit (Rifleman) only have 128.00 sight range
JASS:
function Trig_SightModefier_Actions takes nothing returns nothing
    local fogmodifier array Pie
    local real uX
    local real uY
    local real pX = 0.00
    local real pY = 0.00
    local real dist = 0.00
    local real radi = 1024.00
    local real rot = 0.00
    local real view = 60.00
    local integer i = 0
    set uX = GetLocationX(GetUnitLoc(gg_unit_hrif_0000))
    set uY = GetLocationY(GetUnitLoc(gg_unit_hrif_0000))
    
    loop
        set rot = GetUnitFacing(gg_unit_hrif_0000)-(view/2)
        set rot = rot+(360.00*dist/((22.00/7.00)*2.00*radi))
        
        set pX = uX+CosBJ(rot)*radi
        set pY = uY+SinBJ(rot)*radi
        set Pie[i] = CreateFogModifierRadius(Player(0), FOG_OF_WAR_VISIBLE, pX, pY, 128.00, true, true)
        call FogModifierStart(Pie[i])
        set i=i+1
        set dist=dist+128.00
        if rot > GetUnitFacing(gg_unit_hrif_0000)+(view/2) then
            set dist = 0
            set radi = radi - 128.00
        endif
        exitwhen radi<256.00
    endloop
    call TriggerSleepAction(0.30)
    loop
        set i=i-1
        call FogModifierStop(Pie[i])
        exitwhen i <=0
    endloop
endfunction

//===========================================================================
function InitTrig_SightModefier takes nothing returns nothing
    set gg_trg_SightModefier = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_SightModefier, 0.20 )
    //call TriggerRegisterTimerEventSingle( gg_trg_SightModefier, 5.00 )
    call TriggerAddAction( gg_trg_SightModefier, function Trig_SightModefier_Actions )
endfunction

this is very nice but does it work with more then one unit? and why are u using a map unit instead of making a function with whichUnit?

edit:
here something with units
lags horrible
would be better with recyling
far sight would be even better
if far sight would work....
but it does not
and I am tired (1 o'clock in the morning at mine)
I'll continue later (not tomorrw :p )
 
Last edited:
Level 4
Joined
Mar 23, 2008
Messages
87
this is very nice but does it work with more then one unit? and why are u using a map unit instead of making a function with whichUnit?
I have only tested it with one unit, but i think it would lag horrible with multiple units. The fog circles could be increased in size and redused in number to compensate for this though. Now there is 40 or so fog circles updated 3 times a second, you could do it with 3-5 and get a decent result.
I'm using a map unit because I'm lazy and it's just an example ;)
 
Status
Not open for further replies.
Top