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

Player Shuffle Trigger?

Status
Not open for further replies.
Level 4
Joined
Mar 20, 2010
Messages
107
Like a units belonging to Player 1 switches team to Player 2, and vice verse? XD
Or just that all for example Footmen in Group 1 switches to Riflemen?
 
  • Player Group - Remove (player) from Force1
  • Player Group - Add (player) to Force2
  • Player Group - Pick every player in Force2 and do (Actions)
    • Loop - Actions
      • Player - Make (Picked player) treat (player) as an ally with shared vision
      • Player - Make (player) treat (Picked player) as an ally with shared vision
  • Player Group - Pick every player in Force1 and do (Actions)
    • Loop - Actions
      • Player - Make (Picked player) treat (player) as an enemy
      • Player - Make (player) treat (Picked player) as an enemy
You mean something like this?
 

Dr Super Good

Spell Reviewer
Level 65
Joined
Jan 18, 2005
Messages
27,290
Just make it dynamic.
Basically each start has certain units and such created for them.
The player for each start is selected randomly.
Both the start and the player is then removed from a list of available starts and it repeats.

If you have to use editor placed units, you can represent each start as a group (by picking all units of the start owner). You then choose a random player and then make all the units in the group to be owned by him and repeat again with both start and player removed. Any remaining players means you messed up game desin and any excess slots are removed (all units removed).
 

Dr Super Good

Spell Reviewer
Level 65
Joined
Jan 18, 2005
Messages
27,290
The programing way to do this is to have a list you loop through and then get random items from another list and combine them.

A list of players ingame is easy, this can be a force.
You then loop through the force (enum). For each player you choose one of the available slots (a list of groups which is an array going from 0 to number of groups which you choose the index at random as a random integer between 0 and the number of elements) and then give him all units of that group (an enum). You then remove that group from the list (slot of group = last element and reduce number of elements by 1). The loop repeats until every player has a group of units.

Finally any left over groups you enum through and remove or give to neutral hostile (no player to own them).

Efficent and garunteed to be random.
 
Status
Not open for further replies.
Top