Max. Number of Buildings

DerBaer

New Member
Reaction score
2
I want a skill that playes a new Building. But For the 4 levels of the Skill, there should be a maximum of 1-4 buildings on the map. If e.g. with level 2, there are 2 buildings on the map, the skill should replace the oldest of the 2 with the new one. But how do I easily get the oldest building?

p.s.: For the Dota-Players: Skill should be like Broodmother -> Web
 

SkateuUp

Member
Reaction score
4
Use variables and have the level as an interger variable, and the current number of buildings as another interger. Then every time the spell is cast check the two variables and if the current buildings is equal too the level then delete the last made unit.
 

LurkerAspect

Now officially a Super Lurker
Reaction score
118
Here:
Trigger:
  • Tester
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (your building @ whatever level)
    • Actions
      • Unit - Set level of (your ability) for (Triggering unit) to (whatever level that building is @)


Then copy the trigger for each building and each level, and use an event "unit dies" to drop the level.
 

SkateuUp

Member
Reaction score
4
I think you misunderstood he wants a skill which creates buildings, but the buildings have a limit on how many can exist at the same time which is linked to the level of the skill for the hero. Does this work?
Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set tempgroup = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Triggering unit)) Equal to (==) Keep))
      • Unit Group - Pick every unit in tempgroup and do (Set buildingcount = (buildingcount + 1))
      • Set levelcount = (Level of (Ability being cast) for (Triggering unit))
      • If (buildingcount Less than (<) levelcount) then do (Unit - Create 1 Keep for (Owner of (Triggering unit)) at (Target point of ability being cast) facing Default building facing (270.0) degrees) else do (Do nothing)

i put it together fast so... Yes i didn't add the custom script to remove group leak you should do that. i dont feel like looking it up xD
Edit: Ugh i just re-read all the thread and saw i didn't notice you wanted the oldest building removed sry im doing something and can't think of an easy way to do this off my head,but you could just have a remove skill on the buildings. :(
 

DerBaer

New Member
Reaction score
2
thanks for your answers.
By missunderstanding SkateuUp's trigger, I get the idea how to make the trigger work ;)
The UnitGroup was the deciding thing. Now it looks like this:
Trigger:
  • Events
    • Unit - A Unit starts the effect of an ability
    • Condition
      • Ability being cast = myAbility
    • Action
      • set tmpUnitGroup = Units of type (MyBuildingType)
      • UnitGroup - Pick every Unit in tmpUnitGroup
        • set custom value of (picked unit) = custom value of (pickedUnit) + 1
      • if
        • number of units in tmpUnitGroup < level of (MyAbility) for (triggering unit)
      • then
      • else
        • set tmpInteger = -1
        • set tmpUnit = nothing
        • unit group - pick every unit in tmpUnitGroup
          • if
            • custom value of (picked unit) > tmpInteger
          • then
            • tmpInteger = customvalue of (picked unit)
            • tmpUnit = (picked unit)
            • else
          • remove tmpUnit
      • create 1 unit of type (MyBuildingType) ...


maybe it's not the best way of doing it, but it works fine.
 
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