• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Attribute Aura (Percentage)

Status
Not open for further replies.
Level 3
Joined
Jan 23, 2014
Messages
32
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)
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
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
 
Level 3
Joined
Jan 23, 2014
Messages
32
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

Nothing, not work... it becomes permanent attributes and assumes subtraction as legitimate if no one is under the influence of aura.
 
Level 4
Joined
Sep 18, 2007
Messages
104
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.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
I didn't even notice your trigger's event.You need to do those steps in a periodic trigger.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
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.
 
Level 3
Joined
Jan 23, 2014
Messages
32
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.

Ok thanks, i'll try using that method, i hope to work. :D
 
Level 3
Joined
Jan 23, 2014
Messages
32
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)
 
Level 18
Joined
Oct 17, 2012
Messages
821
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.
 
Level 3
Joined
Jan 23, 2014
Messages
32
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...
 

Attachments

  • TEST SPELLS II.w3x
    613.8 KB · Views: 92
Level 24
Joined
Aug 1, 2013
Messages
4,657
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.
 
Level 3
Joined
Jan 23, 2014
Messages
32
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.

Attribute Aura (Percentage)

:)
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
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.
 
Level 3
Joined
Jan 23, 2014
Messages
32
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?
 
Level 3
Joined
Nov 18, 2007
Messages
48
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
 

Attachments

  • aura.w3x
    22.3 KB · Views: 100
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
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)
 
Status
Not open for further replies.
Top