• 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 faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Get your art tools and paintbrushes ready and enter Hive's 34th Texturing Contest: Void! Click here to enter!

Warcraft of might and magic

Level 13
Joined
Oct 28, 2019
Messages
528
Hi everyone!
Does anyone know the game Heroes of Might and Magic III? I'm trying to create a small custom map inspired by the Warcraft world.


I'm running into a few issues.


I'm currently using a movement detector to enable or disable hero movement each turn.


Also, I'm trying to make it so that the items carried by the hero represent units. For example, an item called "Footman" would have 8 charges. When the hero encounters enemies, a trigger would detect the number of charges and spawn 8 Footman units on the battlefield.


Is there any way to create a trigger that can count the number of item charges or stacks?
 
Level 30
Joined
Sep 26, 2009
Messages
2,618
You can get remaining charges of an item and set it into an integer variable. It's the "Item - Item Charges Remaining" integer function:
  • Set VariableSet YourHero = Some_unit
  • Set VariableSet ChargesLeft = (Charges remaining in (Item carried by YourHero of type FootmanItem))
The above will find FootmanItem in YourHero's inventory and set the remaining charges amount to an integer variable ChargesLeft.
But I assume you can have FootmanItem multiple times in inventory? If so, the above would show charges left for only one of those items. But you want to sum all items of same item-type. So you would need a loop like in example below:
  • Set VariableSet ChargesLeft = 0
  • For each (Integer A) from 1 to 6, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item carried by YourHero in slot (Integer A))) Equal to FootmanItem
        • Then - Actions
          • Set VariableSet ChargesLeft = (ChargesLeft + (Charges remaining in (Item carried by YourHero in slot (Integer A))))
        • Else - Actions
 
Top