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

Item consumption based on Rune Area effect adds bonus stats to all units in range?

Level 5
Joined
Nov 17, 2022
Messages
84
So, new question. I'm starting to get items crafted for my horse survival map, idea is there would be food sources scattered all over the map. Its based on the runes currently so that way when a horse consumes the item, the entire herd gets the spoils too. However, I'd like to take it farther. I see there's a method for setting a trigger up so that one unit can get a + effect but I can't seem to find anything that factors units in range. Since ideally I'd like to have it that when a unit consumes the item, the units in range [your herd, since idea is you can buff your herdmates up as well for better breeding/survival] also get the buff, i.e, +1 HP, +1 Mana, +1 Attack permanently, so on and so forth. Anyone have an idea how I can accomplish this?

Also, is there a way to factor the spawning in of items based on horse population size perhaps of player owned horses? I notice in my tests the map gets overflowing in items too fast and makes it too easy.
 
Level 11
Joined
Nov 15, 2007
Messages
800
  • Set VariableSet Temp_Point = (Position of (Triggering unit))
  • Set VariableSet UnitGroup = (Units within 1200.00 of Temp_Point matching (((Matching unit) belongs to an ally of (Owner of (Triggering unit)).) Equal to True).)
  • Unit Group - Pick every unit in UnitGroup and do (Actions)
    • Loop - Actions
      • Unit - Set Max HP of (Picked unit) to ((Max HP of (Picked unit)) + 1)
      • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 1.00)
 
Level 5
Joined
Nov 17, 2022
Messages
84
  • Set VariableSet Temp_Point = (Position of (Triggering unit))
  • Set VariableSet UnitGroup = (Units within 1200.00 of Temp_Point matching (((Matching unit) belongs to an ally of (Owner of (Triggering unit)).) Equal to True).)
  • Unit Group - Pick every unit in UnitGroup and do (Actions)
    • Loop - Actions
      • Unit - Set Max HP of (Picked unit) to ((Max HP of (Picked unit)) + 1)
      • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 1.00)
Thanks! This will help me lots.
 
Level 25
Joined
Mar 29, 2020
Messages
1,466
Also, is there a way to factor the spawning in of items based on horse population size perhaps of player owned horses? I notice in my tests the map gets overflowing in items too fast and makes it too easy.
you could do something like -

every X minutes/seconds -

randNum = generate a random number between 1 and 100. (or whatever number makes sense as the max in your game)
herdSize = number of horses currently in herd.

if (herdSize>randNum)
then -> spawn item.

--------------------

another way you could do it could be to have different triggers with the different spawn types. then have one controlling periodic trigger that checks the herd size and turns on the right trigger according to the size (and off the ones you no longer want to be active).
 
You can also track number of items in game, doing something along these lines:
integer variable: numberOfFood = 0

When spawning food: numberOfFood = numberOfFood + 1

When "picking up item food": numberOfFood = numberOfFood - 1

Then you can limit number of possible food when spawning to 10 + 0.5 * herdSize (I.E. NOT spawning food if number of food is bigger than something like this. Of course values needs to be adjusted to something reasonable for your map). Or if it's above this value, then lower spawn-chance of food to 5%, or something like that.
 
Top