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 poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  4. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  5. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    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.

[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:
    265
    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:
    6,165
    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