Disabling (or not enabling) triggers?

ZakkWylde-

New Member
Reaction score
14
JASS:
set udg_is_activ_j[n] = ((GetPlayerController( Player(n) ) == MAP_CONTROL_USER and GetPlayerSlotState( Player(n) ) == PLAYER_SLOT_STATE_PLAYING) or GetPlayerController( Player(n) ) == MAP_CONTROL_COMPUTER)
if udg_is_activ_j[n] then
      set udg_DemonHunters[n] = CreateUnit(Player(n), 'Edem', Xpos, Ypos, 0)
      call SetUnitAnimation(udg_DemonHunters[n], "Spell Alternate")
      call EnableTrigger(udg_check_terrain_j[n]) //each of the terrain kills are set to this global variable upon map initialization
endif


example of one terrain kill initialitzation:
JASS:
function InitTrig_RedTerrainKill takes nothing returns nothing
    set gg_trg_RedTerrainKill = CreateTrigger(  )
    call DisableTrigger(gg_trg_RedTerrainKill)
    call TriggerRegisterTimerEvent(gg_trg_RedTerrainKill, 0.1, true)
    call TriggerAddAction( gg_trg_RedTerrainKill, function RedTerrainKill )
endfunction


So how could I make it so that the terrain kill for each player is run ONLY if he/she is a player in the game?

I could be going about this the completely wrong way...but the way I have it now may not work.
 

ZakkWylde-

New Member
Reaction score
14
Mmk....if you really want...

JASS:
function Trig_GroupDefine_Actions takes nothing returns nothing
    local integer i = 0
    local integer j = 0
    local integer n = 0
    local real Xmax = GetRectMaxX(gg_rct_lvl1)
    local real Xmin = GetRectMinX(gg_rct_lvl1)
    local real Ymax = GetRectMaxY(gg_rct_lvl1)
    local real Ymin = GetRectMinY(gg_rct_lvl1)
    //local real Xdiff = ((Xmax-Xmin)/2)
    //local real Ydiff = Ymax-Ymin
    local real Xpos = Xmax+150
    local real Ypos = Ymin-50
    
    loop
        exitwhen i > 2
        loop
            exitwhen j > 3
            set Ypos = Ypos+50
            set Xpos = Xpos-150
            set udg_is_activ_j[n] = ((GetPlayerController( Player(n) ) == MAP_CONTROL_USER and GetPlayerSlotState( Player(n) ) == PLAYER_SLOT_STATE_PLAYING) or GetPlayerController( Player(n) ) == MAP_CONTROL_COMPUTER)
            if udg_is_activ_j[n] then
                set udg_DemonHunters[n] = CreateUnit(Player(n), 'Edem', Xpos, Ypos, 0)
                call SetUnitAnimation(udg_DemonHunters[n], "Spell Alternate")
                call EnableTrigger(udg_check_terrain_j[n])
            endif
            set n = n + 1
            set j = j + 1
        endloop
        set j = 0
        set i = i + 1
        set Xpos = Xmax+150
    endloop
    
    set i = 0
    
endfunction
// EDIT: I'm proud of my loops...it spawns a pattern going down and to the right, then resets back 
//to left after 4 demon hunters (so 3 rows kinda) =D :ENDEDIT
function Trig_init_slide_triggers_Actions takes nothing returns nothing

    set udg_check_terrain_j[0] = gg_trg_RedTerrainKill
    set udg_check_terrain_j[1] = gg_trg_BlueTerrainKill
    set udg_check_terrain_j[2] = gg_trg_TealTerrainKill
    set udg_check_terrain_j[3] = gg_trg_PurpleTerrainKill
    set udg_check_terrain_j[4] = gg_trg_YellowTerrainKill
    set udg_check_terrain_j[5] = gg_trg_OrangeTerrainKill
    set udg_check_terrain_j[6] = gg_trg_GreenTerrainKill
    set udg_check_terrain_j[7] = gg_trg_PinkTerrainKill
    set udg_check_terrain_j[8] = gg_trg_GrayTerrainKill
    set udg_check_terrain_j[9] = gg_trg_LBTerrainKill
    set udg_check_terrain_j[10] = gg_trg_DGTerrainKill
    set udg_check_terrain_j[11] = gg_trg_BrownTerrainKill
    
    call ExecuteFunc("Trig_GroupDefine_Actions")
endfunction
//===========================================================================
function InitTrig_GroupDefine takes nothing returns nothing
    set gg_trg_GroupDefine = CreateTrigger(  )
    call TriggerAddAction( gg_trg_GroupDefine, function Trig_init_slide_triggers_Actions )
endfunction


Here's one of the terrain kills (FOR LIGHT BLUE!)

JASS:
function LBTerrainKill takes nothing returns nothing
    local unit u = udg_DemonHunters[9]
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local effect e
    
    if GetTerrainType(x, y) == udg_DeathTerVines and IsUnitAliveBJ(u)==true then
        call SetUnitMoveSpeed(u, 520)
        call PauseUnit(u, true)
        call SetUnitFacing(u, GetUnitFacing(u))
        set e = AddSpecialEffect("Abilities\\Spells\\NightElf\\EntanglingRoots\\EntanglingRootsTarget.mdl", x, y)        
        call DisableTrigger(gg_trg_LBTerrainKill)
        call TriggerSleepAction(2)
        call SetUnitExploded(u, true)
        call KillUnit(u)
        call PauseUnit(u, false)
        call SetUnitMoveSpeed(u, 522)
        call DestroyEffect(e)
        set e = null
        call EnableTrigger(gg_trg_LBTerrainKill)
    endif
    
endfunction

//===========================================================================
function InitTrig_LBTerrainKill takes nothing returns nothing
    set gg_trg_LBTerrainKill = CreateTrigger(  )
    call DisableTrigger(gg_trg_LBTerrainKill) //I sense problems with the order of enabling / disabling ... 
    call TriggerRegisterTimerEvent(gg_trg_LBTerrainKill, 0.1, true)
    call TriggerAddAction( gg_trg_LBTerrainKill, function LBTerrainKill )
endfunction
 

cleeezzz

The Undead Ranger.
Reaction score
268


you can get rid of that boolean array.

also, why do you use N and J, when J and N are exactly the same value? since J is used to exit the loop, just replace all your n with j.

now create a global trigger array, for example

JASS:
globals
trigger array TRIGS[12]
endglobals

now before or after you disable each of the player terrain kill triggers, set TRIG[Player number] to the trigger name (within the Initializer and after trigger is created)

for example for LB

JASS:
function InitTrig_LBTerrainKill takes nothing returns nothing
    set gg_trg_LBTerrainKill = CreateTrigger(  )
    set TRIGS[10] = gg_trg_LBTerrainKill //Player 10 is LB right?
    call DisableTrigger(gg_trg_LBTerrainKill) //I sense problems with the order of enabling / disabling ... 
    call TriggerRegisterTimerEvent(gg_trg_LBTerrainKill, 0.1, true)
    call TriggerAddAction( gg_trg_LBTerrainKill, function LBTerrainKill )
endfunction


now in your first trigger, just do
JASS:
call EnableTrigger(TRIGS[j])
 

ZakkWylde-

New Member
Reaction score
14
Why thank you sir. :D

But now, on to my super pro loop.

Obviously it went way over your head :p. n and j are not the same values. j never goes above 3. n goes from 0 to 11. I use it to spawn a pattern. j loops four times per i. i loops three times. i.e. three rows of four units, each slightly displaced compared to the other.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      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