• 🏆 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!

If unit is under effect of aura then bleble

Status
Not open for further replies.
Level 4
Joined
Mar 12, 2008
Messages
83
I want to add +2 gold to owners of heroes that are affected by aura. Number of units dont matter. I mean if you have hero that is affected by an aura and you have less than 98 gold you gain +2 gold (so you never get 100+ gold because of that trigger). So far it looks like that:

  • Wyzwalacz bez nazwy 001
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Picked unit)) current gold) lower than 98
            • Then- Actions
              • Player - Add 2 to (Owner of (Picked unit)) current gold
            • Else - Actions
              • Do nothing
And next to that:
"((Owner of (Picked unit)) current gold) lower than 98"
i need a check if picked unit is under effect of an aura.
 
For a simple solution, run a periodic event that checks for units with such a buff
  • Trigger
  • Events
    • Time - Every 0.50 seconds of game-time
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable Map Area) matching ((Matching unit) has Gold buff) Equal to True)) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Owner of (Picked unit)) current gold) Less than 98
          • Then- Actions
            • Player - Add 2 to (Owner of (Picked unit)) current gold
It's not really suggested, but it works.

Do Nothing is unecessary. If the Current Gold is not lower than 98, then it will, by default, do nothing. That action takes up memory for no reason.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
No matter how you approach this you're going to need to use a periodic timer. Though, enumerating every single unit on the map every periodic interval could be strenuous. What I would do is have a unit-group or an array of units that is added to whenever a unit learns the passive aura.

Once you've established which units have the aura, you can do several enumerations using the units as center coordinates for the enumerations. Since auras have a predetermined radius you could simply enumerate units within that radius (who have the buff, so the targets are controlled by the ability - like Pharaoh_ displayed in his trigger) plus a few hundred units for collision.

Now you've enumerated the units that you want to include for the ability, so all you've got to do now is run through them and add gold to their owners' pockets.
 
Level 4
Joined
Mar 12, 2008
Messages
83
Sorry i didn't mention (and actually made mistake in trigger) but i pick from group of units only not all on map (and this units are only 10) so i guess this makes it little easier. Also wood instead of gold but that not matters.
Now this trigger looks like this:

  • heat up
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit group - Pick every unit in Villagers and do (Actions)
        • Loop - Action
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Heat ) equal to TRUE
              • ((Owner of (Picked unit)) current wood) lower than 98
            • Then - Action
              • Player - Add 2 to (Owner of (Picked unit)) current wood
            • Else - Action
Anything to correct? Also i have a little question about other trigger:

  • hmhmh
    • Events
      • Time - Every 120.00 seconds of game time
    • Conditions
    • Actions
      • Set random = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Condition
          • random bigger or equal to 9
        • Then - Action
          • Environment - Turn weather ON
          • Set heat_factor = (heat_factor + 1)
        • Or - Actions
          • Environment - Turn weather OFF
          • Set heat_factor = (heat_factor - 1)
That is every 2 minutes there is chance that it will be raining ("weather" is raining effect created and turned on earlier in other trigger). So my question here is if it is already weather=on and it goes on again it will crash or something? Or when its off and it randomes off again?
 
Status
Not open for further replies.
Top