• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Text Message

Status
Not open for further replies.
Level 11
Joined
Jun 20, 2017
Messages
380
What's wrong? That only shows the first message!
  • Notice 1
    • Events
      • Unit - A unit Begins an upgrade
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to (==) Town Hall (2)
        • Then - Actions
          • Game - Display to (All players) the text: (String_PlayerColors[(Player number of (Triggering player))] + has constructed the |cffffcc00Town Hall (2).|r)
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Do nothing
      • -------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --------
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Triggering unit)) Equal to (==) Town Hall (3)
          • Then - Actions
            • Game - Display to (All players) the text: (String_PlayerColors[(Player number of (Triggering player))] + has constructed the |cffffcc00Town Hall (3).|r)
            • Trigger - Turn off (This trigger)
          • Else - Actions
            • Do nothing
      • -------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --------
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Triggering unit)) Equal to (==) Town Hall (4)
          • Then - Actions
            • Game - Display to (All players) the text: (String_PlayerColors[(Player number of (Triggering player))] + has constructed the |cffffcc00Town Hall (4).|r)
            • Trigger - Turn off (This trigger)
          • Else - Actions
            • Do nothing
 
Shorter triggers you say? Try a hashtable.
  • Upgrade
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • (Load (Key (Name of (Triggering unit))) of (Player number of (Triggering player)) from UpgradeTable) Equal to False
    • Actions
      • Hashtable - Save True as (Key (Name of (Triggering unit))) of (Player number of (Triggering player)) in UpgradeTable
      • Game - Display to (All players) the text: ((Name of (Triggering player)) + ( upgraded to + (Name of (Triggering unit))))
 
I think it can be done without hashtables, and a hashtable would just make that trigger shorter it would have a larger setup instead, the overall gain is probably very small.

Try

set upgraded = triggering unit
if ANY conditions are true
upgraded is equal to townhall (1)
upgraded is equal to townhall (2)
upgraded is equal to townhall (3)​
Then
Display message Name of triggering player + upgraded to + name of upgraded
Turning off the trigger does not seem needed to me here.
 
No it does not. triggering player only works for player events.

I tried the following in a temp map:
  • Melee Initialization
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • Game - Display to (All players) the text: 1
      • Game - Display to (All players) the text: (Name of (Triggering player))
"1" gets written but not the second one.
 
Unit events that are registered for a specic player can use TriggeringPlayer.

call TriggerRegisterPlayerUnitEvent(trigger, player, playerunitevent, null) -- is the used function.

For example, "A unit dies" does call the above function with EVENT_PLAYER_UNIT_DEATH for all players.

==

"A unit enters region" looks like (Chaosy, your example)
JASS:
function TriggerRegisterEnterRectSimple takes trigger trig, rect r returns event
    local region rectRegion = CreateRegion()
    call RegionAddRect(rectRegion, r)
    return TriggerRegisterEnterRegion(trig, rectRegion, null)
endfunction
^which does not register any player event. TriggeringPlayer can't be used here.
 
Status
Not open for further replies.
Back
Top