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

Building using mana

Status
Not open for further replies.
Level 11
Joined
Nov 23, 2013
Messages
665
Hi everyone,

I'm currently working on a custom building-type that uses mana as a resource instead of gold and wood. Basically, it's an altar of sacrifice, and it gets its mana every time a unit sacrifices itself, pretty much like a Sacrificial Pit. You can get caster upgrades in this building.

I am stuck with this concept!
I managed to substract the mana cost of an upgrade from the Altar whenever I start researching that upgrade. However, when I start researching another upgrade while the first one is not finished yet, the mana cost is not substracted until the research of the first upgrade is over, because the event "A unit begins research" triggers only when the research has actually started.

Hope I am making this clear!!

I tried to learn from other posts about 3rd resource (such as this topic : http://www.hiveworkshop.com/forums/spells-569/gui-custom-resource-harvest-system-1-05-a-225610/) in order to find out how to deal with training units that requires something else than gold and lumber but I couldn't find anything helpful.

any idea to help me solve this?

thank you very much!
 
Easiest way is to trigger everything. If a unit requires mana check when trying to train the unit. There is a unit begins training event.
In the actions use an ITE ( if then else) to check if the player has those resources. If it does not ( in the else block) order the building to stop training that unit and then display a message saying you don't have the required mana to make this unit.

The best way to store and load with efficiency in this manner is to use hashtables keyed to the units type id.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
The order events do fire:

JASS:
    constant playerunitevent EVENT_PLAYER_UNIT_ISSUED_ORDER             = ConvertPlayerUnitEvent(38)
    constant playerunitevent EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER       = ConvertPlayerUnitEvent(39)
    constant playerunitevent EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER      = ConvertPlayerUnitEvent(40)
    constant playerunitevent EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDER        = ConvertPlayerUnitEvent(40)    // for compat

The event responded order id matches the id of the object you want to enqueue then.
 
Status
Not open for further replies.
Top