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

How to make summoned unit use food ?

Status
Not open for further replies.
Level 29
Joined
Mar 9, 2012
Messages
1,557
Exactly what it says in the title.
The unit is summoned by use on acquire item sold at the buildable shop.
It additionaly needs to check if purchasing player has enough food available otherwise deny the purchase.

I can simply make the shop sell the unit but then it wont check for it's prequisite building(?).
 
Last edited:
Level 37
Joined
Jul 22, 2015
Messages
3,485
As far as I know, there is no way to catch a unit buying an item before it is actually bought OR catch a unit using an item before it is actually used. The whole summoned unit stuff must be hardcoded because even if I try changing the food required + provided of the summoned unit, it doesn't actually do anything. You might have to just trigger the item and run a check of the triggering player's food property, and if it matches, create the unit.

OT: English can be a bit confusing, but "an use" is incorrect xD the rule to use an is if the word following the article has a vowel SOUND, not an actual vowel. The word use has a Y sound, and if you know the whole rule with vowels, Y is SOMETIMES considered a vowel (A, E, I, O, U, and sometimes Y).
 
Level 29
Joined
Mar 9, 2012
Messages
1,557
Cant you train the unit instead?

Probably i could, but is that what i wanted to do ?
Nope.

The whole summoned unit stuff must be hardcoded because even if I try changing the food required + provided of the summoned unit, it doesn't actually do anything.

I believe this one:
http://www.hiveworkshop.com/forums/spells-569/undead-summoning-training-method-1-2-a-270937/
contains some bits and pieces regarding how to make summoned use food. Or atleast emulates it, as far i have understood.
 

sentrywiz

S

sentrywiz

Exactly what it says in the title.
The unit is summoned by use on acquire item sold at the buildable shop.
It additionaly needs to check if purchasing player has enough food available otherwise deny the purchase.

I can simply make the shop sell the unit but then it wont check for it's prequisite building(?).

Don't have wc3 atm, but this should be rather easy.

Add food cost to the summoned unit in the object editor.
Check if player has enough food when a unit uses an item.
If food > X, create unit Else display game message.
 

Shar Dundred

Community Moderator
Level 72
Joined
May 6, 2009
Messages
5,870
Shouldn't something as easy as this work?
 

Attachments

  • test.JPG
    test.JPG
    40.1 KB · Views: 214

Shar Dundred

Community Moderator
Level 72
Joined
May 6, 2009
Messages
5,870
Well, the refund is quite easy, just use Player - Add (Resources spent).
About the cooldown... How about copying the unit, make the normal unit unbuyable and replace it with the copy - the unit type has to be added as an alternative to the trigger booleans of course - which has no inital cooldown? Once you bought that one, it's replaced with the normal one again.
 
Status
Not open for further replies.
Top