• 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.

A blacksmith produces weapons

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
What is a weapon? Is it a unit? An upgrade? An item?

Does the system have to use an autocast ability? What if you just press the ability buttons to toggle them on/off.

Can the blacksmith have multiple abilities enabled at once?

Custom resources have to be triggered.
 
Level 13
Joined
Oct 28, 2019
Messages
523
What is a weapon? Is it a unit? An upgrade? An item?

Does the system have to use an autocast ability? What if you just press the ability buttons to toggle them on/off.

Can the blacksmith have multiple abilities enabled at once?

Custom resources have to be triggered.
1) A resource. For exemple, to produce 1 footman, needs X gold, 1 sword, 1 iron shield and 1 Iron armor.
2) I imagined just turn on/off blacksmith producing a sword or a shield in moment ( not both at same time)
3)No, just one resource (sword, shield, bow, spear) can be produced at the time
4) This is already done
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
So a Weapon is a resource similar to Gold/Lumber? Since it's a custom resource I assume you manage it through triggers like so:
  • Set Variable SwordCount[Player number of some player] = SwordCount[Player number of some player] + 1
So the first idea that comes to mind:
1) The Barracks should train Units like normal.
2) The Units it trains are Weapons (Sword, Shield, etc).
3) Once a unit finishes training it gets Removed and the Player earns a custom resource depending on the type of Unit that was trained.
4) The Barracks should fill it's entire queue up with whatever Unit-type is chosen to be trained. If a Unit is cancelled then clear the entire queue. If another Unit-Type is trained then Clear the entire queue of the previous Unit-Type before filling it with the new one.

You can use Unit Indexing and the Begins/Cancels/Finishes training Events to manage this.
Unit Indexing may not even be necessary. You'll also want a Hashtable to link the Weapon Unit-Types to their Costs so you can get this information easily.
 
Last edited:
Level 13
Joined
Oct 28, 2019
Messages
523
You can use Unit Indexing and the Begins/Cancels/Finishes training Events to manage this.
Unit Indexing may not even be necessary. You'll also want a Hashtable to link the Weapon Unit-Types to their Costs so you can get this information easily.
idk what you saying need exemple. Ive done this its ok
  • Bow
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Bow
    • Actions
      • Wait 0.10 seconds
      • Unit - Remove (Entering unit) from the game
      • Set VariableSet IntegerWoodBow = (IntegerWoodBow + 1)
      • Leaderboard - Change the value for Player 2 (Blue) in (Last created leaderboard) to IntegerWoodBow
But has other issue, Im using unit event (load/unload).
This "weapon workshop" can only produces weapons with a peasant loaded in it....

  • EnterMill Copy
    • Events
      • Game - CargoEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of CargoTransportUnit[UDex]) Equal to Weapon Workshop
    • Actions
      • Player - Make Bow Available for training/construction by Player 1 (Red)
      • Player - Make Spear Available for training/construction by Player 1 (Red)
      • Player - Make Wooden Sword Available for training/construction by Player 1 (Red)
this dont work cause all workshop even withou peasant can train "sword, bow and spears"
I think train Bows need be an ability
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
It doesn't necessarily need to be an ability, you could simply Cancel the training if the unit doesn't have any Cargo in it:
  • Events
    • Unit - A unit Begins training a unit
  • Conditions
    • Cargo count Equal to 0 (I forget the name of this condition but it should exist)
  • Actions
    • Set Variable TempUnit = (Triggering unit)
    • Custom script: call IssueImmediateOrderById(udg_TempUnit, 851976)
There's plenty of tutorials on Hashtables / Unit Indexing. I recommend learning these techniques if you want to make advanced triggers, it's not all that hard if you put the work in.

Edit: I saw you were using a Unit Group provided by Unit Event, make sure to put the correct Custom Value in the [index]:
  • (Number of units in CargoTransportGroup[Custom value of (Triggering unit)] Equal to 0
 
Last edited:
Level 13
Joined
Oct 28, 2019
Messages
523
1680833850166.png


Integer comparison variables has only these, and count unit group (cargo transport group) does not work, need help :grin:
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
View attachment 429889

Integer comparison variables has only these, and count unit group (cargo transport group) does not work, need help :grin:
You need to put the correct Custom Value in the [index] of CargoTransportGroup[].
  • (Number of units in CargoTransportGroup[Custom value of (Triggering unit)] Equal to 0
Remember, every unit has a unique Custom Value thanks to the Unit Indexer system.

A unit's Custom Value can then be put in the [index] of a variable array to link that variable's data to that specific unit.

The Unit Event system uses this method for storing it's data.
 
Last edited:
Level 13
Joined
Oct 28, 2019
Messages
523
@Uncle , thats done, now, how can I do infinite trainning, I was testing with training on click, but its very booring, need do the infinite trainning

uncle said 4) The Barracks should fill it's entire queue up with whatever Unit-type is chosen to be trained. If a Unit is cancelled then clear the entire queue. If another Unit-Type is trained then Clear the entire queue of the previous Unit-Type before filling it with the new one.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
These three triggers will make the Blacksmith always have 7 units in it's queue. If you cancel one it will stop all production:
  • Blacksmith Begin Training
    • Events
      • Unit - A unit Begins training a unit
    • Conditions
    • Actions
      • Trigger - Turn off Blacksmith Begin Training <gen>
      • -------- --------
      • Set VariableSet Blacksmith = (Triggering unit)
      • Set VariableSet TrainedUnitType = (Trained unit-type)
      • -------- --------
      • For each (Integer Blacksmith_Loop) from 1 to 6, do (Actions)
        • Loop - Actions
          • Unit - Order Blacksmith to train/upgrade to a TrainedUnitType
      • -------- --------
      • Trigger - Turn on Blacksmith Begin Training <gen>
  • Blacksmith Finish Training
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • Trigger - Turn off Blacksmith Begin Training <gen>
      • -------- --------
      • Set VariableSet TrainedUnitType = (Trained unit-type)
      • Unit - Order Blacksmith to train/upgrade to a TrainedUnitType
      • -------- --------
      • Trigger - Turn on Blacksmith Begin Training <gen>
  • Blacksmith Cancel Training
    • Events
      • Unit - A unit Cancels training a unit
    • Conditions
    • Actions
      • Trigger - Turn off Blacksmith Cancel Training <gen>
      • -------- --------
      • Set VariableSet Blacksmith = (Triggering unit)
      • -------- --------
      • For each (Integer Blacksmith_Loop) from 1 to 7, do (Actions)
        • Loop - Actions
          • Custom script: call IssueImmediateOrderById(udg_Blacksmith, 851976)
      • -------- --------
      • Trigger - Turn on Blacksmith Cancel Training <gen>
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
From a gameplay perspective it might make more sense to have the blacksmith make a single forged equipment resource that is then used as a resource to train units rather than having multiple different resources that the player, UI and logic need to keep track of. The blacksmith then becomes a building that converts resources into another resource and this conversion process could be toggleable on/off, possibly with an ability like defend, immolation or mana shield. The conversion itself could be a periodic trigger that for each blacksmith that is on takes some resources, if the player can afford, to produce the forged equipment resource for the player.
 
Level 13
Joined
Oct 28, 2019
Messages
523
From a gameplay perspective it might make more sense to have the blacksmith make a single forged equipment resource that is then used as a resource to train units rather than having multiple different resources that the player, UI and logic need to keep track of. The blacksmith then becomes a building that converts resources into another resource and this conversion process could be toggleable on/off, possibly with an ability like defend, immolation or mana shield. The conversion itself could be a periodic trigger that for each blacksmith that is on takes some resources, if the player can afford, to produce the forged equipment resource for the player.
Its a good idea I will try this too, TY!
These three triggers will make the Blacksmith always have 7 units in it's queue. If you cancel one it will stop all production:
  • Blacksmith Begin Training
    • Events
      • Unit - A unit Begins training a unit
    • Conditions
    • Actions
      • Trigger - Turn off Blacksmith Begin Training <gen>
      • -------- --------
      • Set VariableSet Blacksmith = (Triggering unit)
      • Set VariableSet TrainedUnitType = (Trained unit-type)
      • -------- --------
      • For each (Integer Blacksmith_Loop) from 1 to 6, do (Actions)
        • Loop - Actions
          • Unit - Order Blacksmith to train/upgrade to a TrainedUnitType
      • -------- --------
      • Trigger - Turn on Blacksmith Begin Training <gen>
  • Blacksmith Finish Training
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • Trigger - Turn off Blacksmith Begin Training <gen>
      • -------- --------
      • Set VariableSet TrainedUnitType = (Trained unit-type)
      • Unit - Order Blacksmith to train/upgrade to a TrainedUnitType
      • -------- --------
      • Trigger - Turn on Blacksmith Begin Training <gen>
  • Blacksmith Cancel Training
    • Events
      • Unit - A unit Cancels training a unit
    • Conditions
    • Actions
      • Trigger - Turn off Blacksmith Cancel Training <gen>
      • -------- --------
      • Set VariableSet Blacksmith = (Triggering unit)
      • -------- --------
      • For each (Integer Blacksmith_Loop) from 1 to 7, do (Actions)
        • Loop - Actions
          • Custom script: call IssueImmediateOrderById(udg_Blacksmith, 851976)
      • -------- --------
      • Trigger - Turn on Blacksmith Cancel Training <gen>
TY UNCLE
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Not exactly sure what you mean but forcing players to press hotkeys is really not a great solution unless your game is being played offline. There's going to be a delay and nothing guarantees that the player still has the desired unit selected.

You can hide any ability button using the Hide Ability action or by setting it's x/y button position to 0/-11. Although, the build abilities may be inaccessible.
 
Level 13
Joined
Oct 28, 2019
Messages
523
humm dindt know this, Im need more buildings one button dont show all..

I´ve did this
  • normal build Copy Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Normal Buildings
    • Actions
      • Player - Make Weapon Workshop Unavailable for training/construction by (Owner of (Triggering unit))
      • Player - Make Armor Workshop Unavailable for training/construction by (Owner of (Triggering unit))
      • Player - Make Town Centerr Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Farmm Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Wall Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Barrackss Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Sawmill Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Stable Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Advanced Blacksmith Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Blacksmith Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Guard Tower Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Mining Camp Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Tannery Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Windmill Available for training/construction by (Owner of (Triggering unit))
      • Game - Force (Owner of (Triggering unit)) to press the key B.
Using summon wolves and water elemental ability to make" buildings" and "advanced buildings"
 
Status
Not open for further replies.
Top