• 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] Question regarding RNG for unit skins!

Level 5
Joined
Nov 17, 2022
Messages
84
So! I'm doing a horse simulator like game that has breeding. The foals all have unique models so currently every stallion, mare and foal have different models and are different units in order to represent themselves with different colored pelts. However, whilst messing with the trigger editor I noticed there's an option for setting up a unit skin. Currently, the foals, mares and stallions spawn in by color via RNG thanks to our handy dandy friend variables.

I had a thought about setting up these random colored horses via skins since would probably make organizing and micro management of units much easier on players if they were all three units for example instead of a larger number.

However, I don't see a way to set up specific skin types like you can the units when getting RNG set up for a trigger. Anyone got any ideas how I can do this?
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
I assume you mean the "Unit - Set Unit Skin" action? If so, there is a way to use it and it kind of works, although it has some quirks.
First of all, the action requires you to specify unit-type of existing unit in Object Editor data. The default 'Hamg' is the unit type id of Human Archmage.
As with other new actions that Blizz rushed, the action is not set up properly for use in GUI triggers:
  • The action requires unit-type ID (an integer variable), but GUI trigger editor is using unit-type variables.
  • The action uses default value 'Hamg', but GUI trigger editor does not allow you to input FourCC code.
  • The string-to-int GUI function FourCC throws "undeclared function" error.

But there is a way using a bit of jass/lua script:
  • Create an integer variable, let's name it UnitTypeID
  • Create a unit-type variable, let's name it UnitType

Then you can use these actions to apply skin on a unit:
  • Set VariableSet UnitType = Blood Mage
  • Custom script: set udg_UnitTypeID = udg_UnitType
  • Unit - Set Unit Skin of Paladin 0001 <gen> to UnitTypeID
The actions do the following:
  • First action: assign target unit-type into variable. This is the unit-type whose skin will be set to your unit. In this case we will want a unit to have same skin as Blood Mage.
  • The custom script converts the unit-type from UnitType variable into an integer and assigns it into UnitTypeID variable. Note that upper/lower case letters must exactly match the name of your GUI variables.
  • Finally, the Blood Mage skin is applied a specific Paladin unit.

Final note: Applying skin does not only change targeted unit's model. It also changes its icon, sound, shadow, scaling, armor type (stone, flesh, metal) and even the model of its projectile art (if it is ranged unit). Basically most visual/audio things on the unit - everything that does not impact game (unit cost, unit stats, etc.)

Quirks: I've noticed that while it changes projectile art and armor type, it does not change weapon sound. It also does not work very well on heroes: there is an issue with selection circle, and while hero's unit-type icon changes when selecting units, it's portrait in the upper-left corner does not.
 
Level 5
Joined
Nov 17, 2022
Messages
84
I assume you mean the "Unit - Set Unit Skin" action? If so, there is a way to use it and it kind of works, although it has some quirks.
First of all, the action requires you to specify unit-type of existing unit in Object Editor data. The default 'Hamg' is the unit type id of Human Archmage.
As with other new actions that Blizz rushed, the action is not set up properly for use in GUI triggers:
  • The action requires unit-type ID (an integer variable), but GUI trigger editor is using unit-type variables.
  • The action uses default value 'Hamg', but GUI trigger editor does not allow you to input FourCC code.
  • The string-to-int GUI function FourCC throws "undeclared function" error.

But there is a way using a bit of jass/lua script:
  • Create an integer variable, let's name it UnitTypeID
  • Create a unit-type variable, let's name it UnitType

Then you can use these actions to apply skin on a unit:
  • Set VariableSet UnitType = Blood Mage
  • Custom script: set udg_UnitTypeID = udg_UnitType
  • Unit - Set Unit Skin of Paladin 0001 <gen> to UnitTypeID
The actions do the following:
  • First action: assign target unit-type into variable. This is the unit-type whose skin will be set to your unit. In this case we will want a unit to have same skin as Blood Mage.
  • The custom script converts the unit-type from UnitType variable into an integer and assigns it into UnitTypeID variable. Note that upper/lower case letters must exactly match the name of your GUI variables.
  • Finally, the Blood Mage skin is applied a specific Paladin unit.

Final note: Applying skin does not only change targeted unit's model. It also changes its icon, sound, shadow, scaling, armor type (stone, flesh, metal) and even the model of its projectile art (if it is ranged unit). Basically most visual/audio things on the unit - everything that does not impact game (unit cost, unit stats, etc.)

Quirks: I've noticed that while it changes projectile art and armor type, it does not change weapon sound. It also does not work very well on heroes: there is an issue with selection circle, and while hero's unit-type icon changes when selecting units, it's portrait in the upper-left corner does not.
Yeah, it's the trigger I was talking about.

This is good detailed information, so thanks. Additionally, is there a way to make sure the skin types randomize? The horses are basically the same model, just with different skins and other rng elements like influence on size and magic abilities.

So ideally I'd like to be able to have like one unit with multiple skins instead of multiple units with multiple skins like I'm doing now so that when the horses spawn in they're all different colored furs. Since foals, mares and stallions could easily be condensed into three models with many skins.
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
You will still need to define all possible variants of your horses as different types of units in Object Editor. For example you will need to have Foal (this will be the unit player will have in game) + its variants Foal (Black), Foal (Brown), Foal (White) - these are set up only for their skins exclusively, they would not appear in game.

To randomly choose one of those, create a unit-type variable and check its "Array" checkbox. In this example I will place all Foal variants into the array. The array variable will be called FoalTypes.
Also let's have a another variable, of type integer, called FoalTypeCount. This variable will hold the total number of Foal skin variants we can use.

Then you will need a trigger that runs on map initialization, like so:
  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet FoalTypes[1] = Foal (Black)
      • Set VariableSet FoalTypes[2] = Foal (Brown)
      • Set VariableSet FoalTypes[3] = Foal (White)
      • Set VariableSet FoalTypeCount = 3
Finally, in trigger where you want to apply one randomly selected skin out of the 3 skins, you do this:
  • Set VariableSet UnitType = FoalTypes[(Random integer number between 1 and FoalTypeCount)]
  • Custom script: set udg_UnitTypeID = udg_UnitType
  • Unit - Set Unit Skin of <your_foal_unit> to UnitTypeID
When you select FoalTypes variable in the first action, you will also have to select the index (an integer number) in the square brackets. Click it and use the function "Math - Random Number", there set the second argument (the max value) to variable FoalTypeCount.
This will effectively select random integer number between 1 and 3.

As previously mentioned, UnitType is a "unit-type" variable, while UnitTypeID is "integer" variable.
 
Level 5
Joined
Nov 17, 2022
Messages
84
You will still need to define all possible variants of your horses as different types of units in Object Editor. For example you will need to have Foal (this will be the unit player will have in game) + its variants Foal (Black), Foal (Brown), Foal (White) - these are set up only for their skins exclusively, they would not appear in game.

To randomly choose one of those, create a unit-type variable and check its "Array" checkbox. In this example I will place all Foal variants into the array. The array variable will be called FoalTypes.
Also let's have a another variable, of type integer, called FoalTypeCount. This variable will hold the total number of Foal skin variants we can use.

Then you will need a trigger that runs on map initialization, like so:
  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet FoalTypes[1] = Foal (Black)
      • Set VariableSet FoalTypes[2] = Foal (Brown)
      • Set VariableSet FoalTypes[3] = Foal (White)
      • Set VariableSet FoalTypeCount = 3
Finally, in trigger where you want to apply one randomly selected skin out of the 3 skins, you do this:
  • Set VariableSet UnitType = FoalTypes[(Random integer number between 1 and FoalTypeCount)]
  • Custom script: set udg_UnitTypeID = udg_UnitType
  • Unit - Set Unit Skin of <your_foal_unit> to UnitTypeID
When you select FoalTypes variable in the first action, you will also have to select the index (an integer number) in the square brackets. Click it and use the function "Math - Random Number", there set the second argument (the max value) to variable FoalTypeCount.
This will effectively select random integer number between 1 and 3.

As previously mentioned, UnitType is a "unit-type" variable, while UnitTypeID is "integer" variable.
I see! Currently I have something like that set up [its only for the spawning of the different models/units tho] but with the custom script it will result in being a skin instead of separate models/units then? Just what I need. You wrote this out so good, I think I should be able to pull this off then. Thank you very much for this guide, its exactly what I need. I'm gonna work on setting it up then.
 
Level 5
Joined
Nov 17, 2022
Messages
84
You will still need to define all possible variants of your horses as different types of units in Object Editor. For example you will need to have Foal (this will be the unit player will have in game) + its variants Foal (Black), Foal (Brown), Foal (White) - these are set up only for their skins exclusively, they would not appear in game.

To randomly choose one of those, create a unit-type variable and check its "Array" checkbox. In this example I will place all Foal variants into the array. The array variable will be called FoalTypes.
Also let's have a another variable, of type integer, called FoalTypeCount. This variable will hold the total number of Foal skin variants we can use.

Then you will need a trigger that runs on map initialization, like so:
  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet FoalTypes[1] = Foal (Black)
      • Set VariableSet FoalTypes[2] = Foal (Brown)
      • Set VariableSet FoalTypes[3] = Foal (White)
      • Set VariableSet FoalTypeCount = 3
Finally, in trigger where you want to apply one randomly selected skin out of the 3 skins, you do this:
  • Set VariableSet UnitType = FoalTypes[(Random integer number between 1 and FoalTypeCount)]
  • Custom script: set udg_UnitTypeID = udg_UnitType
  • Unit - Set Unit Skin of <your_foal_unit> to UnitTypeID
When you select FoalTypes variable in the first action, you will also have to select the index (an integer number) in the square brackets. Click it and use the function "Math - Random Number", there set the second argument (the max value) to variable FoalTypeCount.
This will effectively select random integer number between 1 and 3.

As previously mentioned, UnitType is a "unit-type" variable, while UnitTypeID is "integer" variable.
Also! Noob question, what variable would FoalTypeCount be? Like unit group, time, etc kinda deal? And how and where do I set up this custom script for the skins?
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
FoalTypeCount is integer :)

As for where to use it - I don't know your map. At some point, you somehow create a Foal. At that point of time you would want to assign it one of hte random skins, right? So use it there - I am assuming you are creating Foals via triggers... is that the case?
 
Level 5
Joined
Nov 17, 2022
Messages
84
FoalTypeCount is integer :)

As for where to use it - I don't know your map. At some point, you somehow create a Foal. At that point of time you would want to assign it one of hte random skins, right? So use it there - I am assuming you are creating Foals via triggers... is that the case?
Ok, got it ~

And yeah they're being made via triggers, currently it looks like this if you'd like context:

  • 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 - Remove classification of A sapper from Mother[(Custom value of Unborn_Horse)]
              • Unit - Set mana of Mother[(Custom value of Unborn_Horse)] to 0.00
              • Unit - Kill Unborn_Horse
              • Unit - Create 1 Foal_Types[(Random integer number between 1 and 6)] for (Owner of Unborn_Horse) at (Position of Unborn_Horse) facing Default building facing degrees
              • Set VariableSet Foal_Age[(Custom value of (Last created unit))] = 0
              • Unit - Set Unit Skin of (Last created unit) to (Skin ID of (Last created unit))
              • Unit - Add Foal_Spells[(Random integer number between 1 and 6)] to (Last created unit)
              • Unit - Add Wander (Neutral) to (Last created unit)
              • Unit - Set Armor of (Last created unit) to 0.00
              • Unit - Set Base Damage of (Last created unit) to 0 for weapon index: 0
              • Unit - Set Max Mana of (Triggering unit) to (Random integer number between 150 and 300)
              • Unit - Set Max HP of (Last created unit) to (Random integer number between 200 and 500)
              • Unit - Set Unit: (Last created unit)'s Integer Field: Defense Type ('udty') to Value: 0
              • Unit Group - Add (Last created unit) to Foal_Group
            • Else - Actions
Additionally, also, where do I click to create custom script? This'll be my first time doing something like it. The skin addition is a new thing, forgot to remove it since it was me experimenting before sending my question to The Hive here.
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
Yea, so instead of creating 1 "Foal_Types[(Random integer number between 1 and 6)]", you will always create the same unit type (the one on which you will apply skin) and then follow it up with what I've posted.

As for the "custom script" action, it is an action under "- General" section. If you have "- All" section selected, it should be the 3rd action in the list:
1723419372558.png
 
Level 5
Joined
Nov 17, 2022
Messages
84
Yea, so instead of creating 1 "Foal_Types[(Random integer number between 1 and 6)]", you will always create the same unit type (the one on which you will apply skin) and then follow it up with what I've posted.

As for the "custom script" action, it is an action under "- General" section. If you have "- All" section selected, it should be the 3rd action in the list:
View attachment 482707
Okay 👍 thank you so much again, you made this info really digestible too.
 
Level 5
Joined
Nov 17, 2022
Messages
84
Yea, so instead of creating 1 "Foal_Types[(Random integer number between 1 and 6)]", you will always create the same unit type (the one on which you will apply skin) and then follow it up with what I've posted.

As for the "custom script" action, it is an action under "- General" section. If you have "- All" section selected, it should be the 3rd action in the list:
View attachment 482707
I had help setting the triggers up since when I did it the program crashed and proceeded to mess my map up so had to reload a back up lmao so now skins do work but I noticed that there's some oddities that with my low skills idk how to point out to fix. Sometimes horses randomly change color, like when a new horse spawns in or are struck by spells. The foals often like to change skins instantly after birth. At one point I had a lead stallion shrink down to foal size and change color lol
1723443967600.png


1723445833758.png


Below, I'll share my triggers, I was curious if you had any insight on what went wrong. Mare spawn also only so fast because of testing purposes.

  • Spawn Mares
    • Events
      • Time - Every 6.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Mare [Chestnut] for Neutral Passive at (Center of Region 002 <gen>) facing Default building facing degrees
      • Set VariableSet Skintest = (Last created unit)
      • Custom script: call BlzSetUnitSkin(udg_Skintest, udg_Mare_Group[GetRandomInt(1,6)])
      • Animation - Change (Last created unit)'s size to ((Random real number between 80.00 and 120.00)%, 100.00%, 100.00%) of its original size
      • Unit - Add Foal_Spells[(Random integer number between 1 and 5)] to (Last created unit)
  • Stallions
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Player Group - Add Player 1 (Red) to Stallion_Players
      • Player Group - Add Player 2 (Blue) to Stallion_Players
      • Player Group - Add Player 3 (Teal) to Stallion_Players
      • Player Group - Add Player 4 (Purple) to Stallion_Players
      • Player Group - Add Player 5 (Yellow) to Stallion_Players
      • Player Group - Add Player 6 (Orange) to Stallion_Players
      • Player Group - Pick every player in Stallion_Players and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Unit - Create 1 Lead Stallion [Black] for (Picked player) at (Center of (Playable map area)) facing Default building facing degrees
              • Set VariableSet Skintest = (Last created unit)
              • Custom script: call BlzSetUnitSkin(udg_Skintest, udg_Stallion_Types[GetRandomInt(1,8)])
              • Hero - Set Name of (Last created unit) to (Name of (Owner of (Last created unit)))
              • Animation - Change (Last created unit)'s size to ((Random real number between 100.00 and 150.00)%, 100.00%, 100.00%) of its original size
            • Else - Actions
              • Do nothing
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Has left the game
            • Then - Actions
              • Unit Group - Pick every unit in (Units owned by (Picked player).) and do (Actions)
                • Loop - Actions
                  • Unit - Remove (Picked unit) from the game
            • Else - Actions
              • Do nothing
  • 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 - Remove classification of A sapper from Mother[(Custom value of Unborn_Horse)]
              • Unit - Set mana of Mother[(Custom value of Unborn_Horse)] to 0.00
              • Unit - Kill Unborn_Horse
              • Unit - Create 1 Foal [Chestnut] for (Owner of Unborn_Horse) at (Position of Unborn_Horse) facing Default building facing degrees
              • Custom script: call BlzSetUnitSkin(udg_Skintest, udg_Foal_Types[GetRandomInt(1,6)])
              • Set VariableSet Skintest = (Last created unit)
              • Set VariableSet Foal_Age[(Custom value of (Last created unit))] = 0
              • Unit - Add Foal_Spells[(Random integer number between 1 and 5)] to (Last created unit)
              • Unit - Set Max Mana of (Last created unit) to (Random integer number between 150 and 300)
              • Unit - Add Wander (Neutral) to (Last created unit)
              • Unit - Set Armor of (Last created unit) to 0.00
              • Unit - Set Unit: (Last created unit)'s Integer Field: Defense Type ('udty') to Value: 0
              • Unit - Set Base Damage of (Last created unit) to 0 for weapon index: 0
              • Unit - Set Base Damage of (Last created unit) to (Random integer number between 1 and 5) for weapon index: 0
              • Unit - Set Max HP of (Last created unit) to (Random integer number between 200 and 500)
              • Unit Group - Add (Last created unit) to Foal_Group
            • Else - Actions
 
Last edited:
Level 5
Joined
Nov 17, 2022
Messages
84
in your last trigger you are using the custom script that refers to the unit saved as udg_skintest before you are setting that as the last created unit. so all the stuff that's doing is happening to the previous unit that was saved as that variable, and not to the newly created one.
So to fix this should I move the custom script before the unit actually spawns in if I'm understanding correctly?
 
Level 5
Joined
Nov 17, 2022
Messages
84
There might be more to change, but I just meant reverse the order of these two:

  • empty.gif
    empty.gif
    line.gif
    join.gif
    page.gif
    Custom script: call BlzSetUnitSkin(udg_Skintest, udg_Foal_Types[GetRandomInt(1,6)])
  • empty.gif
    empty.gif
    empty.gif
    empty.gif
    line.gif
    join.gif
    set.gif
    Set VariableSet Skintest = (Last created unit)
Ooh OK
I'll try that and report back if the weird stuff goes away or not. 👍
 
Level 5
Joined
Nov 17, 2022
Messages
84
There might be more to change, but I just meant reverse the order of these two:

  • empty.gif
    empty.gif
    line.gif
    join.gif
    page.gif
    Custom script: call BlzSetUnitSkin(udg_Skintest, udg_Foal_Types[GetRandomInt(1,6)])
  • empty.gif
    empty.gif
    empty.gif
    empty.gif
    line.gif
    join.gif
    set.gif
    Set VariableSet Skintest = (Last created
Seems it's fixed I think, tho some spells seem to react oddly to the alt skins. Like used a spell that uses Impale as a base and this happens lol happens to the foals as well. Sorry for the quality and screaming of my laptop, I don't own any recording software.
 

Attachments

  • 20240812_152000.mp4
    76.3 MB
Level 5
Joined
Nov 17, 2022
Messages
84
Hard to say why that happens. You probably have some triggers that are fired when you cast your Woo spell, no? Post them here :D
Initially when I did testing the ability was based on rock throw until I realized the mares stay frozen forever, but their color skins didn't change lol so did my next test with impale as a basis but that's when I noticed the impale base spell seems to knock their skins right off lol so part of me thinks something about the impale spell is causing the issue.

  • Charm Mares
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Target unit of ability being cast)) Equal to Mare [Chestnut]
      • (Ability being cast) Equal to Woo Mare (Neutral Hostile)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 10) Less than or equal to 5
        • Then - Actions
          • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Triggering unit)) and Change color
        • Else - Actions
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Initially when I did testing the ability was based on rock throw until I realized the mares stay frozen forever
Setting the duration of most abilities to 0 will make them last indefinitely. If you want a projectile ability that doesn't stun you should use Acid Bomb, and for non-projectile abilities you can use Channel or a variety of skills that don't have hardcoded effect or durations.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
Initially when I did testing the ability was based on rock throw until I realized the mares stay frozen forever, but their color skins didn't change lol so did my next test with impale as a basis but that's when I noticed the impale base spell seems to knock their skins right off lol so part of me thinks something about the impale spell is causing the issue.
Impale has always been a troublemaker, you may need to settle with cutting certain content if it doesn't play nicely with all of your other systems.

That being said, you can always trigger your own custom impale, which should help avoid any "hardcoded" issues.

Oh and I suggest introducing more variables into your triggers. Referencing (Last created unit) ten times in a row is asking for trouble.
  • Unit - Create 1 horse...
  • Set Variable X = (Last created unit)
  • -------- Reference X from this point on --------
  • Unit - Replace some horse with...
  • Set Variable X = (Last replaced unit)
  • -------- Reference X from this point on --------
^ Just an example, name things accordingly, use unique variables to avoid issues.

Also, this Event is a troublemaker as well because it breaks the "trigger queue" rules:
  • Events
    • Unit - A unit Dies
Avoid reusing variables inside of it as you may accidentally overwrite them and end up with unexpected results.
 
Last edited:
Level 5
Joined
Nov 17, 2022
Messages
84
Impale has always been a troublemaker, you may need to settle with cutting certain content if it doesn't play nicely with all of your other systems.

That being said, you can always trigger your own custom impale, which should help avoid any "hardcoded" issues.

Oh and I suggest introducing more variables into your triggers. Referencing (Last created unit) ten times in a row is asking for trouble.
  • Unit - Create 1 horse...
  • Set Variable X = (Last created unit)
  • -------- Reference X from this point on --------
  • Unit - Replace some horse with...
  • Set Variable X = (Last replaced unit)
  • -------- Reference X from this point on --------
^ Just an example, name things accordingly, use unique variables to avoid issues.

Also, this Event is a troublemaker as well because it breaks the "trigger queue" rules:
  • Events
    • Unit - A unit Dies
Avoid reusing variables inside of it as you may accidentally overwrite them and end up with unexpected results.
What variable type would I use in order to set it as the last created unit btw?
And thanks for the tips once again!
 
Level 5
Joined
Nov 17, 2022
Messages
84
Last created unit <-- it's right there in the name of the thing you're dealing with ;)
I know that bit, I just meant the variable itself [in this case, X], is it like unit group, type, etc kinda thing? I'm still kind of bad at identifying what each variable is for integers without it being spelled out :"D
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
I know that bit, I just meant the variable itself [in this case, X], is it like unit group, type, etc kinda thing? I'm still kind of bad at identifying what each variable is for integers without it being spelled out :"D
A Variable can only keep track of one type of thing.

So note how we're creating a Unit in the first example:
  • Unit - Create 1 horse...
  • Set Variable X = (Last created unit)
  • -------- Reference X from this point on --------
So what type of Variable can keep track of the Last created unit? Note the word "Unit" being used in this example two times, I think that's a pretty big hint. The Action itself is categorized under the Unit category and the value of our Variable has the word Unit in it.

1723515975912.png

I'm confident that you could figure this out on your own if you:
1) Made an educated guess as to which variable you should use based on what's in front of you.
2) When that guess doesn't work, try another variable with a similar name.

I realize English may not be your first language so it's not as easy for you, and I hope this doesn't come off as offensive. I just think this is a good opportunity to experiment a little bit and learn from your mistakes. I also want to get the point across that the World Editor has it's own system of organization which should be understood and followed.
 
Last edited:
Level 5
Joined
Nov 17, 2022
Messages
84
A Variable can only keep track of one type of thing.

So note how we're creating a Unit in the first example:
  • Unit - Create 1 horse...
  • Set Variable X = (Last created unit)
  • -------- Reference X from this point on --------
So what type of Variable can keep track of the Last created unit? Note the word "Unit" being used in this example two times, I think that's a pretty big hint. The Action itself is categorized under the Unit category and the value of our Variable has the word Unit in it.

View attachment 482882
I'm confident that you could figure this out on your own if you:
1) Made an educated guess as to which variable you should use based on what's in front of you.
2) When that guess doesn't work, try another variable with a similar name.

I realize English may not be your first language so it's not as easy for you, and I hope this doesn't come off as offensive. I just think this is a good opportunity to experiment a little bit and learn from your mistakes. I also want to get the point across that the World Editor has it's own system of organization which should be understood and followed.
You don't sound offensive or rude at all, so no worries. You've been extremely helpful and accommodating in all your replies to me thus far so believe me, you are farrrrr from being offensive in the slightest.

So thank you again. I fiddle around a lot with the editor but I will admit I am a pretty slow learner and miss the obvious lol I try to avoid asking when I can since I wanna practice more independence with game design but sometimes I hit walls I can't climb over without some hand holding.
 
Top