just what I needed, thanks for your helpYou need to store the hero inside a variable to prevent memory leaks and changing the target per action.
- Untitled Trigger 001
- Events
- Player - Player 1 (Red) types a chat message containing /move as An exact match
- Player - Player 2 (Blue) types a chat message containing /move as An exact match
- Conditions
- Actions
- Set Group = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
- Set Hero = (Random unit from Group)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Hero level of Hero) Greater than or equal to 2
- Then - Actions
- Set Point = (Center of (Playable map area))
- Unit - Move Hero instantly to Point
- Camera - Pan camera for (Triggering player) to Point over 0.00 seconds
- Hero - Modify Strength of Hero: Add 50
- Custom script: call RemoveLocation (udg_Point)
- Else - Actions
- Custom script: call DestroyGroup (udg_Group)
What Warseeker suggested is a nice start, but I don't think it does exactly what you wanted:Please help me, Chat messages/move orders only apply to heroes, soldiers and horses in the team will not receive the above commands.
Sorry to bother you, you can help me when the hero's bag is full and picking up more will move the next item in the Horse's bag.
Nice to see you again, thank you for helping me. Thanks to you my map is better.What Warseeker suggested is a nice start, but I don't think it does exactly what you wanted:
You can keep track of your heroes using array variables like this:
You can interact with specific heroes and groups of units like this:
- Store Preplaced Hero
- Events
- Time - Elapsed game time is 0.00 seconds
- Conditions
- Actions
- -------- Store Player 1's hero: --------
- Set VariableSet Player_Hero[1] = Paladin 0000 <gen>
- -------- --------
- -------- Note: Make sure that Player_Hero_Group's array Size is set to 28 in the Variable Editor! --------
- Unit Group - Add Player_Hero[1] to Player_Hero_Group[1]
^ Modify the Conditions under the Or - Any (Conditions) are true to determine which class and type of unit get issued the order.
- Move Command
- Events
- Player - Player 1 (Red) types a chat message containing /move as An exact match
- Player - Player 2 (Blue) types a chat message containing /move as An exact match
- Player - Player 3 (Teal) types a chat message containing /move as An exact match
- Conditions
- (Hero level of Player_Hero[(Player number of (Triggering player))]) Greater than or equal to 2
- Actions
- Set VariableSet Temp_Point = (Position of Player_Hero[(Player number of (Triggering player))])
- Camera - Pan camera for (Triggering player) to Temp_Point over 0.00 seconds
- Custom script: call RemoveLocation( udg_Temp_Point )
- -------- --------
- Set VariableSet Temp_Point = (Center of MoveRegion <gen>)
- Set VariableSet Temp_Group = (Units owned by (Triggering player).)
- -------- --------
- Unit Group - Pick every unit in Temp_Group and do (Actions)
- Loop - Actions
- Set VariableSet Temp_Unit = (Picked unit)
- -------- --------
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Or - Any (Conditions) are true
- Conditions
- (Temp_Unit is A Hero) Equal to True
- (Unit-type of Temp_Unit) Equal to Pack Horse
- (Temp_Unit is A peon-type unit) Equal to False
- Then - Actions
- Unit - Order Temp_Unit to Move To Temp_Point
- Else - Actions
- -------- --------
- Custom script: call RemoveLocation( udg_Temp_Point )
- Custom script: call DestroyGroup( udg_Temp_Group )
^ You could change the Then - Actions to Order the Pack Horse to walk up to and pick-up the item instead:
- Pack Horse Transfer Item
- Events
- Unit - A unit Is issued an order targeting an object
- Conditions
- ((Triggering unit) is A Hero) Equal to True
- (Target item of issued order) Not equal to No item
- (Item carried by (Triggering unit) in slot 1) Not equal to No item
- (Item carried by (Triggering unit) in slot 2) Not equal to No item
- (Item carried by (Triggering unit) in slot 3) Not equal to No item
- (Item carried by (Triggering unit) in slot 4) Not equal to No item
- (Item carried by (Triggering unit) in slot 5) Not equal to No item
- (Item carried by (Triggering unit) in slot 6) Not equal to No item
- Actions
- Set VariableSet Temp_Group = (Units owned by (Owner of (Triggering unit)).)
- -------- --------
- Unit Group - Pick every unit in Temp_Group and do (Actions)
- Loop - Actions
- Set VariableSet Temp_Unit = (Picked unit)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Unit-type of Temp_Unit) Equal to Pack Horse
- Then - Actions
- Hero - Give (Target item of issued order) to Temp_Unit
- Else - Actions
- -------- --------
- -------- --------
- Custom script: call DestroyGroup( udg_Temp_Group )
There's some other example triggers in the attached map. Requires latest patch to open.
- Unit - Order Temp_Unit to Right-Click (Target item of issued order)
Why can't you rename it in the Object Editor? Won't you be creating a new item each time?
Alright, so you aren't going to create a new item then.
You'll have to track the number of times the Item has been upgraded and use that to determine the new name:
Here's a useful system for tracking data on Items:
Item Indexer v1.4.0 [GUI friendly]
/********************************Item Indexer v1.4.0 by NightSkyAurora******************************** WHAT IT DOES: - Assigns a unique custom value (ItemUserData in JASS) to all the items in the game - Creates an event that fires when an item is...www.hiveworkshop.com
By using that system we can do something like this:
Store the different item names for the Claws of Attack in a String array variable. The [index] represents the number of times it's been upgraded:
When upgrading the Item, increase the number of times it's been upgraded by using an Integer array variable:
- Events
- Time - Elapsed game-time is 0.00 seconds
- Conditions
- Actions
- Set Variable Claws_Upgrade_Name[1] = Claws of Attack +13
- Set Variable Claws_Upgrade_Name[2] = Claws of Attack +14
- Set Variable Claws_Upgrade_Name[3] = Claws of Attack +15
We use that new Integer value as the [index] in the matching String array to update it's name.
- -------- Do this when upgrading the item --------
- Set Variable Item = (The item you want to upgrade)
- Set Variable Item_CV = (Custom value of Item)
- Set Variable Item_Upgrades[Item_CV] = (Item_Upgrades[Item_CV] + 1)
- Item - Set name of Item to Claws_Upgrade_Name[Item_Upgrades[Item_CV]]
So if Item_Upgrades is equal to 2 then that means the Item has been upgraded 2 times. That means it's name will be set to Claws_Upgrade_Name[2]. So it's name will be set to Claws of Attack +14.
Substring is the name of the function.I have a new idea, can you help me? Is there any way to subtract the last 3 letters when renaming items?