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

Randomizing picked variables when spawning unit issue

Status
Not open for further replies.
Level 2
Joined
Mar 1, 2020
Messages
7
So I've been trying to turn this into a variable system to make the triggers more effective. When this trigger is activated, it spawns 2 different types of farms with random quantities at a location. At minimum 1 of farm B and 1 of farm C spawn, with a maximum of 3 of each type for 6 total.

wc3capture.PNG


I tried to set it up using variables. So I build the array of the two different types of Farms.
districtspawnwc31.PNG


The problem I am having is that, I can get the farm to spawn with the trigger, but it doesn't randomize the quantity. It will also pick either FARM A or FARM B from the array, but not mix both types.

districtspawnwc3.PNG


I've spent several hours fooling around with the trigger at the bottom. I'd like it to spawn like the first trigger but utilizing the arrays so I can scale up its usage later.
 

Attachments

  • wc3 mapping.PNG
    wc3 mapping.PNG
    31.1 KB · Views: 18
  • wc3 mapping.PNG
    wc3 mapping.PNG
    31.1 KB · Views: 25
Level 5
Joined
Jun 12, 2018
Messages
148
Hi Cribsoffer,

The "Unit - Create..." function is what is wrong with your trigger, I've provided a screenshot explaining what you should change. Note that if you are using the same position to random X units, they will mostly overlap in a random way.
 

Attachments

  • fix.png
    fix.png
    29.1 KB · Views: 22
Level 2
Joined
Mar 1, 2020
Messages
7
Thank you, I'm going to see if I can put this fix into place and will update from there.

In the script -> call RemoveLocation(udg_MYVAR)

Do i replace the MYVAR with the name of said variable?
 
Level 5
Joined
Jun 12, 2018
Messages
148
Yes, "udg_" prefix just means your variable is global, every variable is global when using the GUI variable editor.
 
Status
Not open for further replies.
Top