• 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.

[JASS] Help with GetLocalPlayer() for masking effect

Status
Not open for further replies.
Level 5
Joined
Oct 12, 2004
Messages
109
Hey guys,
I've seen lots of posts about the GetLocalPlayer() function. And I really want to use it for my map except im not quite the expert on JASS. Basically im making an underwater part of the map. And want to make a fog effect for one person. After doing lots of researching i found that it isnt possible to create an effect like this using GUI. (Which is what im good with) I know JASS is so much better which is why im going to be learning it over the summer. But this is bugging me so i thought i would ask you JASS experts for help. :)

Basically what I want to do is set an underwater effect on someone when they enter a region. I know how to set the variable to the player but then i need the code to assign the mask to that player or playergroup. Prefferably i would like it so it just assigns it to the player group so that i can enter/exit the players out of the group whenver i want.

The effect are this.
  • Environment - Set fog to style Linear, z-start 10.00, z-end 5000.00, density 0.02 and color (5.00%, 70.00%, 100.00%)
It looks like it could be done in like 1 minute using JASS. So if any1 could help me make some JASS script basically making it so every player in a player group (You can call it UnderwaterPlayers) gets the effect. That would be so great! You will get credit in the map and it would be greatly apprectiated.

Thanks
-bbfreak
 
This may work, but it may cause a desync:
JASS:
function test takes nothing returns nothing
    if GetLocalPlayer() == Player(0) then
        call SetTerrainFogEx( 0, 10.,5000.,0.02,5.,70.,100.)
    endif
endfunction

It might work better if you do this instead though:
JASS:
function test takes nothing returns nothing
// Player 1 //
    call SetTerrainFogEx(0,10.,5000.,0.02,5.,70.,100.)
    call FogEnable(false)
    if GetLocalPlayer() == Player(0) then
        call FogEnable(true)
        return
    endif
// Player 2 //
    call SetTerrainFogEx(0,10.,4000.,0.04,10.,75.,35.)
    call FogEnable(false)
    if GetLocalPlayer() == Player(1) then
        call FogEnable(true)
        return
    endif
//etc.//
endfunction


I hope this helps! :thumbs_up:
 
JASS:
function SetFogForForce takes force f returns nothing
    local integer i=0
    local player p
    call SetTerrainFogEx(0, 10.00, 6000.00, 0.05, 7.00, 80.00, 100.00)
    call FogEnable(false)
    loop
        exitwhen i=12 // No need to take neutral players.
        set p=Player(i)
        if IsPlayerInForce(p, f)
            call FogEnable(GetLocalPlayer() == p )
        endif
        set i=i+1
    endloop
endfunction
I believe this would work.
 
@Poot:

Straight-up Answer:
emjlr3 said:
players do not need to be nulled

More explained answer but still not that much explained:
Anyway you only need to null variables that either are or will be destroyed at some point. This includes almost every type, but heroes (unless you remove them manually) and players are, for example, exceptions, they don't need to be nulled.
However, if it makes you feel safer, there is nothing wrong in nulling these as well.

So simply, I think that you don't need to null them, but it is ok to null them.

Got it? :smile:

EDIT: *LINK*:
Local variables and Leaks
 
Status
Not open for further replies.
Top