How could you count the number of images a Hero has on the map to limit it?

Astal

New Member
Reaction score
1
My replicator spell, replicates toooooo much and the map gets filled lol. I want to set it so only 8 images of that type are allowed on the map at once. Any thoughts?
 

verdr3t

New Member
Reaction score
8
Don't know if I understand what you mean... Anyway:

Trigger:
  • Image spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set Images = (Units owned by Player 1 (Red) matching (((Matching unit) is an illusion) Equal to True))
      • Set ImagesCount = (Number of units in Images)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ImagesCount Less than 9
        • Then - Actions
          • Do something
        • Else - Actions
          • Do something


Needs to be adjusted to your spell I guess...
 

Astal

New Member
Reaction score
1
Don't know if I understand what you mean... Anyway:

Trigger:
  • Image spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set Images = (Units owned by Player 1 (Red) matching (((Matching unit) is an illusion) Equal to True))
      • Set ImagesCount = (Number of units in Images)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ImagesCount Less than 9
        • Then - Actions
          • Do something
        • Else - Actions
          • Do something


Needs to be adjusted to your spell I guess...

How did you get imagescount less than 9?
 

Astal

New Member
Reaction score
1
Doesnt work :(

Code:
Automatic Replication
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) has buff Automatic Replication ) Equal to True
        (Random integer number between 1 and 100) Less than or equal to (8 x (Level of Automatic Replication Display  for (Attacking unit)))
    Actions
        Set Replicators = (Units owned by Player 1 (Red) matching (((Matching unit) is an illusion) Equal to True))
        Set ReplicatorCount = (Number of units in Replicators)
        Set TempPoint = (Position of (Attacking unit))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ReplicatorCount Less than 8
            Then - Actions
                Unit - Create 1 dummy for (Owner of (Attacking unit)) at TempPoint facing Default building facing degrees
                Unit - Add autoreplicate  to (Last created unit)
                Unit - Add a 2.50 second Generic expiration timer to (Last created unit)
                Unit - Order (Last created unit) to Attack (Attacking unit)
                Custom script:   call RemoveLocation (udg_TempPoint)
            Else - Actions
                Do nothing
 

Emu.Man00

New Member
Reaction score
41
Code:
Units owned by Player 1 (Red)

This will only work for player 1 (red) change it to owner of (attacking unit) (i assume that's what you want)

also, at the end

Code:
Custom Script:    call DestroyGroup(udg_Replicators)
 

artix123

New Member
Reaction score
4
Hi Astal.

Trigger:
  • Automatic Replication
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has buff Automatic Replication ) Equal to True
      • (Random integer number between 1 and 100) Less than or equal to (8 x (Level of Automatic Replication Display for (Attacking unit)))
    • Actions
      • Set Replicators = (Units owned by (Owner of (Attacking Unit)) matching ((((Matching unit) is an illusion) Equal to True)) AND (((Matching Unit) has buff (Automatic Replication)) Equal to True))
      • Set ReplicatorCount = (Number of units in Replicators)
      • Set TempPoint = (Position of (Attacking unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ReplicatorCount Less than 8
        • Then - Actions
          • Unit - Create 1 dummy for (Owner of (Attacking unit)) at TempPoint facing Default building facing degrees
          • Unit - Add autoreplicate to (Last created unit)
          • Unit - Add a 2.50 second Generic expiration timer to (Last created unit)
          • Unit - Order (Last created unit) to Attack (Attacking unit)
          • Custom script: call RemoveLocation (udg_TempPoint)
        • Else - Actions
          • Do nothing
      • Custom Script: call DestroyGroup(udg_Replicators)


If you only take into account of the number of illusions you have, other illusions that are not replications of the replicating hero will also be counted. Thus I included the buff check. Of course that's assuming that your replicating buff is an aura (and thus will be passed on to images). If it's not an aura buff, try using the condition of checking unit-type.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top