• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Creating a custom Hero selection using Arrow Keys

Status
Not open for further replies.
Level 3
Joined
Apr 4, 2020
Messages
31
Hi Guys,

after years of not touching this game, i recently reinstalled the editor.
Just playing around, trying to get back in to it (not that i was ever really in it to begin with).

This is my first post so if this is the wrong place to ask for help, please tell me and i will post it somewhere else.

Now to my current challenge:

I wanted to create a hero selection that uses arrow keys. The basic idea was the following:

Intro plays, cinematic, first overview and you jump to the first hero you can select.
You see the hero, all his abilities, some nice effects around him and depending if you either click the left or right arrow key you jump to the next hero. (Note the first hero is predetermined)

So far so good.
The current problem is, that i'm not quite sure how to tell the game, what the next hero is or how to make the arrow triggers work.

My starting point after the intro looks like this:


Events
Map initialization
Conditions
Actions
Unit - Add |cffd45e19Choose this Hero|r to Jennalla Trautquell 0036 <gen>
Set VariableSet TriggerCurrentHero = HeroArcher <gen>
Set VariableSet TriggerHeroLeft = HeroDarkArcher <gen>
Set VariableSet TriggerHeroRight = HeroGuardCaptain <gen>
Set VariableSet CurrentHeroSelect = Jennalla Trautquell 0036 <gen>
Set VariableSet CurrentHeroCam = HeroPickArcher <gen>
Set VariableSet CurrentHeroRegion = (Position of Jennalla Trautquell 0036 <gen>)
Set VariableSet CurrentHero = Jennalla Trautquell
Camera - Apply CurrentHeroCam for Player 1 (Red) over 1.00 seconds
Selection - Select Jennalla Trautquell 0036 <gen> for Player 1 (Red)
Game - Display to (All players) the text: Woodarcher |cff8...​

My original idea was to tell the game what current hero is selected and what heroes are to the left and right (making it easier to add as many heroes as i want later on).
So far this is only possible for player 1

This happens, when i press either arrow key:

Events
Player - Player 1 (Red) Presses the Left/Right Arrow key
Conditions
Actions

Cinematic - Clear the screen of text messages for (All players).
Trigger - Turn off TriggerCurrentHero
Trigger - Turn on TriggerHeroLeft/TriggerHeroRight​

I am aware, that i didn't specify what player is pressing the button.
Even if i specify the trigger, nothing happens.

How can i make the arrow keys work?

Any help is appreciated.

Greetings
Katermukke


Edit: I made it work for now but any suggestions on how to slim it down or improve the overall system is appreciated.
Changed the
Trigger - Turn on to Trigger - Run instead​
 
Last edited:
Level 15
Joined
Feb 7, 2020
Messages
398
I think you could simplify this by storing the units you want to pan to as an array.

UnitPool[0] = [hero1]
UnitPool[1] = [hero2]
UnitPool[2] = [hero3]
(etc.)

Then have an integer that is the current hero selected.

UnitSelected[playerNumberGoesHere] = 0 [1,2,etc.]

When a left or right arrow is pressed, increment that variable for the player pressing a key, and set up the camera settings for the unit in the array via a single trigger:

Pan Camera to UnitPool[UnitSelected[playerNumberGoesHere]] (...)
(and do whatever else for that hero that you want)

Check for the floor/ceiling of UnitSelected[] being reached on each key press and prevent any further increments/decrements in that direction if said floor/ceiling has been reached already.

Wrote this pretty quickly in the sake of time, hope the quickfire conceptualization gives you some direction.

edit: alternative, you could loop back to the floor/ceiling when the respective opposite is met (so the player can "loop" thru the whole catalog)
 
Last edited:
Status
Not open for further replies.
Top