- Joined
- Aug 10, 2021
- Messages
- 5
i want to make respawnable camps just like in dota that will respawn only if there isn't anything the area of the camp
i saw that this trigger use variables and i don't quite understand how they workhey,
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)
[Solved] - [Need Help!] - Creep Respawning System
Hello! I'm currently working on a large map with a lot of creeps. I've looked everywhere and allthough I've found plenty of respawning systems, they're either outdated, jass (which I dont understand very well) or just not what i'm looking for. Anyway, I currently have a gui respawning system...www.hiveworkshop.com
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....
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 meTime to learn! Here's how you create a variable:Things You Should Know When Using Triggers / GUI
Things You Should Know When Using Triggers / GUI An easy guide for GUIers to be able to learn from, from beginner to advanced levels. There is also a list of helpful tutorials at the bottom of the tutorial. If you don't understand something feel free to post and I will help when i can...www.hiveworkshop.com
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.
Make sure to filter out Dead units, they'll be added to Temp_Group as well.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)