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

[Solved] Randomized Skills

Status
Not open for further replies.
Level 3
Joined
Sep 26, 2012
Messages
39
Hello fellow hivers,

I'm in the process of making a map and I need help from ya'll for the skills distribution part.

Here's what I'd like to do: The map is some sort of hero arena and I'd like all players to have 3 options of randomized skills.

Example:

Game begins, you get text strings saying:

1- Boom Rocket, Mana Burn, Immolation, Metamorphosis

2- Searing Arrow, Owl Scout, Lucent Beam, Starfall

3- Entangle, Create Treants, Thorn Aura, Tranquility

You have to choose one with -book 1, -book 2 or -book 3

But there are restrictions:
all heroes must get 3 books choices including 3 random normal skills and 1 random ultimate.
All skills must be exclusive to 1 hero, so if hero X has Starfall in his book, no other hero can have it in their choices.
Skills must match hotkey, I want to use QWER so first skill must be attributed the Q hotkey and so on(is that even doable with triggers? if not how would you do it?)

Do you guys have something to get me started, or an alternative? I'm lost, thanks
 
Level 6
Joined
Nov 24, 2012
Messages
218
You're going to run into serious hotkey problem because you can't make QWER like that, and if you have over 20 spells which you obviously will, there will probably be issues.

Unless you have like 10 abilities for slot 1, 10 for slot 2, 10 for slot 3, and 5 for ults.
If you took that approach you can split normal abilities to 3 groups, Q abilities, W abilities, E abilities, and ult R abilities.

I highly recommend you make a set of Q,W,E normal spells, and R as ulti spells.

You would be able to get a lot less spell combos though.
Say you had 30 normal abilities and 5 ults --> 35 total.
Choose 3 from 30 where order matters: 4060 combos
Choose 1 from 5: 5 combos
so you got yourself 20,300 spell combos this way.
(you can google search: 30 choose 3, and google calculator does magical things)

Now let's try QWER system.
You have same # of spells. 10 Q, 10 W, 10 E, 5 R.
Choose from from each: 10*10*10*5 : 5000 combos

Sorry for bringing math in here.
There are pros and cons to both as you can see now, but I still suggest QWER.
5000 combos isn't so bad, and you can always add more spells in later versions of ur map.

Edit: exclusive spells Just as simple as swapping 2 array positions (target one + final).

I'm too sleepy to do that part atm, this is a possible basic set-up, very rough and ugly sry rushed it:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set NormalAbilityQ[1] = Acid Bomb
      • Set NormalAbilityQ[2] = Animate Dead
      • Set NormalAbilityQ[3] = Avatar
      • Set NormalAbilityQ[4] = Big Bad Voodoo
      • Set NormalAbilityQ[5] = Carrion Swarm
      • -------- ----------------------------- --------
      • Set NormalAbilityW[1] = Banish
      • Set NormalAbilityW[2] = Bladestorm
      • Set NormalAbilityW[3] = Blink
      • Set NormalAbilityW[4] = Chain Lightning
      • Set NormalAbilityW[5] = Cleaving Attack
      • -------- ----------------------------- --------
      • Set tempint = (Random integer number between 1 and Q_Spells_Available)
      • Unit - Add NormalAbilityQ[tempint] to X unit
 
Last edited:
Level 3
Joined
Sep 26, 2012
Messages
39
You're going to run into serious hotkey problem because you can't make QWER like that, and if you have over 20 spells which you obviously will, there will probably be issues.

Unless you have like 10 abilities for slot 1, 10 for slot 2, 10 for slot 3, and 5 for ults.
If you took that approach you can split normal abilities to 3 groups, Q abilities, W abilities, E abilities, and ult R abilities.

I highly recommend you make a set of Q,W,E normal spells, and R as ulti spells.

You would be able to get a lot less spell combos though.
Say you had 30 normal abilities and 5 ults --> 35 total.
Choose 3 from 30 where order matters: 4060 combos
Choose 1 from 5: 5 combos
so you got yourself 20,300 spell combos this way.
(you can google search: 30 choose 3, and google calculator does magical things)

Now let's try QWER system.
You have same # of spells. 10 Q, 10 W, 10 E, 5 R.
Choose from from each: 10*10*10*5 : 5000 combos

Sorry for bringing math in here.
There are pros and cons to both as you can see now, but I still suggest QWER.
5000 combos isn't so bad, and you can always add more spells in later versions of ur map.

I would go about it like this: .. uhh still trying to think here. I think Nestharus knows this kind of algorithmic stuff, would be simple as hell to him. maybe he'll pop in and say oh this is the easiest iteration ever. darn, trying to work something out.

Haha, thanks ;) Now I have to decide which spell goes in which group, nooooo!

Okay, I'll get right on that but I'm still clueless on how to destribute random abilities and make them exclusive

EDIT: What if I made 3 of the same abilities, one using Q, one E and one R for all regular abilities and put them all in their proper groups
 
Level 6
Joined
Nov 24, 2012
Messages
218
Haha, thanks ;) Now I have to decide which spell goes in which group, nooooo!

Okay, I'll get right on that but I'm still clueless on how to destribute random abilities and make them exclusive

EDIT: What if I made 3 of the same abilities, one using Q, one E and one R for all regular abilities and put them all in their proper groups

Mm I might help you with that when I wake up.
I showed you in my edited post how to distribute random,
I'll explain exclusive quickly for now.

if the random was Q2, u save Q2's ability elsewhere to add to hero whenever, or now.
then, u swap Q2 with #of abilities (say there are 10 Q abilities), so u set Q2 = Q10 and Q10=Q2 (not as simple as that to swap, but this is the gist of it)
Then u delete Q10 off the array (next person randomize is Q1-Q9).
yeah, u could make same abilities with different hotkeys.. o_O. it would be easy to filter out same abilities so u cant get same move of Q and E.
k gnight, goodluck.

Edit: if u ever played custom hero maps i hope u realize these abilities gotta be "unit" abilities and u must level them up via systems/ur game's features.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Here's how you can prevent selected abilities from being selected again:
  • Set i = (Random integer number between 1 and maxNumber)
  • Set ability = Abilities[i]
  • Set Abilities[i] = Abilities[maxNumber]
  • Set maxNumber = (maxNumber - 1)
  • add ability to unit
Max number must be initially set the the max array index used in the ability array
 
Level 6
Joined
Nov 24, 2012
Messages
218
Here's how you can prevent selected abilities from being selected again:
  • Set i = (Random integer number between 1 and maxNumber)
  • Set ability = Abilities[i]
  • Set Abilities[i] = Abilities[maxNumber]
  • Set maxNumber = (maxNumber - 1)
  • add ability to unit
Max number must be initially set the the max array index used in the ability array

Saved me trouble of trying to make something more complicated but does same thing =).
Mine would have had more lines to swap abilities with abilities[max] and then max = max -1.

I see what u did there, I just missed how all you need to do is set abil = abil[max], then lower index by 1, since you are trying to trash abil, so no need to swap. Yeah, this will work very nicely.
 
Level 3
Joined
Sep 26, 2012
Messages
39
Here's how you can prevent selected abilities from being selected again:
  • Set i = (Random integer number between 1 and maxNumber)
  • Set ability = Abilities[i]
  • Set Abilities[i] = Abilities[maxNumber]
  • Set maxNumber = (maxNumber - 1)
  • add ability to unit
Max number must be initially set the the max array index used in the ability array

Big thanks! I'm fairly new to using arrays, so I'm sorry for asking.

If I use your system and I set:

Set Abilities[3] = Metamorphosis
Set Abilities[4] = Searing Arrow

and I draw 3rd integer, then it'll set 3rd integer as 4th and discard it, leaving the next player with no chances of drawing searing arrow, correct?

If it's the case, how would I solve this?
 
Level 6
Joined
Nov 24, 2012
Messages
218
Big thanks! I'm fairly new to using arrays, so I'm sorry for asking.

If I use your system and I set:

Set Abilities[3] = Metamorphosis
Set Abilities[4] = Searing Arrow

and I draw 3rd integer, then it'll set 3rd integer as 4th and discard it, leaving the next player with no chances of drawing searing arrow, correct?

If it's the case, how would I solve this?

No, his code, if u draw 3, will add metamorph to ur hero,
then sets 3 to searing arrow, then discards #4 (which is also searing arrow).

My thought process also went like yours and I would have made [3] and [4] swap with each other and discard [4], but thats not necessary.
 
Level 3
Joined
Sep 26, 2012
Messages
39
Hmm, what am I not understanding?

This is my trigger(it's not complete, I just wanted to test what was done so far and it's not randomizing abilities)

  • Skills
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- --------
      • -------- Setting Q Abilities --------
      • Set Abilities_Q[1] = Holy Light
      • Set Abilities_Q[2] = Explosive Shot
      • Set Abilities_Q[3] = Attract Magic
      • Set Abilities_Q[4] = Typhoon
      • -------- Setting W Abilities --------
      • Set Abilities_W[1] = Thunder's Grasp
      • Set Abilities_W[2] = Phantom Leap
      • Set Abilities_W[3] = Straight Psycho Hook
      • Set Abilities_W[4] = Shield Bash
      • Set Abilities_W[5] = Woodwalker Shot
      • -------- Setting E Abilities --------
      • -------- Setting R Abilities --------
      • -------- --------
      • -------- Setting Q1 for Blue --------
      • Set iQ1 = (Random integer number between 1 and MaxNumber_Q)
      • Set SetAbility_Q = Abilities_Q[iQ1]
      • Set Abilities_Q[iQ1] = Abilities_Q[MaxNumber_Q]
      • Set MaxNumber_Q = (MaxNumber_Q - 1)
      • Set BlueAbility_Q1 = SetAbility_Q
      • -------- Setting Q2 for Blue --------
      • Set iQ1 = (Random integer number between 1 and MaxNumber_Q)
      • Set SetAbility_Q = Abilities_Q[iQ1]
      • Set Abilities_Q[iQ1] = Abilities_Q[MaxNumber_Q]
      • Set MaxNumber_Q = (MaxNumber_Q - 1)
      • Set BlueAbility_Q2 = SetAbility_Q
      • -------- Setting W1 for Blue --------
      • Set iW1 = (Random integer number between 1 and MaxNumber_W)
      • Set SetAbility_W = Abilities_W[iW1]
      • Set Abilities_W[iW1] = Abilities_W[MaxNumber_W]
      • Set MaxNumber_W = (MaxNumber_W - 1)
      • Set BlueAbility_W1 = SetAbility_W
      • -------- Setting W2 for Blue --------
      • Set iW1 = (Random integer number between 1 and MaxNumber_W)
      • Set SetAbility_W = Abilities_W[iW1]
      • Set Abilities_W[iW1] = Abilities_W[MaxNumber_W]
      • Set MaxNumber_W = (MaxNumber_W - 1)
      • Set BlueAbility_W2 = SetAbility_W
      • -------- Setting E Abilities --------
      • -------- Setting R Abilities --------
      • -------- Stringing Sets --------
      • -------- Blue Sets --------
      • Game - Display to Player Group - Player 2 (Blue) for 0.00 seconds the text: (-set 1 + (( + (Name of BlueAbility_Q1)) + ((, + (Name of BlueAbility_W1)) + ((, + (Name of BlueAbility_E1)) + (, + (Name of BlueAbility_R1))))))
      • Game - Display to Player Group - Player 2 (Blue) for 0.00 seconds the text: (-set 2 + (( + (Name of BlueAbility_Q2)) + ((, + (Name of BlueAbility_W2)) + ((, + (Name of BlueAbility_E2)) + (, + (Name of BlueAbility_R2))))))
      • -------- Teal Sets --------
      • Trigger - Turn off (This trigger)
This is a trigger I used just to test if the abilities were the one stringed and they are:

  • Blue Hero Set
    • Events
      • Unit - A unit owned by Player 2 (Blue) Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Hero Selector
    • Actions
      • Wait 0.30 seconds
      • Unit Group - Pick every unit in (Units owned by Player 2 (Blue) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Add BlueFinal_Q to (Picked unit)
          • Unit - Add BlueFinal_W to (Picked unit)
          • Unit - Add BlueFinal_E to (Picked unit)
          • Unit - Add BlueFinal_R to (Picked unit)
I keep getting the same abilities. I have my Abilities_Q array set at 4 and my Abilities_W array set at 5. My MaxNumber_Q initial value is 4 and the W one is 5. What am I not understanding?
 
Status
Not open for further replies.
Top