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

i want to make respawnable camps

Status
Not open for further replies.
Level 21
Joined
Mar 29, 2020
Messages
1,237
hey,

since this is something that has been implemented in many popular maps, you will find a lot of people who already created these. there are a bunch of threads on the site about this... have a look...

(for example)


In general the concept shouldn't be too difficult. the question is just what the event should be to spawn the creeps. there is probably a more efficient way to do it than a periodic timer. but lets say you use a timer.

in psuedo GUI-

you will need to define regions where you want the creeps, and I would define a point array as the centers of all of those regions (I'll call this "CreepCamps").

- check every second:

for each point in CreepCamps ->
if "units in radius of point" is empty -
create units x,y at point.


(for the actual generation of the creeps you could have them generate randomly from some kind of bank, or you could have predefined creep types for each camp...)

I hope this gives you enough to start from....
 
Level 2
Joined
Aug 10, 2021
Messages
5
hey,

since this is something that has been implemented in many popular maps, you will find a lot of people who already created these. there are a bunch of threads on the site about this... have a look...

(for example)


In general the concept shouldn't be too difficult. the question is just what the event should be to spawn the creeps. there is probably a more efficient way to do it than a periodic timer. but lets say you use a timer.

in psuedo GUI-

you will need to define regions where you want the creeps, and I would define a point array as the centers of all of those regions (I'll call this "CreepCamps").

- check every second:

for each point in CreepCamps ->
if "units in radius of point" is empty -
create units x,y at point.


(for the actual generation of the creeps you could have them generate randomly from some kind of bank, or you could have predefined creep types for each camp...)

I hope this gives you enough to start from....
i saw that this trigger use variables and i don't quite understand how they work
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
Time to learn! Here's how you create a variable:

ex.png


It's real simple. You can create a Variable for just about anything in the game, then give it any name you want (as long as that name follows the naming conventions), and then Set that variable to keep track of something. If it's a Unit variable then you'd set it to a Unit, an Integer variable would be set to a whole number (1, 2, 3), a Real variable would be set to a number with a decimal (0.5, 1.28, 294.25) and so on.

You can then Set these variables as an Action in your triggers. Once a variable is set it'll keep track of whatever value you gave it. Keep in mind, by default a variable can only hold one value at a time, so it'll always be tracking the most recent thing you've set it to.

Why is this useful? Well, for many reasons but to keep it simple I'll show you a basic example of how it can be used:

First lets create and store Player 1 and Player 2's Hero in their own Unit variables:
  • Create Hero
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Paladin for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Variable Player1Hero = (Last created unit)
      • Unit - Create 1 Paladin for Player 2 (Blue) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Variable Player2Hero = (Last created unit)

Now lets kill Player 1's Hero a short time after that:
  • Kill Heroes
    • Events
      • Time - Elapsed game time is 7.00 seconds
    • Conditions
    • Actions
      • Unit - Kill Player1Hero

Without the Unit variables keeping track of these Heroes I would have a hard time getting Player 1's hero in the Kill Hero trigger. The variable allowed me to keep track of this unit and easily reference any time after it's been Set. This is just scratching the surface, variables can be pushed even further to make this process even better.

Once you're comfortable with variables you'll want to learn about Arrays, which is a feature you can enable on any variable to make it more flexible. Arrays can drastically cut down Variable/Trigger usage and make your life a lot easier.
 
Last edited:
Level 2
Joined
Aug 10, 2021
Messages
5
Time to learn! Here's how you create a variable:

View attachment 394034

It's real simple. You can create a Variable for just about anything in the game, then give it any name you want (as long as that name follows the naming conventions), and then Set that variable to keep track of something. If it's a Unit variable then you'd set it to a Unit, an Integer variable would be set to a whole number (1, 2, 3), a Real variable would be set to a number with a decimal (0.5, 1.28, 294.25) and so on.

You can then Set these variables as an Action in your triggers. Once a variable is set it'll keep track of whatever value you gave it. Keep in mind, by default a variable can only hold one value at a time, so it'll always be tracking the most recent thing you've set it to.

Why is this useful? Well, for many reasons but to keep it simple I'll show you a basic example of how it can be used:

First lets create and store Player 1 and Player 2's Hero in their own Unit variables:
  • Create Hero
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Paladin for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Variable Player1Hero = (Last created unit)
      • Unit - Create 1 Paladin for Player 2 (Blue) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Variable Player2Hero = (Last created unit)

Now lets kill Player 1's Hero a short time after that:
  • Kill Heroes
    • Events
      • Time - Elapsed game time is 7.00 seconds
    • Conditions
    • Actions
      • Unit - Kill Player1Hero

Without the Unit variables keeping track of these Heroes I would have a hard time getting Player 1's hero in the Kill Hero trigger. The variable allowed me to keep track of this unit and easily reference any time after it's been Set. This is just scratching the surface, variables can be pushed even further to make this process even better.

Once you're comfortable with variables you'll want to learn about Arrays, which is a feature you can enable on any variable to make it more flexible. Arrays can drastically cut down Variable/Trigger usage and make your life a lot easier.
thanks for the help i am now kinda understand how this work i am still trying to create the camps and this could really help me
 
Level 6
Joined
Oct 31, 2015
Messages
95
In DotA it should look somewhat like this:
  • Events
    • Time - Every 60.00 seconds of game time
  • Conditions
  • Actions
    • Set VariableSet Temp_Group = (Units in (Playable map area) matching ((Life of (Matching unit)) Greater than 0.00))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in TempGroup) Equal to 0
      • Then - Actions
        • Set VariableSet TempPoint = (Center of Region 000 <gen>)
        • Unit - Create 3 Satyr Shadowdancer for Neutral Hostile at TempPoint facing Default building facing degrees
        • Custom script: call RemoveLocation (udg_TempPoint)
      • Else - Actions
    • Custom script: call DestroyGroup(udg_Temp_Group)

It should work fine for 1 camp. To make multiple camps you could just copy 'n paste the action part multiple times for every region you got or use arrays (better solution) and loop it using a For Loop. (For SpawnInt from 1 to NumberOfRegions do: then you use a Temp_Group[SpawnInt] and TempPoint[SpawnInt], don't forget to update the custom scripts to clear those leaks or your map will lag in the late game. Also is useful to store your regions in a region array at map initialization like SpawnRegions[1] = Region 000, SpawnRegions[2] = Region 001, and so on. Then you set TempPoint[SpawnInt] = Center of SpawnRegions[SpawnInt] in the triggers above.

PS.: the triggers posted might look a bit different if you are using an older version like 1.26, but they are essentially the same.

PS2.: check the post below.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
In DotA it should look somewhat like this:
  • Events
    • Time - Every 60.00 seconds of game time
  • Conditions
  • Actions
    • Set VariableSet Temp_Group = (Units in Region 000 <gen>)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in TempGroup) Equal to 0
      • Then - Actions
        • Set VariableSet TempPoint = (Center of Region 000 <gen>)
        • Unit - Create 3 Satyr Shadowdancer for Neutral Hostile at TempPoint facing Default building facing degrees
        • Custom script: call RemoveLocation (udg_TempPoint)
      • Else - Actions
    • Custom script: call DestroyGroup(udg_Temp_Group)
Make sure to filter out Dead units, they'll be added to Temp_Group as well.
 
Level 6
Joined
Oct 31, 2015
Messages
95
Well pointed. I'll adjust it soon :goblin_jawdrop:

Edit: Adjusted. Just a personal note: when willing to test if a unit is alive use "Life greater than 0". Don't use the boolean Is Alive. That boolean performed some issues in my maps when used along with the Resurrection spell from Paladin. When those units died for the second time after being resurrected for some reason they were still being tagged as Alive and that bugged my missile system with missiles hitting units supposed to be dead due to my use of the Boolean instead of the Real option. In this case, Booleans are like Elves, don't trust them.

"Never trust an elf!" - any random dwarf.
 
Last edited:
Status
Not open for further replies.
Top