HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Allrandom function

05-21-2006, 08:30 AM#1
Siphonized
I need a function like -ar in dota, anyone got a template how it looks?
05-21-2006, 11:13 AM#2
Tim.
It is not that hard..

Event occurs; Loop through each player; If random number between 1 and the total amount of heroes left is X; Give player hero designated X.

It is really far more dependant on your selection system.
05-21-2006, 02:49 PM#3
Freakazoid
download the free dota sample that SD_Ryoko made,...
05-21-2006, 04:09 PM#4
Siphonized
Quote:
Originally Posted by Tim.
It is not that hard..

Event occurs; Loop through each player; If random number between 1 and the total amount of heroes left is X; Give player hero designated X.

It is really far more dependant on your selection system.

What happens if it picks a hero-slot that is already taken? like 17 two times?
05-21-2006, 04:17 PM#5
Siphonized
Quote:
Originally Posted by Freakazoid
download the free dota sample that SD_Ryoko made,...

Link broken, do you have another one?

EDIT: Talking about the one on world-editor-tutorials
05-21-2006, 04:22 PM#6
The)TideHunter(
Your just making life hard for yourself if you do that, nvm though heres a example i just made:

Trigger 1: The start

Trigger:
All Random
Collapse Events
Player - Player 1 (Red) types a chat message containing -ar as An exact match
Conditions
Collapse Actions
Set CurrentPlayer = Player 1 (Red)
Trigger - Run All Random Loop <gen> (checking conditions)

Trigger 2: Making the heros

Trigger:
All Random Loop
Events
Collapse Conditions
(Player number of CurrentPlayer) Not equal to 13
Collapse Actions
Set RandomIntegerPicked = (Random integer number between 1 and 'MaxNumberOfHeros')
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of YourHeros[RandomIntegerPicked]) Not equal to No unit-type
Collapse Then - Actions
Unit - Create 1 (Unit-type of YourHeros[RandomIntegerPicked]) for CurrentPlayer at (Center of (Playable map area)) facing Default building facing degrees
Set YourHeros[RandomIntegerPicked] = No unit
Set CurrentPlayer = (Player(((Player number of CurrentPlayer) + 1)))
Else - Actions
Trigger - Run (This trigger) (checking conditions)

Not sure if this will work seen as though i have a headache and cant concentrate, i see why not though
05-21-2006, 05:03 PM#7
Tim.
Quote:
Originally Posted by Tim.
Event occurs; Loop through each player; If random number between 1 and the total amount of heroes left is X; Give player hero designated X.
.
05-21-2006, 06:09 PM#8
Siphonized
Trigger:
Allrandom
Collapse Events
Player - Player 1 (Red) types a chat message containing -ar as An exact match
Player - Player 1 (Red) types a chat message containing -allrandom as An exact match
Conditions
Collapse Actions
Trigger - Turn off Allrandom <gen>
Trigger - Turn off Remove Allrandom <gen>
Trigger - Turn off (This trigger)
Collapse Unit Group - Pick every unit in (Units in PickerSpawn <gen>) and do (Actions)
Collapse Loop - Actions
Unit - Remove (Picked unit) from the game
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Player((Integer A))) slot status) Equal to Is playing
Collapse Then - Actions
Set RandomHero = (Random integer number between 1 and AmountOfHeroes)
Unit - Create 1 HeroArray[RandomData[RandomHero]] for (Player((Integer A))) at PointArray[(Integer A)] facing 270.00 degrees
Game - Display to (All players) the text: (A player has randomed + (Name of (Last created unit)))
Player - Set (Player((Integer A))) Current gold to 125
Set RandomData[RandomHero] = RandomCount
Set RandomCount = (RandomCount - 1)
Wait 0.50 seconds
Collapse Else - Actions
Do nothing

Will this trigger automatically see to it that two people do not get the same Hero? Or will I need to make some temp unit-type var and move the picked hero to the end of the array?