[vJass] Trigger Does Nothing ?

Carl-Fredrik

New Member
Reaction score
51
Hey.. I wanted to start map with vJass again (I was starting to learn it) since I've started a new map now, and I want the map to be all visible. So I made this simple trigger.

JASS:
scope vJass initializer Init

private function Actions takes nothing returns nothing
    call SetMapFlag( MAP_FOG_ALWAYS_VISIBLE, true )
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerAddAction( trig, function Actions )
endfunction
endscope


Well... after some tries, it finally works, the game starts... but well... the map is still dark >.>

Why?

// Carl-Fredrik
 

Carl-Fredrik

New Member
Reaction score
51
I've checked "Run on Map Initilization", so it should be map initilization, or? Forgot to tell, sorry ^^
 

Trollvottel

never aging title
Reaction score
262
run on map initialization wont work here since there is no "standart-jass-trigger" to run
 

Expelliarmus

Where to change the sig?
Reaction score
48

Carl-Fredrik

New Member
Reaction score
51
JASS:
scope vJass initializer Init

private function Actions takes nothing returns nothing
    call FogEnable(false)
    call FogMaskEnable(false)
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( trig, 0.01 )
    call TriggerAddAction( trig, function Actions )
endfunction
endscope


This works perfectly, thanks everyone for helping! ;)

Edit: Btw, do the scope names matter?
 

Expelliarmus

Where to change the sig?
Reaction score
48
You can remove the trigger with Uberplayer's code. A trigger is not required for Initialization.
 
Reaction score
456
> Edit: Btw, do the scope names matter?
Does a person's name matter? Yes it does matter.
 

Carl-Fredrik

New Member
Reaction score
51
Exactly what's Jass Tagged in Post #7

... I added those actions and it works, I don't see the point in removing them..?

The Trigger:

JASS:
scope Visibility initializer Init

private function Actions takes nothing returns nothing
    call FogEnable(false)
    call FogMaskEnable(false)
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( trig, 0.01 )
    call TriggerAddAction( trig, function Actions )
endfunction
endscope
 

Expelliarmus

Where to change the sig?
Reaction score
48
JASS:
scope vJass initializer Init

    private function Init takes nothing returns nothing // initializer
        //local trigger trig = CreateTrigger(  )
        //call TriggerAddAction( trig, function Actions )
        call FogEnable(false)
        call FogMaskEnable(false)
        //the actions are in the Initializer
    endfunction

endscope
 

Carl-Fredrik

New Member
Reaction score
51
JASS:
scope vJass initializer Init

    private function Init takes nothing returns nothing // initializer
        //local trigger trig = CreateTrigger(  )
        //call TriggerAddAction( trig, function Actions )
        call FogEnable(false)
        call FogMaskEnable(false)
        //the actions are in the Initializer
    endfunction

endscope

So I put this...

JASS:
scope vJass initializer Init

    private function Init takes nothing returns nothing
        local trigger trig = CreateTrigger()
        call TriggerAddAction( trig, function Actions )
        call FogEnable(false)
        call FogMaskEnable(false)
    endfunction

endscope


...in the Map Script?

Sry if I don't get it.. I'm new at this :p
 

Expelliarmus

Where to change the sig?
Reaction score
48
It is the trigger in function Init you don't need. You've called Fog and FogMask when the map initializes, the trigger is not needed anymore.
 

Romek

Super Moderator
Reaction score
963
Basically, when the map starts, you're creating a new trigger, adding an event to it, and then the trigger runs when the event is triggered by doing:
JASS:
function Init takes nothing returns nothing
   local trigger trig = CreateTrigger()
   call ...etc.
endfunction


Instead of creating the trigger and adding actions, events, etc.
You can just carry out the actions in the function which creates the trigger.

A Jass trigger is a variable type. The GUI trigger is the thing on the side.
Problem is.. the things on the side have no name except "Triggers" :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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