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. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Choose your ride to damnation in the 5th Special Effect Contest Poll.
    Dismiss Notice
  5. The winners of the 13th Techtree Contest have been announced!
    Dismiss Notice
  6. Vote for the best entries in the 13th Music Contest Poll.
    Dismiss Notice
  7. 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.

[Spell] Attribute Aura (Percentage)

Discussion in 'World Editor Help Zone' started by MetalZoa, May 9, 2015.

  1. MetalZoa

    MetalZoa

    Joined:
    Jan 23, 2014
    Messages:
    29
    Resources:
    0
    Resources:
    0
    Hello friends, i have two problem... i am trying to create an aura that increases my attributes by percentages, i want the attributes return to their original form if i do not have the item, or i'm not under the influence of aura.

    1. When i put "Substract" in "Else - Actions", i subtracted attributes while under the effects of the aura and many more of which i add.

    2. When i am outside the area of the aura, attributes not return to its original form.

    Trigger:

    • Attribute Aura
      • Events
        • Unit - A unit Learns a skill
      • Conditions
        • (Learned Hero Skill) Equal to Damage Increase (Dummy)
      • Actions
        • Set AttributeBonus_Group = (Units in (Playable map area))
        • Unit Group - Pick every unit in AttributeBonus_Group and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) has buff Damage Increase (Level 1)) Equal to True
              • Then - Actions
                • Hero - Modify Agility of (Picked unit): Add (Integer((0.10 x (Real((Agility of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Intelligence of (Picked unit): Add (Integer((0.10 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Strength of (Picked unit): Add (Integer((0.10 x (Real((Strength of (Picked unit) (Include bonuses)))))))
              • Else - Actions
                • Hero - Modify Agility of (Picked unit): Subtract (Integer((0.10 x (Real((Agility of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Intelligence of (Picked unit): Subtract (Integer((0.10 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Strength of (Picked unit): Subtract (Integer((0.10 x (Real((Strength of (Picked unit) (Include bonuses)))))))
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) has buff Damage Increase (Level 2)) Equal to True
              • Then - Actions
                • Hero - Modify Agility of (Picked unit): Add (Integer((0.25 x (Real((Agility of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Intelligence of (Picked unit): Add (Integer((0.25 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Strength of (Picked unit): Add (Integer((0.25 x (Real((Strength of (Picked unit) (Include bonuses)))))))
              • Else - Actions
                • Hero - Modify Agility of (Picked unit): Subtract (Integer((0.25 x (Real((Agility of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Intelligence of (Picked unit): Subtract (Integer((0.25 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Strength of (Picked unit): Subtract (Integer((0.25 x (Real((Strength of (Picked unit) (Include bonuses)))))))
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) has buff Damage Increase (Level 3)) Equal to True
              • Then - Actions
                • Hero - Modify Agility of (Picked unit): Add (Integer((0.40 x (Real((Agility of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Intelligence of (Picked unit): Add (Integer((0.40 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Strength of (Picked unit): Add (Integer((0.40 x (Real((Strength of (Picked unit) (Include bonuses)))))))
              • Else - Actions
                • Hero - Modify Agility of (Picked unit): Subtract (Integer((0.40 x (Real((Agility of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Intelligence of (Picked unit): Subtract (Integer((0.40 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Strength of (Picked unit): Subtract (Integer((0.40 x (Real((Strength of (Picked unit) (Include bonuses)))))))
        • Custom script: call DestroyGroup(udg_AttributeBonus_Group)
     
  2. Ceday

    Ceday

    Joined:
    Feb 22, 2010
    Messages:
    1,111
    Resources:
    0
    Resources:
    0
    You tried to use a bad short cut here.Here is what you should do.But I am not sure about what you can do against things like leveling up or acquiring a stat bonus item.


    (Assuming you have a unit group variable UG)
    --Step 1--
    Pick all units which was that buff
    if (picked unit is in UG) -> Do nothing
    else -> Add picked unit to UG, and increase stats.
    --Step 2--
    Pick all units in UG group
    if (picked unit has buff) -> Do nothing
    else -> Remove picked unit from UG, and decrease stats
     
  3. MetalZoa

    MetalZoa

    Joined:
    Jan 23, 2014
    Messages:
    29
    Resources:
    0
    Resources:
    0
    Nothing, not work... it becomes permanent attributes and assumes subtraction as legitimate if no one is under the influence of aura.
     
  4. chaoslord301

    chaoslord301

    Joined:
    Sep 18, 2007
    Messages:
    105
    Resources:
    0
    Resources:
    0
    It has been years since I have used the editor so I may be a little off, but the way I am reading your trigger is:

    -The trigger is only firing off when a unit learns an ability. This will only affect units (and him) when he clicks the ability when he levels up. You should make one of the events of unit acquires/loses an item (as you said).

    You may be able to try something along the lines of using a unit variable (array for mui) and setting it equal to a unit with the ability/item. Then periodically (Event) check to see if units are in range of him. This would probably be a lot easier if the unit is preplaced on the map.
     
  5. Ceday

    Ceday

    Joined:
    Feb 22, 2010
    Messages:
    1,111
    Resources:
    0
    Resources:
    0
    I didn't even notice your trigger's event.You need to do those steps in a periodic trigger.
     
  6. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,640
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Trigger 1:
    When a unit learns that ability, add him to the unit group AttributeAuraSources.

    Trigger 2:
    Every 0.5 or 1 second of gametime, loop through all units in AttributeAuraSources.
    Pick all nearby units and filter units that have that buff.
    Add a dummy Attribute Bonus ability to that unit.
    Add that picked unit to unit group AttributeAuraTargets.

    Trigger 3:
    Every 0.5 or 1 second of gametime, loop through all units in AttributeAuraTargets.
    If the unit has not got the buff, remove it from the group and remove the abilities.
     
  7. MetalZoa

    MetalZoa

    Joined:
    Jan 23, 2014
    Messages:
    29
    Resources:
    0
    Resources:
    0
    Ok thanks, i'll try using that method, i hope to work. :D
     
  8. MetalZoa

    MetalZoa

    Joined:
    Jan 23, 2014
    Messages:
    29
    Resources:
    0
    Resources:
    0
    Does not work, every 1 second attributes are reduced up to 2. Here the Trigger i did. What's wrong there?

    • Attribute Aura Learn
      • Events
        • Unit - A unit Learns a skill
      • Conditions
        • (Learned Hero Skill) Equal to Damage Increase (Dummy)
      • Actions
        • Set AttributeAura_Learn = (Triggering unit)
        • Unit Group - Add AttributeAura_Learn to AttributeAura_Source


    • Attribute Aura Loop
      • Events
        • Time - Every 1.00 seconds of game time
      • Conditions
      • Actions
        • Set AttributeAura_Source = (Units in (Playable map area))
        • Unit Group - Pick every unit in AttributeAura_Source and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) has buff Damage Increase (Level 1)) Equal to True
              • Then - Actions
                • Hero - Modify Agility of (Picked unit): Add (Integer((0.10 x (Real((Agility of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Intelligence of (Picked unit): Add (Integer((0.10 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Strength of (Picked unit): Add (Integer((0.10 x (Real((Strength of (Picked unit) (Include bonuses)))))))
                • Unit Group - Add (Picked unit) to AttributeAura_Targets
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) has buff Damage Increase (Level 2)) Equal to True
              • Then - Actions
                • Hero - Modify Agility of (Picked unit): Add (Integer((0.25 x (Real((Agility of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Intelligence of (Picked unit): Add (Integer((0.25 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Strength of (Picked unit): Add (Integer((0.25 x (Real((Strength of (Picked unit) (Include bonuses)))))))
                • Unit Group - Add (Picked unit) to AttributeAura_Targets
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) has buff Damage Increase (Level 3)) Equal to True
              • Then - Actions
                • Hero - Modify Agility of (Picked unit): Add (Integer((0.40 x (Real((Agility of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Intelligence of (Picked unit): Add (Integer((0.40 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Strength of (Picked unit): Add (Integer((0.40 x (Real((Strength of (Picked unit) (Include bonuses)))))))
                • Unit Group - Add (Picked unit) to AttributeAura_Targets
              • Else - Actions
        • Custom script: call DestroyGroup(udg_AttributeAura_Source)


    • Attribute Aura Remove
      • Events
        • Time - Every 1.00 seconds of game time
      • Conditions
      • Actions
        • Set AttributeAura_Targets = (Units in (Playable map area))
        • Unit Group - Pick every unit in AttributeAura_Targets and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) has buff Damage Increase (Level 1)) Equal to False
              • Then - Actions
                • Hero - Modify Agility of (Picked unit): Subtract (Integer((0.10 x (Real((Agility of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Intelligence of (Picked unit): Subtract (Integer((0.10 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Strength of (Picked unit): Subtract (Integer((0.10 x (Real((Strength of (Picked unit) (Include bonuses)))))))
                • Unit Group - Remove (Picked unit) from AttributeAura_Targets
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) has buff Damage Increase (Level 2)) Equal to False
              • Then - Actions
                • Hero - Modify Agility of (Picked unit): Subtract (Integer((0.25 x (Real((Agility of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Intelligence of (Picked unit): Subtract (Integer((0.25 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Strength of (Picked unit): Subtract (Integer((0.25 x (Real((Strength of (Picked unit) (Include bonuses)))))))
                • Unit Group - Remove (Picked unit) from AttributeAura_Targets
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) has buff Damage Increase (Level 3)) Equal to False
              • Then - Actions
                • Hero - Modify Agility of (Picked unit): Subtract (Integer((0.40 x (Real((Agility of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Intelligence of (Picked unit): Subtract (Integer((0.40 x (Real((Intelligence of (Picked unit) (Include bonuses)))))))
                • Hero - Modify Strength of (Picked unit): Subtract (Integer((0.40 x (Real((Strength of (Picked unit) (Include bonuses)))))))
                • Unit Group - Remove (Picked unit) from AttributeAura_Targets
              • Else - Actions
        • Custom script: call DestroyGroup(udg_AttributeAura_Targets)
     
  9. GhostHunter123

    GhostHunter123

    Joined:
    Oct 17, 2012
    Messages:
    458
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Don't add the units from source group to target group, rather add units nearby the source units.

    [trigger="Attribute Aura Loop"]Unit Group - Pick every unit in AttributeAura_Source and do (Actions)
    Loop - Actions
    set loc = (Position of (Picked Unit))
    Unit Group - Pick up every unit within X of loc in source and do (Actions)
    Loop - Actions[/trigger]

    Also, since you are adding units to the source and target groups, don't set the groups to anything in the loops.
     
  10. MetalZoa

    MetalZoa

    Joined:
    Jan 23, 2014
    Messages:
    29
    Resources:
    0
    Resources:
    0
    No, every time i try a new solution ends worse. Now, every time the game starts, all attributes are reduced to 2. Here ceases the map, really not much and i hope to help me much more easily...
     

    Attached Files:

  11. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,640
    Resources:
    3
    Spells:
    3
    Resources:
    3
    I said "Add a dummy Attribute Bonus ability to that unit."
    Go to the object editor and find the ability Attribute Bonus in Neutral - Hero.
    Create a new ability based of that one and make it hide the icon and make it a unit ability.
    Add that ability instead of adding stats directly.
    You can use different levels for different levels of the aura.
     
  12. MetalZoa

    MetalZoa

    Joined:
    Jan 23, 2014
    Messages:
    29
    Resources:
    0
    Resources:
    0
    Attribute Aura (Percentage)

    :)
     
  13. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,640
    Resources:
    3
    Spells:
    3
    Resources:
    3
    hmm...
    In that case...
    You require to have a bit more control over how your aura affects nearby units.
    This control can be granted using a proper buff system.
    My Effect Over Time System could do it, but even then it might get really hard to have it 100% working.

    You must ONLY increase the stats if the buff is created.
    A periodic loop will not work well in that case.
    On the other hand, controlling the levels of the aura and the targets are very easy to handle using that system.

    You can remove the stats again when the buff is destroyed.
    To know which value you have to take, you can store the amount of stats granted as additional data on the effect.
    That way, you also wont increase the stats based of themselves.
     
  14. MetalZoa

    MetalZoa

    Joined:
    Jan 23, 2014
    Messages:
    29
    Resources:
    0
    Resources:
    0
    Finally did work... i had to use a integer system, the problem is that when i go to subtract attributes, reduces more than add.

    Example:

    If i have 36 strength and add 10%, it is 57.
    But if i have 57 strength and subtract 10%, it is 34 or 33.
    If i go in and out of the area of the aura, to be in 2 of each attribute.

    Does anyone know why?
     
  15. ShaDowPoWeR

    ShaDowPoWeR

    Joined:
    Nov 18, 2007
    Messages:
    48
    Resources:
    0
    Resources:
    0
    I recommend using 3 attribute bonus abilities (you can make it invisible to players)
    one for str
    one for agi
    one for int
    with like 100 lvls each skill increasing 1 of the respective stat per lvl
    instead of adding and removing stats (which doesn't seem to work properly) you add each skill to the heroes that get in range for the aura (unless they have lvl 1 or higher = they have the skill), set it to the correct lvl and remove the skill from the hero if it gets outside the effect of the aura.

    edit>added working aura example using my method
     

    Attached Files:

    Last edited: May 13, 2015
  16. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,640
    Resources:
    3
    Spells:
    3
    Resources:
    3
    You have to STORE THE AMOUNT YOU ADD
    In that way, you can remove the PROPER AMOUNT when the buff is removed.
    There are numberless things that could go wrong:
    - Start with 100 STR.
    - Add 10% (110 STR).
    - Learn Skill Attribute Bonus (160 STR)
    - Devide by 1.1 (145 STR)
    Now you have 5 Strength removed.

    Add 10% = X1.1
    Remove 10% = /1.1
    No fails.

    If you store the amount, you can remove it and give it again every interval.
    That way, you will always have the proper amount.
    You can indeed make the abilities and use those but for that:

    @ShaDowPoWer
    Don't make 100 levels as it increases loading time and requires preloads.
    Instead make several abilities with 10 levels with each a set from 0 to 9 with a number of zeros behind it.
    In this case:
    Level 1: 0 0
    Level 2: 1 10
    Level 3: 2 20
    Level 4: 3 30
    etc until Level 10.
    Or use binary numbers creating abilities of 1 level and giving stats:
    Ability 1: 1
    Ability 2: 2
    Ability 3: 4
    Ability 4: 8
    Ability 5: 16
    Ability 6: 32
    etc
    That way, you can create almost any number between 0 and (the value of the last ability *2 -1)