Random Skills For Hero

Status
Not open for further replies.

cheokwai

C

cheokwai

I want to give my hero random skills , but unfortunately i dont know how, can anyone tell me:vw_sleep:
 
Add them all to individual arrays like

FirstAbil[1] = Forked Lightning
FirstAbil[2] = Chain Lightning
FirstAbilCount = 2

SecondAbil[1] = Holy Light
SecondAbil[2] = Heal
SecondAbil[3] = Healing Wave
SecondAbilCount = 3

and on hero creation

Unit - Add FirstAbil[Random integer between 1 and FirstAbilCount] to YourUnit
Unit - Add SecondAbil[Random integer between 1 and SecondAbilCount] to YourUnit
 
@Arhowk: you can manage with only 1 array. Same principle, however since we know the number of indexes for first/second ability etc, it can be like this

AbiArray[0] = HolyLight
blah blah - 5 choices for first
AbiArray[5]= DeathCoil
blah blah -3 choices for second

Then we add it
Add AbiArray [random int between 0 and 4]
Add AbiArray [random int between 5 and 7]

So on and so forth.
 
@Arhowk: you can manage with only 1 array. Same principle, however since we know the number of indexes for first/second ability etc, it can be like this

AbiArray[0] = HolyLight
blah blah - 5 choices for first
AbiArray[5]= DeathCoil
blah blah -3 choices for second

Then we add it
Add AbiArray [random int between 0 and 4]
Add AbiArray [random int between 5 and 7]

So on and so forth.
True, but, to make it more clear for op

AbilStart[1]=1
Abil[1] = Holy Light
Abil[2] = Healing Wave

AbilStart[2] = 3
Abil[3] = Forked Lightning
Abil[4] = Chain Lightning
Abil[5] = Finger of Death

AbilStart[3] = 6
Abil[6] = . . .

To simplify, AbilStart[1] = 1 : the [1] part is the # of the abil slot (so first abil is 1, 2nd abil is 2, etc) and the = 1 part is the index of where it starts, which means that since the first abil in the series is Abil[1] the value would be one. AbilStart[2] = 3 because the first ability in the second group is 3.

Unit - Add Ability (Random int from AbilStart[1] to AbilStart[2]) to YourUnit
Unit - Add Ability (Random int from AbilStart[2] to AbilStart[3]) to YourUnit

@doomlord, yeah i know i used two variables, its just easier to add skills faster. Not much memory loss
 
Status
Not open for further replies.
Back
Top