PDA

View Full Version : How to select hero by double click?


Cosmas
01-06-2011, 06:24 PM
Hi, how to select hero by double clicking him like in x hero siege?

ap0calypse
01-06-2011, 06:52 PM
Create a boolean variable (called "clicked" or something, use arrays if there are multiple players).

Create a trigger with the event "a unit is clicked" (or a specific unit event, your choice).
If clicked == false, then set clicked = true
If clicked == true, then create hero for player.

If a player switches from hero (in the selection screen), set clicked to false.

Cosmas
01-07-2011, 07:33 AM
Your way is 1 click or i don't understand, anyway i found better way if any one interesting here it is:

http://img696.imageshack.us/img696/7004/89007736.png (http://img696.imageshack.us/i/89007736.png/)

http://img809.imageshack.us/img809/4986/85482129.png (http://img809.imageshack.us/i/85482129.png/)

Now you have to click on hero 2 times within half second :goblin_yeah:

ap0calypse
01-07-2011, 08:36 AM
=____=

That's what I said, but with an integer instead of a boolean (imo a boolean is better because it can only be 0 or 1, while an integer can be... quite big).
And of course, I didn't say anything about the timer either because neither did you :D

defskull
01-07-2011, 08:46 AM
Supposedly you have 5 heroes in your map, this trigger is the way to go~
Load Hero
Events
Player - Player 1 (Red) Selects a unit
Conditions
And - All (Conditions) are true
Conditions
P01_PickedHero Equal to False
Or - Any (Conditions) are true
Conditions
(Triggering unit) Equal to Orist Icebrand 0004 <gen>
(Triggering unit) Equal to Shelv Stormcast 0003 <gen>
(Triggering unit) Equal to Kelen Wellsun 0000 <gen>
(Triggering unit) Equal to Agor Stonebreaker 0001 <gen>
(Triggering unit) Equal to Wanderer 0178 <gen>
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Triggering unit) Equal to P01_LoadHero
Then - Actions
Unit - Create 1 (Unit-type of (Triggering unit)) for (Triggering player) at (Center of 001 Hero Intro <gen>) facing Default building facing degrees
Set P01_PickedHero = True
Set P01_Hero = (Last created unit)
Set P01_HeroName = (Proper name of (Last created unit))
Trigger - Turn off Camera Lock For Intro <gen>
Trigger - Turn off Pick Agor Stonebreaker the Dwarf <gen>
Trigger - Turn off Pick Orist Icebrand the Hunter <gen>
Trigger - Turn off Pick Kelen Wellsun the Mage <gen>
Trigger - Turn off Pick Shelv Stormcast the Sorcerer <gen>
Trigger - Turn off Pick Anaya Lightsong <gen>
Trigger - Run Intro Entrance <gen> (ignoring conditions)
Else - Actions
Set P01_LoadHero = (Triggering unit)

The Event is "Player - Selection Event"
P01_PickedHero is Boolean-type variable
P01_LoadHero is Unit variable
Just follow the trigger (in my map, I have 5 heroes, in yours, I don't know)
Tell me if you have any problem~

ap0calypse
01-07-2011, 09:08 AM
- Remove the leak! (Location leak)
- Remove the "and [multiple conditions]"

But yes, that's correct.

defskull
01-07-2011, 09:19 AM
Aha, okay, I'll remove it, dear friend =D

ap0calypse
01-07-2011, 09:49 AM
That's great, thank you :D