HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

random hero from tavern logic problem...

02-19-2005, 06:29 AM#1
vile
ok maybe im stupid.. but.. heh
i have the right code to choose from the tavern a hero
but how the hell am i gonna make it random?!
i am trying with variables but it got too complicated
here is what im trying to do
Set Player2RandomHero = SentinelRandomHero[(Random integer number between 1 and 20)]

so it will choose a random hero, cuz 1-20 contains all the heroes

but the problem occures when a different hero will be given the same number as the former player, cuz it is random, so it wont choose!

is there a different solution?

here is the jass script anyways
call IssueNeutralImmediateOrderById(udg_Player2, udg_SentinelWarriors, 'E009')

thats an example
there is also a problem that how will that command know that E009 comes from Sentinel Warriors or Sentinel Casters.. cuz there are 2 taverns for each group..
02-19-2005, 11:11 AM#2
johnfn
Lemme just give you some code.


heroes[1] = blood mage
heroes[2] = archmage
heroes[3] = naga sea witch

and so on

Pick every player in (all players matching control (user))
if ( picked player wants a random unit)
create 1 heroes [ random number from 1 to the amount of heroes you have ] at position wherever, facing default building facing degrees

heroes would be an array of all the heroes that you have. When you wanna pick a random hero, just have it go heroes [ random number ].
02-19-2005, 02:15 PM#3
vile
yes i did that already but the problem is that i dont know what to put in the jass command
call IssueNeutralImmediateOrderById(udg_Player2, udg_SentinelWarriors, 'E009')

what to put instead of E009? udg_hero[1] ?
it wont work
02-19-2005, 07:42 PM#4
Vexorian
'E000'

is a rawcode, you'd have to use an INTEGER array for it, not an unit one