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

Nightvision

Status
Not open for further replies.

xplicitjohn

X

xplicitjohn

In Zombie survival games, how do i make night vision effect?
 
Level 8
Joined
Aug 21, 2009
Messages
408
if you want you could change the fog to a light green showing a greenish glow to everything and brightening up stuff, but this would effect everyone (im pretty sure anyways). A flishlight might work..there might be a tutorial on how to make one on thw?
 
Level 4
Joined
Jun 26, 2010
Messages
73
not the hive, and the last place i've used for the tutorial is gone.
Theres two ways to do it, one with a fade filter, (easiest and doesnt really helps during the night) ammd the other with a day and night model. (the real night vision)
anyway, i can give u a walkthrough on the DNC model editing if u needit

import this into your map
View attachment NiteVisionModel.mdx

add the function:
call SetDayNightModels("NiteVisionModel.mdx","NiteVisionModel.mdx")
and now everyperson in the game has night vision. (and it actually helps them see in the dark)
 

xplicitjohn

X

xplicitjohn

not the hive, and the last place i've used for the tutorial is gone.
Theres two ways to do it, one with a fade filter, (easiest and doesnt really helps during the night) ammd the other with a day and night model. (the real night vision)
anyway, i can give u a walkthrough on the DNC model editing if u needit

import this into your map
View attachment 90689

add the function:
call SetDayNightModels("NiteVisionModel.mdx","NiteVisionModel.mdx")
and now everyperson in the game has night vision. (and it actually helps them see in the dark)

I tried, and in game everything goes dark?
 
Level 13
Joined
Jun 1, 2008
Messages
360

xplicitjohn

X

xplicitjohn

Level 13
Joined
Jun 1, 2008
Messages
360
Ok.
1. Import a nightvision model. (like the one of Glided Touch)
2. This trigger specifies how the map will be illuminated. (Put the path of the light source in the quotations)
The light you hand the function will always be in the center of the screen.
call SetDayNightModels("...","...")
3. Now to make it so only one player has nightvision:
set player = .....
Custom script: if GetLocalPlayer() == udg_player then
Custom script: call SetDayNightModels("...","...")
Custom script: endif
This is how you turn it on. If you want to turn it off you have to use
call SetDayNightModels("Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl" , "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl")
where instead of Lordaeron you use your tileset.
 

xplicitjohn

X

xplicitjohn

Ok.
1. Import a nightvision model. (like the one of Glided Touch)
2. This trigger specifies how the map will be illuminated. (Put the path of the light source in the quotations)
The light you hand the function will always be in the center of the screen.

3. Now to make it so only one player has nightvision:

This is how you turn it on. If you want to turn it off you have to use

where instead of Lordaeron you use your tileset.

Still wont work?
 
Level 9
Joined
Oct 7, 2008
Messages
299
Personally, in Restricted Complex 601, nightivision is a simple spell which creates a cinematic filter and change terrain fog (make fog to a low height) for a local player .

On spell turn off, it just removes the cinematic filter and set the fog to a greater height.

If you could make a tutorial map with the triggers needed and upload here, the asking user would be very happy. believe me. :p
 
Level 21
Joined
Mar 19, 2009
Messages
444
A tutorial, no , sorry, I'm a bit busy, but there is the trigger;

for my one, you need the Jass New Gen Pack (its a basic VJass trigger)

JASS:
scope NightVision initializer init // Needs SpellEvent, AbilityPreload, both available on wc3.net

globals
    private constant integer SPELL = 'A02X' //spell to turn nightvision on / off (it's not a spell u really can turn off, I simulate it)
    private constant integer BUFF = 'B02V' //Buff added with the spellbook containing the bonus
    private constant integer SPELLBOOK = 'A08J'
    private constant string FX = "ReplaceableTextures\\CameraMasks\\White_mask.blp"
    private boolean array Nightvision [10] //You are not obliged to do this, I needed it
    private constant integer NV_RED = 50 //settings for the fade fileter
    private constant integer NV_BLUE = 50
    private constant integer NV_GREEN = 100
    private constant real NV_TRANS = 0.
    private constant integer NORMALRED = 100
    private constant integer NORMALBLUE = 100
    private constant integer NORMALGREEN = 100
    private constant real NORMALTRANS = 100.
endglobals
    
    private function Actions takes nothing returns nothing
        local integer i = 0
        local player owner = GetOwningPlayer(SpellEvent.CastingUnit)//SpellEvent.CastingUnit is GetTriggerUnit() through SpellEvent library
        local integer ownerId = GetPlayerId(owner)
            if Nightvision[ownerId] == false then //If the player does not already use the nv
                if GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELLBOOK)<=1 then
                    call UnitAddAbility(SpellEvent.CastingUnit,SPELLBOOK) //if the unit has not the bonus, we add it
                endif
                set Nightvision[ownerId] = true//now the player uses nv
                if owner == GetLocalPlayer() then //local player = thing done only on the computer of this player
                    //There, I add a cinematic filter (blue/green for me) and a terrain fog (to make the terrain more visible)
                    call CinematicFilterGenericBJ(2.,BLEND_MODE_MODULATE,FX,100,100,100,100.,NV_RED,NV_GREEN,NV_BLUE,NV_TRANS)
                    call SetTerrainFogEx(0,2300.,4500.,0.25,0.,0.,0.)
                endif
            else //otherwise, if the player is using the nightvision, the trigger removes bonus, filters etc.
                if GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELLBOOK)>=1 then
                    call UnitRemoveAbility(SpellEvent.CastingUnit,SPELLBOOK)
                endif
                if GetUnitAbilityLevel(SpellEvent.CastingUnit,BUFF)>=1 then
                    call UnitRemoveAbility(SpellEvent.CastingUnit,BUFF)
                endif
                set Nightvision[ownerId] = false
                if owner == GetLocalPlayer() then
                    call CinematicFilterGenericBJ(0,BLEND_MODE_MODULATE,FX,NV_RED,NV_GREEN,NV_BLUE,NV_TRANS,100,100,100,100.)
                    call SetTerrainFogEx(0,1000.,2000.,0.5,0.,0.,0.)
                endif
            endif
            set owner = null
    endfunction
    
    public function init takes nothing returns nothing
        local integer i = 0
            call AbilityPreload(SPELLBOOK) //Because I add a hidden spellbook, I preload it to avoid freeze time the first time it is added
            loop
                exitwhen i > MAXPLAYER
                call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false) //To make the spellbook containing bonus hidden
                set i = i + 1
            endloop
            call RegisterSpellCastResponse(SPELL, Actions) //Through the library SpellEvent, it creates a trigger detecting the cast of this spell
    endfunction

endscope
 
Status
Not open for further replies.
Top