1. The Aftermath has been revealed for the 19th Terraining Contest! Be sure to check out the Results and see what came out of it.
    Dismiss Notice
  2. Melee Mapping Contest #3 - Results are out! Congratulate the winners and check plenty of new 4v4 melee maps designed for this competition!
    Dismiss Notice
  3. The winners of our cinematic soundtrack competition have been decided! Step by the Music Contest #11 - Results to check the entries and congratulate the winners!
    Dismiss Notice

[Trigger] Applying Variable Type: "Real" to Multiple Heroes

Discussion in 'Triggers & Scripts' started by rkemsley, Mar 15, 2019.

  1. rkemsley

    rkemsley

    Joined:
    Sep 25, 2018
    Messages:
    21
    Resources:
    0
    Resources:
    0
    I am trying to create a variable which is "attached" to a specific hero. Preferably, the variable has to be a "Real" which starts at 1. When a certain item is picked up, or the hero is affected by a certain buff, the "Real" has +0.25 (or whatever) added on. So the "Real" will now remember 1.25 (as appose to just 1). When the item is dropped, or buff is lost, the "Real" will go back to 1 again. These added decimals can stack up indefinitely, but the base is always 1.

    I am also trying to work out how I would add this hero specific variable to the end of a damaging trigger so that it would multiply the damage by the amount of the "Real". I am hoping I will be able to make sure that the trigger can detect which hero the "Real" belongs to, because different heroes will not have the same value in their "Real".

    In more simplified terms.
    Every hero has spell amplification. They all start with 1 spell amplification, so the damage done by the spell is multiplied by 1 (so nothing). Every items/buff they pickup/receive increases their spell amp by a decimal. If they had an item which gave 25% spell amp, when they cast their spell, the spell damage would be multiplied by 1.25 (so itself + 0.25 of itself).

    Please help, I am adverse to DDS :(
     
    Last edited: Mar 15, 2019
  2. Aeryn

    Aeryn

    Joined:
    Apr 17, 2017
    Messages:
    198
    Resources:
    0
    Resources:
    0
    I guess you can use hashtables for that. Save your reals to hashtables with the handleid of heroes, then when you want to deal damage load that amount.
     
  3. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    5,936
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    It's often an issue for equipment-like systems.
    One want to attach some kind of bonus to an item-id, like damage/life/mana/armor ..., and when the item is equipped the bonus must apply. It's often used in combination with a BonusMod system, to give this various features of extra improvements.

    Hashtable is definitly a good suggestion. You would need some kind of setup to save real-values to item-types, and which are loaded then on item pick up.
    In case only 1 bonus is used you might even try only with UnixIndexer instead of hashtable. It would suffice, and only one real[array] variable would be needed to define the bonus. It could look like
    • Set SpellDamageBonus[myUnitIndex] = Set SpellDamageBonus[myUnitIndex] + 0.25

    In the damage trigger you can multiply always spell damage by using the unix index of attacker again.

    If you use JASS you might think of reading this thread. [vJASS] - ItemPower