1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

How to make summoned unit use food ?

Discussion in 'World Editor Help Zone' started by Eagle XI, Nov 29, 2015.

  1. Eagle XI

    Eagle XI

    Joined:
    Mar 9, 2012
    Messages:
    1,359
    Resources:
    117
    Models:
    2
    Icons:
    109
    Packs:
    4
    Skins:
    2
    Resources:
    117
    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: Nov 30, 2015
  2. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Cant you train the unit instead?
     
  3. LordDz

    LordDz

    Joined:
    May 11, 2007
    Messages:
    4,303
    Resources:
    0
    Resources:
    0
    A unit uses an ability:
    ability == item ability 1
    if (owner of triggering unit has enough food)
    create 1 ogre for owner of triggering unit

    else

    Game message - u no have food omg why!111
     
  4. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,505
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    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).
     
  5. Eagle XI

    Eagle XI

    Joined:
    Mar 9, 2012
    Messages:
    1,359
    Resources:
    117
    Models:
    2
    Icons:
    109
    Packs:
    4
    Skins:
    2
    Resources:
    117
    Probably i could, but is that what i wanted to do ?
    Nope.

    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.
     
  6. 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.
     
  7. Shar Dundred

    Shar Dundred

    Map Moderator

    Joined:
    May 6, 2009
    Messages:
    4,498
    Resources:
    12
    Packs:
    1
    Maps:
    10
    Tutorials:
    1
    Resources:
    12
    Shouldn't something as easy as this work?
     

    Attached Files:

    • test.JPG
      test.JPG
      File size:
      40.1 KB
      Views:
      166
  8. Eagle XI

    Eagle XI

    Joined:
    Mar 9, 2012
    Messages:
    1,359
    Resources:
    117
    Models:
    2
    Icons:
    109
    Packs:
    4
    Skins:
    2
    Resources:
    117
    ^
    yepp. That would function. It only has to be extended such that in the latter case the item in shop doesnt enter cooldown in that case and player gets refunded resources spent on the purchase.
     
  9. Shar Dundred

    Shar Dundred

    Map Moderator

    Joined:
    May 6, 2009
    Messages:
    4,498
    Resources:
    12
    Packs:
    1
    Maps:
    10
    Tutorials:
    1
    Resources:
    12
    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.