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

[General] Another question regarding a mechanism I can't get to work

Level 5
Joined
Nov 17, 2022
Messages
84
So probably an odd one in hindsight but its a simulator type game lol Decided I wanted to plan out a game about horses where you play as a lead stallion gathering mares and building a herd by collecting herd members you find on the map, you also breed horses to get foals. Winner is the stallion who takes out the rest of the other lead stallions and their herds to become the sole lead stallion and herd of the map.

However, there's a few mechanisms I was wondering if anyone had answers for. I've been experimenting with different ideas to do a breeding system for the horses, so your lead stallion fathers foals with the mares you collect in order to raise your horse army to destroy your rivals' herds. I was referencing Sheep Farmer's method that uses the transport method to make a pretend pregnancy but while I can get the action to work, as in, spawn the unborn horse to load the unit into the transport, the game never spawns the real foal after or destroys the unborn foal. So, I'm really stuck on how to proceed. Ideally as well each foal would spawn randomly from each breeding, so there'd be different types with colors being a determining factor on what spells/stats the foal is born with, the mare itself might be a factor but idk how complex I want to get. So for example a chestnut foal being a healer based horse or a black foal being a tank based horses, so on and so forth.

This stuff tho is just extra flavor, I gotta get the breeding system itself up and working first before I dig even deeper. This is the current trigger system I came up with so far. I'll post both a screencap and a copy paste version. Breed Foals does work but I gotta find out how to factor it for future different number of players, mare types and stallion types. The idea in brief I got is using transport to make a fake pregnancy, it loads a unborn horse but then the unborn horse is removed once its mana reaches 100 and the real foal is "born". I also want to know if there's a way to make it so transport isn't selectable or cancelable by the player, else the system won't really work as intended at all.

If anyone has any answers, I'd be grateful! Sorry for the long drawn out paragraphs, I wanted to be detailed. I got another few questions but I'll save them for another time so I don't eat up more space or overwhelm anyone.

1723075008727.png


breed foals
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Father Foals
And - All (Conditions) are true
Conditions
(Unit-type of (Triggering unit)) Equal to Stallion
(Unit-type of (Target unit of ability being cast)) Equal to Mare
Actions
Unit Group - Add (Target unit of ability being cast) to pregnantmares
Unit - Create 1 Unborn Horse for Player 1 (Red) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
Unit - Order (Target unit of ability being cast) to Load (Last created unit)
Unit Group - Add (Loading unit) to unbornfoals

1723075162617.png


foal birth
Events
Time - Every 2.00 seconds of game time
Conditions
(Mana of (Loading unit)) Equal to 100.00
(Number of units in pregnantmares) Greater than 0
Actions
Unit - Kill (Loading unit)
Unit Group - Pick every unit in pregnantmares and do (Unit - Create 1 Foal for Player 1 (Red) at (Position of (Transporting unit)) facing Default building facing degrees)
Animation - Play (Transporting unit)'s death animation
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
1) You don't need to use And - All Conditions Are True in your Conditions, that's the default behavior. Think about how you've setup foal birth, it doesn't have an And yet both of those Conditions need to be true for the Actions to run.

2) Checking the (Mana of (Loading unit)) every 2.00 seconds is not going to work. That unit can change at any given moment so there's no guarantee that it's the unit you care about. Furthermore, it only works for one unit a time -> the most recent unit to be loaded into a transport. The same issues occur when referencing the (Transporting unit).

3) You have to be careful with your use of Event Responses. You should not be referencing Event Responses that were set in Trigger A in Trigger B after time has passed. Event Responses are essentially tied to the trigger that "set" them and should really only be used within that scope. Also, some Event Responses are lost after any amount of time has passed. Time passing includes any event found in the Time category and the use of the Wait action.

4) Adding to #3, you're using the wrong Event Responses in a few places. For example, (Picked unit) is meant to be used in combination with a Pick Every Unit action. (See my triggers below to get a better understanding of this)

5) This is me half joking but, "pregnantmares", I hope that's not going to be your naming convention for the rest of your variables :p It burns us!

6) You almost always want to use "A unit STARTS the effect of an ability" as your ability Event. This occurs when the ability is successfully cast, unlike "Begins casting" which occurs during the preparation stage, which can be interrupted. If you want to speed up the time it takes for your Units to cast spells, go into the Object Editor and change your unit's Art - Animation - Cast Point value. Setting this to 0.00 will make the Unit cast spells without any delay. The Art - Animation - Cast Backswing is how long the unit continues playing it's cast animation once finished.

7) Dead units are not removed automatically from Unit Groups. You need to manage this yourself! (See my triggers for an example)

Anyway, remember those Age triggers in that previous thread about the Sheep. You could apply that very same logic for this system.

Revised first trigger:
  • breed foals
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Father Foals
      • (Unit-type of (Triggering unit)) Equal to Stallion
      • (Unit-type of (Target unit of ability being cast)) Equal to Mare
    • Actions
      • Unit - Create 1 Unborn Horse for (Triggering player) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to Unborn_Foals
      • Set Variable Mother[(Custom value of (Last created unit))] = (Target unit of ability being cast)
      • Unit - Order (Target unit of ability being cast) to Load (Last created unit)
Revised second trigger:
  • foal birth
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Unborn_Foals and do (Actions)
        • Loop - Actions
          • Set Variable Unborn_Horse = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of Unborn_Horse) Equal to 100.00
            • Then - Actions
              • Unit - Play Mother[(Custom value of Unborn_Horse)]'s death animation
              • Unit - Queue Mother[(Custom value of Unborn_Horse)]'s stand animation
              • Unit Group - Remove Unborn_Horse from Unborn_Foals
              • Unit - Kill Unborn_Horse
              • Unit - Create 1 Foal for (Owner of Unborn_Horse) at (Position of Unborn_Horse) facing default building degrees
            • Else - Actions
Then I'm not sure what you want to do if the Player unloads a premature horse. I guess kill it?
  • Transport Enter
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
    • Actions
      • Unit Group - Add (Triggering unit) to Transported_Units
      • Set Variable Transport_Count = (Transport_Count + 1)
      • Trigger - Turn on Transport Leave <gen>
  • Transport Leave
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Transported_Units and do (Actions)
        • Loop - Actions
          • Set Variable Transport_Unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Transport_Unit is being transported) Equal to False
            • Then - Actions
              • -------- Check if it was an unborn horse that was unloaded prematurely --------
              • Trigger - Run Unborn Horse Is Unloaded (checking conditions)
              • -------- --------
              • Unit Group - Remove Transport_Unit from Transported_Units
              • Set Variable Transport_Count = (Transport_Count - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Transport_Count Equal to 0)
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
  • Unborn Horse Is Unloaded
    • Events
    • Conditions
      • (Unit-type of Transport_Unit) Equal to Unborn Horse
      • (Mana of Transport_Unit) Less than 100.00
    • Actions
      • -------- Life's a bitch --------
      • Unit Group - Remove Transport_Unit from Unborn_Foals
      • Unit - Kill Transport_Unit
There's no "A unit is UNLOADED from a transport" Event so this became extra complicated, lol.


Here's how you can post your triggers:
 
Last edited:
Level 5
Joined
Nov 17, 2022
Messages
84
1) You don't need to use And - All Conditions Are True in your Conditions, that's the default behavior. Think about how you've setup foal birth, it doesn't have an And yet both of those Conditions need to be true for the Actions to run.

2) Checking the (Mana of (Loading unit)) every 2.00 seconds is not going to work. That unit can change at any given moment so there's no guarantee that it's the unit you care about. Furthermore, it only works for one unit a time -> the most recent unit to be loaded into a transport. The same is true for referencing the (Transporting unit).

3) You have to be careful with your use of Event Responses. You should not be referencing Event Responses that were set in Trigger A in Trigger B after time has passed. Event Responses are essentially tied to the trigger that "set" them and should really only be used within that scope. Also, some Event Responses are lost after any amount of time has passed, this includes any event found in the Time category and the use of the Wait action.

4) Adding to #3, you're using the wrong Event Responses in a few places. For example, (Picked unit) is meant to be used in combination with a Pick Every Unit action. (See my triggers below to get a better understanding of this)

5) This is me half joking but, "pregnantmares", I hope that's not going to be your naming convention for the rest of your variables :p It burns us!

6) You almost always want to use "A unit STARTS the effect of an ability" as your ability Event. This occurs when the ability is successfully cast, unlike Begins which occurs during the preparation stage, which can be interrupted. If you want to speed up the time it takes for your Units to cast spells, go into the Object Editor and change your unit's Art - Animation - Cast Point value. Setting this to 0.00 will make the Unit cast spells without an initial delay. The Art - Animation - Cast Backswing is how long the unit continues playing it's cast animation once finished.

7) Dead units are not automatically removed from Unit Groups. You need to manage this yourself! (See my triggers for an example)

Anyway, remember how I showed you the Age triggers in that previous post with the Sheeps/Lambs/Rams. You could apply that very same logic for this system.

Revised first trigger:
  • breed foals
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Father Foals
      • (Unit-type of (Triggering unit)) Equal to Stallion
      • (Unit-type of (Target unit of ability being cast)) Equal to Mare
    • Actions
      • Unit - Create 1 Unborn Horse for (Triggering player) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to Unborn_Foals
      • Set Variable Mother[(Custom value of (Last created unit))] = (Target unit of ability being cast)
      • Unit - Order (Target unit of ability being cast) to Load (Last created unit)
Revised second trigger:
  • foal birth
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Unborn_Foals and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of (Picked unit)) Equal to 100.00
            • Then - Actions
              • Unit - Play Mother[(Custom value of (Picked unit))]'s death animation
              • Unit - Queue Mother[(Custom value of (Picked unit))]'s stand animation
              • Unit Group - Remove (Picked unit) from Unborn_Foals
              • Unit - Kill (Picked unit)
              • Unit - Create 1 Foal for (Owner of (Picked unit)) at (Position of (Picked unit) facing default building degrees
            • Else - Actions
Then I'm not sure what you want to do if the Player unloads a premature horse. I guess kill it?
  • Events
    • Unit - A unit is Unloaded from a transport
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Unborn Horse
    • (Mana of (Triggering unit)) Less than 100.00
  • Actions
    • -------- Life's a bitch --------
    • Unit Group - Remove (Triggering unit) from Unborn_Foals
    • Unit - Kill (Triggering unit)

Here's how you can post your triggers:
1. Oh, okay. I don't know why I keep making that mistake with my triggers because I feel like I've been told that before.

2. That is really good information to know, I hadn't realized that it only checks for one unit per thing.

3. So basically treat each trigger as its own separate thing? I'll have to make a note of that. Though I get confused how continuous events transverse in this regard, so I get this part mixed up a lot.

4. OH. That explains a lot! I was under the impression it meant like an owned unit or something like that. Thanks for clarifying, so its a buddy for when it has a linked up unit group attached to it? Makes sense.

5. Lol in my defense I've only been making map stuff for like two months now, and my triggers in my other map I'm taking a break from due to burn out are ten times worse named and organized than this, you would all be so upset seeing them haha.

6. Thanks for this tip as well! I will log that in for the future. The phrasing for a lot of stuff in triggers makes me confused sometimes, so this is a good clarification for me.

7. Ooo, okay, another good thing to tell me. I hadn't realized that as well. I got so much to learn.

This is a good revision and feels more clear on what should be going on than what I was trying to brute force, so thank you. Also I defs keep looking at the ram and sheep thing you helped me with earlier, though I will admit since I'm still really new to triggers I got confused but that's my own fault of being inexperienced while recreating/creating triggers.

Also! For the variable mother, what sorta variable is it if you don't mind me asking? i.e, unit group, type, timer, etc, that sorta thing? And same goes for the unit queue mother, if you don't mind me asking, should I make multiple units in this trigger for the mare?

And thank you again for the response lol also I can't help but read all your posts in Uncle's voice haha
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Mother is a Unit array variable. You can tell it's a Unit variable because of it's value.

For example, here are a bunch of variables being set:
  • Set Variable RandomVariable1 = 100
  • Set Variable RandomVariable2 = False
  • Set Variable RandomVariable3 = 45.67
  • Set Variable RandomVariable4 = (Last created unit)
We can infer the type of variable based on what it's equal to.

RandomVariable1 = Integer, a whole number.
RandomVariable2 = Boolean, a true or false.
RandomVariable3 = Real, a fractional number.
RandomVariable4 = Unit, you can see this word being used in the value.

If they have brackets after their name [] then you know that they're Arrays (there's a little checkbox to enable this when creating a variable).

Obviously you must first know what a Boolean is to fully understand this. But by searching through the Trigger Editor, looking at the different Variable Types and their default Values, looking at the Conditions (Boolean Comparison, Integer Comparison, Unit Comparison) etc, you can figure this out on your own without needing to ask anyone. That's how I learned, trial and error and lots of digging around.

Edit:
Note that the above triggers (at least the one's using Mother) rely on the same Unit Indexer system that I suggested in that previous Sheep thread. Without this system copied into your map they will NOT work properly.
 
Last edited:
Level 5
Joined
Nov 17, 2022
Messages
84
Mother is a Unit array variable. You can tell it's a Unit variable because of it's value.

For example, here are a bunch of variables being set:
  • RandomVariable1 = 100
  • RandomVariable2 = False
  • RandomVariable3 = 45.67
  • RandomVariable4 = (Last created unit)
We can infer the type of variable based on what it's equal to.

RandomVariable1 = Integer, a whole number.
RandomVariable2 = Boolean, a true or false.
RandomVariable3 = Real, a fractional number.
RandomVariable4 = Unit, you can see this word being used in the value.

If they have brackets after their name [] then you know that they're Arrays (there's a little checkbox to enable this when creating a variable).

Obviously you must first know what a Boolean is to fully understand this. But by searching through the Trigger Editor, looking at the different Variable Types and their default Values, looking at the Conditions (Boolean Comparison, Integer Comparison, Unit Comparison) etc, you can figure this out on your own without needing to ask anyone. That's how I learned, trial and error and lots of digging around.

Edit:
Note that the above triggers (at least the one's using Mother) rely on the same Unit Indexer system that I suggested in that previous Sheep thread.
I see! That's some good tips to remember, makes picking out what they are a bit easier.

Yeah, so far I've been digging at the editor, I try holding off on asking questions just because teaching myself more independence but I get stumped really fast and easy sometimes lol

Is there any way you can include this horse and sheep stuff you did in a custom map so I can dig at the guts more? I'm a hands on learner myself and its been how I've been teaching myself triggers by examining how stuff works and then recreating it best I can to educate myself. If not, its okay as well.

Again, thank you for the educational answers here.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I can probably upload a demo map tomorrow, although I'm not 100% sure what you want me to put in it.

At the moment I would probably just add:
1) The above triggers.
2) A way for a Foal to age into an adult.

Do Foals have genders? I'd guess not until they're adults. So they sort of "evolve" into a male or female at adulthood.
 
Last edited:
Level 5
Joined
Nov 17, 2022
Messages
84
I can probably upload a demo map tomorrow, although I'm not 100% sure what you want me to put in it.

At the moment I would probably just add:
1) The above triggers.
2) A way for a Foal to age into an adult.

Do Foals have genders? I'd guess not until they're adults. So they sort of "evolve" into a male or female at adulthood.
Whenever you wanna do it, I don't mind waiting.

Those two triggers would be perfectly fine, the other stuff I'm gonna explore later and can probably figure out on my own I think, since in theory should be simpler than this stuff was for me. Its gonna be how claiming [unaffiliated horses]/stealing [from other players] mares goes about, so would be linked to rng or item or something, and possibly claiming/stealing food sources for the horses.

The foals don't have genders nah, since simpler. Whether they age into a gender yet, I am not sure just because might be more complex and I am not sure how to go about making a trigger for gender assignment. I know as of now I got planned is like the mares, the lead stallion and the foal types at the very least.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
It wouldn't be all that complicated. In my Sheep example I was tracking Gender in a variable but you can just have separate Unit-Types:
  • -------- When the Foal is ready to mature to adulthood --------
  • Set Variable RNG = (Random integer number between 1 and 2)
  • If all conditions are true then do actions
    • If - Conditons
      • RNG Equal to 1
    • Then - Actions
      • Unit - Replace Foal with Mare...
    • Else - Actions
      • Unit - Replace Foal with Stallion...
You can adjust the math to anything you want. Maybe you'd want Mares to have a 90% chance or something since the Stallion is more important.
  • Set Variable RNG = (Random integer number between 1 and 10)
  • If all conditions are true then do actions
    • If - Conditons
      • RNG Less than or equal to 9
    • Then - Actions
      • Unit - Replace Foal with Mare...
    • Else - Actions
      • Unit - Replace Foal with Stallion...
 
Level 5
Joined
Nov 17, 2022
Messages
84
It wouldn't be all that complicated. In my Sheep example I was tracking Gender in a variable but you can just have separate Unit-Types:
  • -------- When the Foal is ready to mature to adulthood --------
  • Set Variable RNG = (Random integer number between 1 and 2)
  • If all conditions are true then do actions
    • If - Conditons
      • RNG Equal to 1
    • Then - Actions
      • Unit - Replace Foal with Mare...
    • Else - Actions
      • Unit - Replace Foal with Stallion...
You can adjust the math to anything you want. Maybe you'd want Mares to have a 90% chance or something since the Stallion is more important.
  • Set Variable RNG = (Random integer number between 1 and 10)
  • If all conditions are true then do actions
    • If - Conditons
      • RNG Less than or equal to 9
    • Then - Actions
      • Unit - Replace Foal with Mare...
    • Else - Actions
      • Unit - Replace Foal with Stallion...
That does seem simpler than I was expecting, do you think you could include this in the test map to if you do it?
Also would this work if I end up doing a bunch of foal units, since I had ideas of having foals be born and based on their colors, could get abilities or different stats. Only mares that would be used to breed these foals tho would be the ones you find on the map or steal from other players, so gives them more importance to keep alive and find.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
That does seem simpler than I was expecting, do you think you could include this in the test map to if you do it?
Also would this work if I end up doing a bunch of foal units, since I had ideas of having foals be born and based on their colors, could get abilities or different stats. Only mares that would be used to breed these foals tho would be the ones you find on the map or steal from other players, so gives them more importance to keep alive and find.
Here's a demo map. It contains a system called GUI Unit Event which gives you access to custom Events that the default Trigger Editor is missing. This system also includes a Unit Indexer (it requires it) so it's really two systems in one.

My triggers take advantage of both systems.

Edit: Fixed some typos in the map. Mainly trigger names.
 

Attachments

  • Horse Sim 1.w3m
    40.3 KB · Views: 5
Last edited:
Level 5
Joined
Nov 17, 2022
Messages
84
Here's a demo map. It contains a system called GUI Unit Event which gives you access to custom Events that the default Trigger Editor is missing. This system also includes a Unit Indexer (it requires it) so it's really two systems in one.

My triggers take advantage of both systems.

Edit: Fixed some typos in the map. Mainly trigger names.
also for some reason I can't seem to download the map.
edit: nvm got it nowww
 
Last edited:
Level 5
Joined
Nov 17, 2022
Messages
84
Here's a demo map. It contains a system called GUI Unit Event which gives you access to custom Events that the default Trigger Editor is missing. This system also includes a Unit Indexer (it requires it) so it's really two systems in one.

My triggers take advantage of both systems.

Edit: Fixed some typos in the map. Mainly trigger names.
I managed to recreate what you made up for me last night that isn't from the map you gave me here also [and it works!] but I was curious, for the animation part, it works but I noticed if there's more than one pregnant mare, then only one mare will do the death animation for every foal's birth even if she hasn't finished with her own unborn foal yet, is there a way to prevent this and make it so all the mares animate correctly?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I managed to recreate what you made up for me last night that isn't from the map you gave me here also [and it works!] but I was curious, for the animation part, it works but I noticed if there's more than one pregnant mare, then only one mare will do the death animation for every foal's birth even if she hasn't finished with her own unborn foal yet, is there a way to prevent this and make it so all the mares animate correctly?
Sounds like you don't have a Unit Indexer in your map. Everything I made is tested and working.
 
Level 5
Joined
Nov 17, 2022
Messages
84
Sounds like you don't have a Unit Indexer in your map. Everything I made is tested and working.
Yeah like what you made on the test map works perfectly, I more so meant the stuff you made earlier with the GUI triggers you posted for me. I managed to recreate them last night after a lot of eyeballing and it was good practice for me.
Also if I include some sorta Unit Indexer here it'll fix the animation issue then?
I was also curious if you had any idea how I can make it so the foals being born aren't always the same unit, since I had an idea that the foals come in different colors and that color determines its stats and spells but I can't seem to find a way to rng foal type with the birth.

  • Breeding Horses
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Father Foals (Breed Foals)
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Stallion
          • (Unit-type of (Triggering unit)) Equal to Stallion [Palomino]
          • (Unit-type of (Target unit of ability being cast)) Equal to Mare
          • (Unit-type of (Target unit of ability being cast)) Equal to Mare [Paint]
          • (Unit-type of (Target unit of ability being cast)) Equal to Mare [Donkey]
    • Actions
      • Unit - Create 1 Unborn Horse for (Triggering player) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to Unborn_Foals
      • Set VariableSet Mother[(Custom value of (Last created unit))] = (Target unit of ability being cast)
      • Unit - Order (Target unit of ability being cast) to Load (Last created unit)
  • Foal Births
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Unborn_Foals and do (Actions)
        • Loop - Actions
          • Set VariableSet Unborn_Horse = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of Unborn_Horse) Equal to 100.00
            • Then - Actions
              • Animation - Play Mother[(Custom value of Unborn_Horse)]'s death animation
              • Animation - Queue Mother[(Custom value of Unborn_Horse)]'s stand animation
              • Unit Group - Remove Unborn_Horse from Unborn_Foals.
              • Unit - Kill Unborn_Horse
              • Unit - Create 1 Foal for (Owner of Unborn_Horse) at (Position of Unborn_Horse) facing Default building facing degrees
            • Else - Actions
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Without a Unit Indexer the Mother variable won't work properly. This is because it depends on the Custom Value of the Unborn Horse which is going to be 0 by default. The job of the Unit Indexer is to give each Unit a different Custom Value thus allowing your Array variables to essentially "attach" data to multiple Units at a time. So until you fix this the last Mare to get pregnant will be considered the "universal" Mother for all Unborn Horses.

Anyway, it might be wise to handle the random colors/abilities using variables rather than different Unit-Types:
  • Events
    • Unit - A unit Enters (Playable map area)
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Mare
  • Actions
    • Set Variable X = (Random integer number between 1 and 3)
    • Animation - Change (Triggering unit)'s vertex coloring to (Random_Red[X]%, Random_Green[X]%, Random_Blue[X]%) with 0.00% transparency
    • Unit - Add Random_Ability[X] to (Triggering unit)
  • Events
    • Time - Elapsed game time is 0.00 seconds
  • Conditions
  • Actions
    • Set Variable Random_Red[1] = 100.00
    • Set Variable Random_Green[2] = 100.00
    • Set Variable Random_Blue[3] = 100.00
    • Set Variable Random_Ability[1] = Flame Strike
    • Set Variable Random_Ability[2] = Evasion
    • Set Variable Random_Ability[3] = Blizzard
If your random number (X) is equal to 1 then the Mare will be colored Red and use the Flame Strike ability.
X = 2 will be Green and use Evasion.
X = 3 will be Blue and use Blizzard.
 
Level 5
Joined
Nov 17, 2022
Messages
84
Without a Unit Indexer the Mother variable won't work properly. This is because it depends on the Custom Value of the Unborn Horse which is going to be 0 by default. The job of the Unit Indexer is to give each Unit a different Custom Value thus allowing your Array variables to essentially "attach" data to multiple Units at a time. As of right now only the most recent Mare to get pregnant will be considered the Mother.

It might be wise to handle the random colors/abilities using variables rather than different Unit-Types:
  • Events
    • Unit - A unit Enters (Playable map area)
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Mare
  • Actions
    • Set Variable X = (Random integer number between 1 and 3)
    • Animation - Change (Triggering unit)'s vertex coloring to (Random_Red[X]%, Random_Green[X]%, Random_Blue[X]%) with 0.00% transparency
    • Unit - Add Random_Ability[X] to (Triggering unit)
  • Events
    • Time - Elapsed game time is 0.00 seconds
  • Conditions
  • Actions
    • Set Variable Random_Red[1] = 100.00
    • Set Variable Random_Green[2] = 100.00
    • Set Variable Random_Blue[3] = 100.00
    • Set Variable Random_Ability[1] = Flame Strike
    • Set Variable Random_Ability[2] = Evasion
    • Set Variable Random_Ability[3] = Blizzard
How would I go about making a unit indexer, sorry if the question is a dumb one, I'm winging it as I go and learning along the way.
And these variables with the spells and colors would effect foal birth types then? That's really neat.
I know a reason I mentioned unit types is because the colors currently are model based, since downloaded a really nice horse model off the hive with different pelt types.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
You would copy it from the map I posted earlier. I created a folder called "3rd Party Systems" and placed it in there so just copy the whole folder over. There's also comments throughout stating that you need this for the triggers to work as well as answers to your other questions.
 
Level 5
Joined
Nov 17, 2022
Messages
84
You would copy it from the map I posted earlier. I created a folder called "3rd Party Systems" and placed it in there so just copy the whole folder over. There's also comments throughout stating that you need this for the triggers to work as well as answers to your other questions.
Okay, and Thank you again for the help and resources.
 
Top