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

[Trigger] Trigger Help Plz

Status
Not open for further replies.
Level 4
Joined
Feb 3, 2007
Messages
58
  • function Trig_End_Round_1_Copy_Func002C takes nothing returns boolean
    • if ( not ( udg_BlackPlayers == 0 ) ) then
      • return false
    • endif
    • return true
  • endfunction
  • function Trig_End_Round_1_Copy_Func003C takes nothing returns boolean
    • if ( not ( udg_WhitePlayers == 0 ) ) then
      • return false
    • endif
    • return true
  • endfunction
  • function Trig_End_Round_1_Copy_Func004A takes nothing returns nothing
    • call KillUnit( GetEnumUnit() )
  • endfunction
  • function Trig_End_Round_1_Copy_Actions takes nothing returns nothing
    • if ( Trig_End_Round_1_Copy_Func002C() ) then
      • call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_081" )
      • set udg_WhiteScore = ( udg_WhiteScore + 1 )
      • call LeaderboardSetPlayerItemValueBJ( Player(0), GetLastCreatedLeaderboard(), udg_WhiteScore )
    • else
      • call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_080" )
    • endif
    • if ( Trig_End_Round_1_Copy_Func003C() ) then
      • call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_083" )
      • set udg_BlackScore = ( udg_BlackScore + 1 )
      • call LeaderboardSetPlayerItemValueBJ( Player(0), GetLastCreatedLeaderboard(), udg_WhiteScore )
    • else
      • call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_082" )
    • endif
    • call ForGroupBJ( GetUnitsInRectAll(GetPlayableMapRect()), function Trig_End_Round_1_Copy_Func004A )
    • call DisableTrigger( GetTriggeringTrigger() )
    • call EnableTrigger( gg_trg_Round_2 )
  • endfunction
  • //===========================================================================
  • function InitTrig_End_Round_1_Copy takes nothing returns nothing
    • set gg_trg_End_Round_1_Copy = CreateTrigger( )
    • call DisableTrigger( gg_trg_End_Round_1_Copy )
    • call TriggerRegisterAnyUnitEventBJ( gg_trg_End_Round_1_Copy, EVENT_PLAYER_UNIT_DEATH )
    • call TriggerAddAction( gg_trg_End_Round_1_Copy, function Trig_End_Round_1_Copy_Actions )
  • endfunction
 
Level 11
Joined
Jul 12, 2005
Messages
764
This is NOT JASS!! This a GUI trigger converted to JASS... Awful, and has nothing to do with the main topic.


Ok, just briefly:

E- Unit enters <region>
A- Set U = TriggerUnit

E- Every x seconds of the game
C- (U is not equal to No Unit)
A- Set A = A + 1
If A > xx then
Wow you won

E- U dies
A- Set A = A + 1
 
Level 3
Joined
Feb 20, 2007
Messages
32
E- Unit enters <region>
A- Set U = TriggerUnit

E- Every x seconds of the game
C- (U is not equal to No Unit)
A- Set A = A + 1
If A > xx then
Wow you won

E- U dies
A- Set A = A + 1

For the last action, wouldent you be setting A to 0? Should work if you caught the jist of that, though.
 
Level 4
Joined
Jan 16, 2007
Messages
10
paskovich's system looks good, but you might want to do this:

E- Unit enters <region>
A- If unit belongs to player (Insert non-enemy player here)
then
Set U = TriggerUnit

or else it will set every unit that enters the area to the "unit" and wouldn't work. You also want to add an event like:

E- U (being the variable unit) leaves <region>
A- Set U = no unit

so you cant walk in and out and wait....

And for your question Burger_Bling, for the
"If A > xx
then
Wow you won"

you replace the "xx" (as well as all the other variables) with a value, say 60 so it says you win when you are in the region for 60 seconds.
 
Level 8
Joined
Sep 13, 2006
Messages
431
Well, a question for you... do you want it to be so that only one unit can be in region (and counting down to victory) at once, or is it okay if one is in the region and the other enters (both counting down but at different times)? Because I personally would use custom values.

Every 1 sec, pick every unit in (region) and set (custom value) to ((current custom value) +1).
If picked unit's custom value > desired time, then declare victory.

This way, multiple units can be counting down. It also carries along with it other benefits, depending on how you want everything to work...

EDIT: Oh, and don't forget to use another trigger to set unit's custom value to zero when it leaves region
 
Last edited:
Status
Not open for further replies.
Top