1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Random spells?

Discussion in 'Triggers & Scripts' started by Marcus 小羊, Aug 31, 2019.

  1. Marcus 小羊

    Marcus 小羊

    Joined:
    Aug 29, 2019
    Messages:
    15
    Resources:
    0
    Resources:
    0
    Hello guys, I'm still a totally noob when it comes to trigger editor.

    May i ask if it's possible to gives hero random abilities every time they die?

    Q, W, E, R 4 keys for 4 different abilities that will randomly be given to newly respawn heroes.

    Well in my mind i got an idea about saving each abilities to variables

    Example,
    Q_Spell[1] = Thunder clap
    Q_Spell[2] = Chain lightning
    .
    .
    .
    Q_SpellMax = 23(maximum number of Q Spell)
    And so on..... there goes the same for others 3, W_Spell, E_spell, blablabla

    Then will randomly gives every hero that respawned one random for each of the 4 keys QWER, but here's the problem, i don't know how to do it correctly, i assume we are needed to remove abilities from heroes once they died right?

    Can somebody show me an example please...

    I hope you guys can understand, because im bad at english
     
  2. Marcus 小羊

    Marcus 小羊

    Joined:
    Aug 29, 2019
    Messages:
    15
    Resources:
    0
    Resources:
    0
    Nevermind, i kinda found a way to do it already
     
  3. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,905
    Resources:
    1
    Spells:
    1
    Resources:
    1
    The simplest solution is to save the given spells of each hero in an array when you give them. Either something like:

    Q_Spell_Player[1] = <q spell for player 1>
    W_Spell_Player[1] = <w spell for player 1>
    E_Spell_Player[1] = <e spell for player 1>
    R_Spell_Player[1] = <r spell for player 1>
    ---
    Q_Spell_Player[2] = <q spell for player 2>
    W_Spell_Player[2] = <w spell for player 2>
    E_Spell_Player[2] = <e spell for player 2>
    R_Spell_Player[2] = <r spell for player 2>

    Or this (a 2-D array):
    PlayerSpells[1*4 + 1] = <q spell for player 1>
    PlayerSpells[1*4 + 2] = <w spell for player 1>
    PlayerSpells[1*4 + 3] = <e spell for player 1>
    PlayerSpells[1*4 + 4] = <r spell for player 1>
    ---
    PlayerSpells[2*4 + 1] = <q spell for player 2>
    PlayerSpells[2*4 + 2] = <w spell for player 2>
    PlayerSpells[2*4 + 3] = <e spell for player 2>
    PlayerSpells[2*4 + 4] = <r spell for player 2>