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

[General] problem when 2 different transformation masks, when entering region

Level 5
Joined
May 8, 2020
Messages
78
Transfiguration 1
Events
Unit - A unit enters Region 025 <gen>
Conditions
And - All (Conditions) are true
Conditions
((Entering unit) has an item of type Item change 1) Equal to True
Actions
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
Set Item[(Integer A)] = (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
Unit - Remove (Last created unit) from the game
Unit - Create 1 Hell monster ONE for (Owner of (Triggering unit)) at (Center of Enter Hero 005 <gen>) facing (Position of (Triggering unit))
Game - Display to (All players) the text: (Player + ((Name of (Triggering player)) + ( |rHas Transform + ((Name of (Last created unit)) + And Entered The Arena))))
Camera - Pan camera for (Triggering player) to (Position of (Last created unit)) with height 1500.00 above the terrain over 0.00 seconds
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
For each (Integer B) from 1 to 6, do (Actions)
Loop - Actions
Hero - Create Item[(Integer B)] and give it to (Last created unit)
Item - Remove (Item carried by (Last created unit) of type Item change 1)
Custom script: call RemoveLocation (udg_point)
Unit - Remove (Entering unit) from the game

Transfiguration 2
Events
Unit - A unit enters Region 025 <gen>
Conditions
And - All (Conditions) are true
Conditions
((Entering unit) has an item of type Item change 2) Equal to True
Actions
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
Set Item[(Integer A)] = (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
Unit - Remove (Last created unit) from the game
Unit - Create 1 Hell monster TWO for (Owner of (Triggering unit)) at (Center of Enter Hero 005 <gen>) facing (Position of (Triggering unit))
Game - Display to (All players) the text: (Player + ((Name of (Triggering player)) + ( |rHas Transform + ((Name of (Last created unit)) + And Entered The Arena))))
Camera - Pan camera for (Triggering player) to (Position of (Last created unit)) with height 1500.00 above the terrain over 0.00 seconds
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
For each (Integer B) from 1 to 6, do (Actions)
Loop - Actions
Hero - Create Item[(Integer B)] and give it to (Last created unit)
Item - Remove (Item carried by (Last created unit) of type Item change 2)
Custom script: call RemoveLocation (udg_point)
Unit - Remove (Entering unit) from the game


Question:
How to when the person holds 2 items at the same time (Item change 1) (Item change 2) will not create 2 heroes at the same time? it will select the mask positioned higher
for example (Item change 2) is placed in cell number 2 and (Item change 1) in cell number 6 so it will select cell number 2
further :
Is there a way to make the map only use up to 2 heroes for every player?
 
Level 12
Joined
Jan 10, 2023
Messages
191
If you begin trigger text with
"[tag]" and end them with "[/tag]" but replace tag with "trigger"

then your post will look like this:
  • Transfiguration 1
  • Events
  • Unit - A unit enters Region 025 <gen>
  • Conditions
  • And - All (Conditions) are true
  • Conditions
  • ((Entering unit) has an item of type Item change 1) Equal to True
  • Actions
  • For each (Integer A) from 1 to 6, do (Actions)
  • Loop - Actions
  • Set Item[(Integer A)] = (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
  • Unit - Remove (Last created unit) from the game
  • Unit - Create 1 Hell monster ONE for (Owner of (Triggering unit)) at (Center of Enter Hero 005 <gen>) facing (Position of (Triggering unit))
  • Game - Display to (All players) the text: (Player + ((Name of (Triggering player)) + ( |rHas Transform + ((Name of (Last created unit)) + And Entered The Arena))))
  • Camera - Pan camera for (Triggering player) to (Position of (Last created unit)) with height 1500.00 above the terrain over 0.00 seconds
  • Special Effect - Destroy (Last created special effect)
  • Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
  • For each (Integer B) from 1 to 6, do (Actions)
  • Loop - Actions
  • Hero - Create Item[(Integer B)] and give it to (Last created unit)
  • Item - Remove (Item carried by (Last created unit) of type Item change 1)
  • Custom script: call RemoveLocation (udg_point)
  • Unit - Remove (Entering unit) from the game
If you right click on the trigger and then above "Events", right-click the trigger name and use that "copy trigger as text" option, it will have the proper indentation.

Sorry to get your hopes up, I haven't taken a look at this, but if you make it a habit to share triggers in the way I described, you might get more help: help faster.

I will look later tonight when I have to time, but I'm not very practiced with masks.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,552
Question:
How to when the person holds 2 items at the same time (Item change 1) (Item change 2) will not create 2 heroes at the same time? it will select the mask positioned higher
for example (Item change 2) is placed in cell number 2 and (Item change 1) in cell number 6 so it will select cell number 2
further :
Is there a way to make the map only use up to 2 heroes for every player?
Use an If Then Else action to ensure that only one set of Actions run:
  • Example 1
    • Events
      • Unit - A unit enters Region 025 <gen>
    • Conditions
    • Actions
      • Set Drop_Unit = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Drop_Unit has an item of type Item Change 1) Equal to True
        • Then - Actions
          • Set Drop_Player = (Owner of Drop_Unit)
          • Item - Remove (Item carried by Drop_Unit of type Item Change 1)
          • For each (Integer Drop_Loop) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set Drop_Item[Drop_Loop] = (Item carried by Drop_Unit in slot Drop_Loop)
              • Hero - Drop Drop_Item[Drop_Loop] from Drop_Unit.
          • Unit - Remove Drop_Unit from the game
          • Unit - Create 1 Paladin for Drop_Player at (Center of (Playable map area)) facing Default building facing degrees
          • Set Drop_Unit = (Last created unit)
          • For each (Integer Drop_Loop) from 1 to 6, do (Actions)
            • Loop - Actions
              • Hero - Give Drop_Item[Drop_Loop] to Drop_Unit
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Drop_Unit has an item of type Item Change 2) Equal to True
            • Then - Actions
              • Set Drop_Player = (Owner of Drop_Unit)
              • Item - Remove (Item carried by Drop_Unit of type Item Change 2)
              • For each (Integer Drop_Loop) from 1 to 6, do (Actions)
                • Loop - Actions
                  • Set Drop_Item[Drop_Loop] = (Item carried by Drop_Unit in slot Drop_Loop)
                  • Hero - Drop Drop_Item[Drop_Loop] from Drop_Unit.
              • Unit - Remove Drop_Unit from the game
              • Unit - Create 1 Paladin for Drop_Player at (Center of (Playable map area)) facing Default building facing degrees
              • Set Drop_Unit = (Last created unit)
              • For each (Integer Drop_Loop) from 1 to 6, do (Actions)
                • Loop - Actions
                  • Hero - Give Drop_Item[Drop_Loop] to Drop_Unit
            • Else - Actions
You also don't need to create new versions of the items, which I show in my example. Although, I suppose some of your Items could be Undroppable and you're on an older version so you can't make the item's Droppable temporarily. It'd be nice to preserve the cooldowns and item charges.

For your last question, I'm not sure if you mean limit each Player to 2 Item Changes (transformations) or limit the Player from training more than 2 heroes from an Altar.

For limiting transformations, use an Integer array variable and increase it by 1 whenever a Player transforms. Also, add a Condition that checks this array before running any of the actions:
  • Example 2
    • Events
      • Unit - A unit enters Region 025 <gen>
    • Conditions
      • Transform_Count[(Player number of (Owner of (Triggering unit))] Less than 2
    • Actions
      • Set Drop_Unit = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Drop_Unit has an item of type Item Change 1) Equal to True
        • Then - Actions
          • Set Drop_Player = (Owner of Drop_Unit)
          • Set Transform_Count[(Player number of Drop_Player)] = Transform_Count[(Player number of Drop_Player)] + 1
          • Item - Remove (Item carried by Drop_Unit of type Item Change 1)
          • For each (Integer Drop_Loop) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set Drop_Item[Drop_Loop] = (Item carried by Drop_Unit in slot Drop_Loop)
              • Hero - Drop Drop_Item[Drop_Loop] from Drop_Unit.
          • Unit - Remove Drop_Unit from the game
          • Unit - Create 1 Paladin for Drop_Player at (Center of (Playable map area)) facing Default building facing degrees
          • Set Drop_Unit = (Last created unit)
          • For each (Integer Drop_Loop) from 1 to 6, do (Actions)
            • Loop - Actions
              • Hero - Give Drop_Item[Drop_Loop] to Drop_Unit
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Drop_Unit has an item of type Item Change 2) Equal to True
            • Then - Actions
              • Set Drop_Player = (Owner of Drop_Unit)
              • Set Transform_Count[(Player number of Drop_Player)] = Transform_Count[(Player number of Drop_Player)] + 1
              • Item - Remove (Item carried by Drop_Unit of type Item Change 2)
              • For each (Integer Drop_Loop) from 1 to 6, do (Actions)
                • Loop - Actions
                  • Set Drop_Item[Drop_Loop] = (Item carried by Drop_Unit in slot Drop_Loop)
                  • Hero - Drop Drop_Item[Drop_Loop] from Drop_Unit.
              • Unit - Remove Drop_Unit from the game
              • Unit - Create 1 Paladin for Drop_Player at (Center of (Playable map area)) facing Default building facing degrees
              • Set Drop_Unit = (Last created unit)
              • For each (Integer Drop_Loop) from 1 to 6, do (Actions)
                • Loop - Actions
                  • Hero - Give Drop_Item[Drop_Loop] to Drop_Unit
            • Else - Actions
Use the (Player number) as the [index] in your Array. This is known as Player Indexing.

For the Altar thing, I believe there's an action for hero limits and some gameplay constant stuff you can change.
 
Last edited:
Level 5
Joined
May 8, 2020
Messages
78
Limit Hero 2
Events
Unit - A unit enters (Playable map area)
Conditions
Actions
Player - Limit training of Heroes to 2 for (Owner of (Entering unit))

Enter Hero
Events
Player - Player 1 (Red) types a chat message containing -random as An exact match
Conditions
Actions
Unit - Create 1 Keeper of the Grove for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
Unit - Create 1 Priestess of the Moon for Player 2 (Blue) at (Center of (Playable map area)) facing Default building facing degrees
Unit - Create 1 Demon Hunter for Player 3 (Teal) at (Center of (Playable map area)) facing Default building facing degrees
Unit - Create 1 Warden for Player 4 (Purple) at (Center of (Playable map area)) facing Default building facing degrees

Chossen Heroes
Events
Unit - A unit enters Enter Hero 005 <gen>
Conditions
Actions
Unit - Create 1 Keeper of the Grove for Own of (Entering Unit) at (Center of (Playable map area)) facing Default building facing degrees


in example 2, can I limit 2 heroes to each player when they appear on the map? , If they choose more than 2, the 3rd or more last hero they picked will be removed

because my map uses command to spawn hero and go to hero area to choose
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,552
Use the Integer array example I suggested. It's a simple concept:

When the Player gets a new hero add 1 to the Integer variable.
Then use a Condition to check the value of the Integer variable, if it's Equal to 2 then don't run the Actions.
  • Set Variable Hero_Count[(Player number of (Triggering player))] = Hero_Count[(Player number of (Triggering player))] + 1
 
Level 5
Joined
May 8, 2020
Messages
78
Lmit Hero Come To True
Events
Unit - A unit enters (Playable map area)
Conditions
((Entering unit) is A Hero) Equal to True
Actions
Set MapLimit[(Player number of (Owner of (Entering unit)))] = MapLimit[(Player number of (Owner of (Entering unit)))]
Set Hero_Count[(Player number of (Triggering player))] = (Hero_Count[(Player number of (Triggering player))] + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero_Count[(Player number of (Triggering player))] Greater than 2
Then - Actions
Unit - Remove MapLimit[(Player number of (Owner of (Entering unit)))] from the game
Else - Actions
1689765853065.png


where did i go wrong , i tried to make 2 heroes for each , rather than creating 2 heroes on the map
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,552
Can you please post your triggers properly. Tristronic explained how in the first reply.

This line doesn't make sense:
  • Set MapLimit[(Player number of (Owner of (Entering unit)))] = MapLimit[(Player number of (Owner of (Entering unit)))]
Why are you setting some random unknown unit to be equal to itself?

I think you meant to do something like this:
  • Set Variable MapLimit = (Entering unit)

This looks correct:
  • Set Hero_Count[(Player number of (Triggering player))] = (Hero_Count[(Player number of (Triggering player))] + 1)
But the (Triggering player) Event Response doesn't always work for Unit events. Change it to (Owner of (Entering unit)).


Anyway, shouldn't you be increasing and checking Hero_Count in the trigger that creates the Heroes?
  • Events
    • Player - Player 1 (Red) types a chat message containing -create hero
  • Conditions
    • Hero_Count[(Player number of (Triggering player))] Less than 2
  • Actions
    • Set Hero_Count[(Player number of (Triggering player))] = (Hero_Count[(Player number of (Triggering player))] + 1)
    • // Create a hero
You can prevent the Hero from being created in the first place by doing it like this.
 
Top