Random and repick

Status
Not open for further replies.
Level 3
Joined
Dec 12, 2008
Messages
41
hi im wishing to make a -random and a -repick command for my aos but i have no idea how. I looked at most of the tutorials put i didn't find any

can some one post a link with a tutorial or explain it to me plz :cry:
 
use unitpool's to deal with your problem. After setting up your unit pool(http://www.wc3c.net/showthread.php?t=97706), simply create a trigger that fires upon "-random" chat even. Then check if the triggering player has already a hero etc.
In the actions just create one random unitType from the pool and remove the unittype after it.
So about the pick. Simply remove a unit-type from the tavern after it was been picked. (you can achieve this by creating a trigger firing at unit sell event.)
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
The contents of a "-repick" and "-random" trigger would be almost entirely based on the specifics of your map.

Lets take DotA for instance. After a hero is chosen you are given the hero and the tavern units display as blank (for you). If you type "-repick" after selecting your hero, your current hero is taken away and the taverns no longer appear blank (allowing you to choose another hero).

So here, all -repick is doing is removing your previous hero from the game (and the tavern, so it cannot be chosen again) and then re-enabling the tavern.

What "Darkt3mpl3r" said was completely correct for the information you have given us, and in this context cannot be simplified further. You're asking us to narrow this down for you when you haven't narrowed anything down for us.
 
Level 3
Joined
Dec 12, 2008
Messages
41
ok norrowing down:

i want to make a -random and -repick command for my game

-when you type -random you get a random hero (no need to make him disapear from the tavern since it dose't change alot if there 2 same heros)

-once you picked or randomed a hero if you dont like him i want the player to be able to type -repick and be able to chose again...for thi option(-repick) all i want to know is how to make the hero of the triggering player disapear, since i can easely make a new "hero choser" apear near the raverns

- I would like to make those commands with out jass only triggers( i dont know if its possible but i hope)

there i norrowed it down as much as i can :thumbs_up:
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Well you'll want to start off with a unit array so that you can store the values of each players' hero-unit. Now that you're able to access the player heroes you can do "Unit - Remove" and remove the hero associated with the player typing "-repick". Since you're using GUI I don't think that you'll be able to use Unit Pools for your random selection, but you could still use the approach of having an integer array that stores the Unit-Type-ID of every selectable hero.

Now, when a player types "-random" you would generate a random integer with a minimum of 0 and a maximum the same as the amount of stored IDs. From here you have your random Unit-Type-ID, yielding a random unit creation.
 
Well... I see that you are not really trying to even touch jass.

You cannot access unitpools in the GUI. So you have to find another method called indexing. Index your unit-type. Like this
  • Set HeroId[0] = Archmage
  • Set HeroId[1] = Paladin
Then, upon "-random" event set a global integer to a random number that counts from 0 to your maximum hero-type amount. Check if the global integer is already taken in the index. If it is, simply move up/down the global integer until you reach a non taken index. You can achieve this by using loops.

Now that you finally have your free index create a unit based on HeroId[globalInteger] and then mark it as taken. ( for example setting the taken index to a value of zero. And of course checking if the index[number] is not null. )
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Its actually pretty funny that you can't access Unit Pools in GUI, considering there is a GUI function for storing Unit Pools to Hash Tables.

Woah. I think I found a bug.

Try using the hashtable function for storing unit pools. I clicked on the field that changes the "unit pool" value and it made my World Editor crash.
 
Level 3
Joined
Dec 12, 2008
Messages
41
euhhhh okey... if someone could do it to me id realy apreciate and they will have there name in front page in credits :hohum:

i realy dont understand anything from jass
i know how to triger but im not good and variables are not my thing...

so if any want could halp me plz private message im

for a pro it should't take to much to make a "-random" and a "-repick"
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
I'm working on it now. I just have to finalize the -random command and it will be uploaded.

I do have a question, however. Would you prefer that I use GUI or JASS (vJass, actually). If I were to use vJass it would probably perform better, but it requires you having the most recent JassHelper and you probably wouldn't understand whats going on (or maybe you would).

Uploaded
 

Attachments

  • hero-fight_2.13b.w3x
    436.7 KB · Views: 96
Last edited:
Level 3
Joined
Dec 12, 2008
Messages
41
I'm working on it now. I just have to finalize the -random command and it will be uploaded.

I do have a question, however. Would you prefer that I use GUI or JASS (vJass, actually). If I were to use vJass it would probably perform better, but it requires you having the most recent JassHelper and you probably wouldn't understand whats going on (or maybe you would).

i have absoluitly no idea how to use jass but as long as it works anyone will be okey with me

(if i need to have some kind of program to make it work, i have no jass programs)
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
I just used regular JASS (very minimal) so you'll be able to compile it with the normal World Editor. Other than that all the triggers are done in GUI. There are two instances where there was no GUI function in the for the scenario that I required so I just got lazy and used Custom Script, but you'll probably be okay with that.
 
Level 3
Joined
Dec 12, 2008
Messages
41
I just used regular JASS (very minimal) so you'll be able to compile it with the normal World Editor. Other than that all the triggers are done in GUI. There are two instances where there was no GUI function in the for the scenario that I required so I just got lazy and used Custom Script, but you'll probably be okay with that.

alright thanx alot btw how can i give you +rep?
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
To the left of my/your post is a shaded area with user information, as follows:

marbib
User

Join Date: Dec 2008
Posts: 12


Right here there should be a little check-box folder with a yellow circle beside it. Hold your cursor over the check-box folder and it will say "Add to Person's reputation".
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
You mean to the random?

JASS:
set udg_HeroUnitTypeId[ 0 ] = 'H000'
set udg_HeroUnitTypeId[ 1 ] = 'H001'

This poorly resembles what I had done for your map, up to about 43 indexes. What 'H000' and 'H001' represent are the raw-codes for the units. For example, a Footman is represented by the value 'Hfoo'. If I were to add a 3rd hero to my make-shift list that I just made right now, it would look like so:

JASS:
set udg_HeroUnitTypeId[ 0 ] = 'H000'
set udg_HeroUnitTypeId[ 1 ] = 'H001'
set udg_HeroUnitTypeId[ 2 ] = 'H00A'

The values of the raw-codes are given by the Object Editor. If you want to view them, press Ctrl+D. Make sure that you update the number in the "HeroRandom" trigger to match the maximum index of the HeroUnitTypeId array.

If you were to add 1 to my script (in your map) then you would need to change the random integer generator maximum to 44 instead of 43, as well as set up the new variables like I have done above.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
I just have the global variables set at initialization, it required the least amount of typing. The variables are created using the Variable Editor so they'll be able to be referenced from the GUI, I just make sure to use the "udg_" prefix.

But yes, that is one way of doing it.
 
Status
Not open for further replies.
Top