• 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] Creating Random Unit Upon Unit Death

Status
Not open for further replies.
Level 14
Joined
Mar 27, 2008
Messages
1,003
Basically, I need help. I have randomly moving villagers (there are three types of villagers, all existing units are put in a group at map initialization) travelling through the map. The map is filled with dangerous creatures, and I need help creating a system that creates a villager of a random type (from one of the three types) and adds it to the group, and for that system to be consistently running upon whenever a villager dies.
 
Level 5
Joined
Jul 27, 2017
Messages
73
I´m not sure if you need GUI or Jass so here´s a GUI Trigger (correct names might be different):

Event
A Unit Dies
Condition (Possibility 1: You change the Point Value of every villager to 99)
Point-value of (Triggering Unit) equals 99 (integer comparision)

Possibility 2
(Unit-Type of (Triggering Unit) equals Villager (Male 1)) or ((Unittype of (Triggering Unit) equals Villager (Male 2)) or (Unittype of (Triggering Unit) equals Villager (Female)))
--> all Villagers are neutral passive campaign to spare searching them

Actions
Set int = (Random Integer between 1 and 10) (int is a global variable)
if(int < 4) then
Create 1 Villager (Male 1) for (Player) at (the Position) facing (some angle)
elseif (int > 7)
....

Unit Group - Add (Last Created Unit) to (your Unit Group)

i didn´t tested it but it should work.
 
Level 14
Joined
Mar 27, 2008
Messages
1,003
I´m not sure if you need GUI or Jass so here´s a GUI Trigger (correct names might be different):

Event
A Unit Dies
Condition (Possibility 1: You change the Point Value of every villager to 99)
Point-value of (Triggering Unit) equals 99 (integer comparision)

Possibility 2
(Unit-Type of (Triggering Unit) equals Villager (Male 1)) or ((Unittype of (Triggering Unit) equals Villager (Male 2)) or (Unittype of (Triggering Unit) equals Villager (Female)))
--> all Villagers are neutral passive campaign to spare searching them

Actions
Set int = (Random Integer between 1 and 10) (int is a global variable)
if(int < 4) then
Create 1 Villager (Male 1) for (Player) at (the Position) facing (some angle)
elseif (int > 7)
....

Unit Group - Add (Last Created Unit) to (your Unit Group)

i didn´t tested it but it should work.
Thank you so much for the help! +Rep it worked
 
Status
Not open for further replies.
Top