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

How to make a timed arena event with random player-owned units?

Status
Not open for further replies.
Level 2
Joined
Jul 19, 2011
Messages
13
Hey. I'm currently making a sort of RPG map where each player controls only 1 hero. The heroes are sometimes summoned into some closed areas where they fight eachother, sometimes only 2 heroes in one arena and sometimes up to 6 in same. I have a system on how to make them enter, but it's based on premade information in my triggers, in other words: i've decided what order the different players fight eachother.

I would like some suggestions on how to make triggers so it is random user-controlled heroes, instead of just what decided. eg. a trigger that picks 2 random heroes and place them in the same arena to fight eachother and occasionally pick 3,4,5 or 6 heroes and place in same arena. I have 6 different arena rooms fitted for each number of heroes playing in it. Any suggestions on how to make the system to pick more randomly?:vw_wtf:
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
sample;

you need these variables;

- random = integer
- YourHeroID = integer array
- YourHero = Unit

Map initialization
set YourHeroID[1] = mountain king's raw code
set YourHeroID[2] = paladin raw code
set YourHeroID[3] = arhcmage raw code
set YourHeroID[4] = bloody mage raw code

you can view raw coded/ID by pressing CTRL+D in the object editor...

Then when picking/creating hero;

set udg_random = GetRandomInt(1,4)
set udg_YourHero = CreateUnit(GetTriggerPlayer(), udg_YourHeroID[udg_random], PointX, PointY, 0)

PointX and PointY is the coordinate of the map


see this for reference...
http://www.hiveworkshop.com/forums/...red-hex-194645/?prev=d=list&r=20&u=mckill2009
http://www.hiveworkshop.com/forums/...map-very-simple-way-using-coordinates-198182/
 
Level 2
Joined
Jul 19, 2011
Messages
13
The point of my idea was to pick the hero of eg. player 1 and eg. the hero of player 2 and move them both to an arena where they will fight. Taking into consideration that there might be more than 1 of each type of hero.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
You'll first need to have some set up at map initialization.

First, you need to have a region array variable that sets the corresponding index to the correct room for that number of players.
Example:
  • Set Arenas[2] = ArenaFor2 <gen> // Should have a size of at least 6.
  • Set Arenas[3] = ArenaFor3 <gen>
  • Set Arenas[4] = ArenaFor4 <gen>
  • etc...
To take care of the heroes, you'll need two unit-group variables.
One variable should keep track of all the heroes that are in the map, which will be Heroes for my example. The other variable will be used to choose the heroes randomly, which will be simply HeroesCopy.

Now, to choose a random number of heroes for the arena, you can simply do something like this:
  • Set NumOfHeroes = (Random integer number between 2 and 6) // NumOfHeroes is an integer variable.
The arena that you should transport the heroes to would then be this:
  • Set ArenaToTransportHeroes = Arenas[NumOfHeroes]
To take care of choosing heroes randomly, you can do this:
  • Unit Group - Remove all units from HeroesCopy
  • Unit Group - Add all units of Heroes to HeroesCopy
  • For each (Integer A) from 1 to NumOfHeroes, do (Actions)
    • Loop - Actions
      • Set HeroToFight = (Random unit from HeroesCopy)
      • Unit Group - Remove HeroToFight from HeroesCopy
      • -------- You would move the hero to ArenaToTransportHeroes here as well. --------
 
Level 2
Joined
Jul 19, 2011
Messages
13
Thanks for the help. I've worked out how to get it working aswell with your help. But feel free to add some more replies to how to do it, in case someone else may be looking for the same ideas.
 
Status
Not open for further replies.
Top