I'm not new to triggers, so complicated solutions welcome.
Right now I'm using in data Deathtime = -1 and a simple trigger:
Event: Any unit dies
Condition: Triggering unit = Biological
Actions: Wait X, Revive Unit
... because I don't want the units to lose items, levels etc.. Now my question for my creeps is: If I give them a buff that periodically applies another buff so they get stronger over time, does that buff keep running while they are dead?
For my "heros" it's a bit more complicated. I have 3 points on my map for them to respawn and I want them to respawn at the closest of those. How can I do that?
I would doubt they'd keep getting the buff, but since this is a data thing, I'm not entirely sure. I know triggers for instance, you can make things necessary and exclude them altogether. For example the "pick each unit in unit group" combined with "units in region matching condition" by default excludes dead units. Is there not something like that when creating your buff?
Aren't many buffs removed when a unit dies? I ran into this problem in my game; I needed to keep track of what buffs a unit had on death to make sure I could reapply them.
A good method I have seen other people use; they put a buff on units, so that when they take fatal damage, the unit becomes invulnerable, and cannot move/attack/ect for X seconds; then the unit is moved and healed to wherever you want your units to respawn. It takes the "death" part out of dying; but it serves the same purpose; except no buffs/attributes/items will be lost.
To get the closest respawn point; there should be an action to get the distance between 2 points. You simply get the distance from "position of dying unit" to points 1, 2 and 3. Then you compare those values to get the lowest value.
You didn't ask, but here is another good solution for creeps respawning. Use custom values to save the initial X and Y values of the unit; on map init. Set custom value 1 to X position on map, and value 2 to Y position. Then as your units move around the map; they will always respawn at their initial locations (move unit to X,Y coordinate)
Aren't many buffs removed when a unit dies?I ran into this problem in my game; I needed to keep track of what buffs a unit had on death to make sure I could reapply them.
Tick the "permanent" and "enabled while dead" flags in the behavior, and this will stop buffs from being removed while the unit is dead.
You didn't ask, but here is another good solution for creeps respawning.Use custom values to save the initial X and Y values of the unit; on map init.Set custom value 1 to X position on map, and value 2 to Y position.Then as your units move around the map; they will always respawn at their initial locations (move unit to X,Y coordinate)
I could need something like that, so how do I do that in a good way? I have a real large amount of creep camps (about 20-30 or so) and I dont want to make points for them. Best would be if you give me an example or describe it a bit more thoroughly.
I know my way around triggers, but I've never done something like this before, so keep that in mind.
I found a good solution for this by using fake unit death (just actor visual) and then hide unit and teleport to whatever place out of battle. It is also good because if you have some persistent trigger abilities based on "damage unit" function it won't fire errors like "couldn't find "Attacker", because hero won't be dead actualy.
I could need something like that, so how do I do that in a good way? I have a real large amount of creep camps (about 20-30 or so) and I dont want to make points for them. Best would be if you give me an example or describe it a bit more thoroughly.
I know my way around triggers, but I've never done something like this before, so keep that in mind.
Make an ability, effect-instant.
Make it have a prepare time of 20 seconds (or however long you want the creep to take to respawn).
Make the ability require "dead" and "self" in the target filters. Apply the same to the autocast filters.
Give the ability a 1 second cooldown. Not required, but reduces lag if you have a lot of these respawning creeps.
Make the ability's effect be a modify unit effect. Tick "revive" in the modify effect's flags, and set the modify life, energy and shield fraction values to "1".
Flag the ability to be autocast, with autocast initially on.
Untick the "Disabled when dead" option from the ability.
Put the ability on the unit you want to respawn. Make sure the unit has a death time of -1.
Now, when your unit dies, it will autocast this ability and revive where it died after the prepare time.
Now, you have the problem of the creep potentially being kited far from it's spawn point. There are many ways to fix this, but I think the best way was described above.
At the start of the game, give each creep a custom value. You can make a trigger that just goes through all units in a unit group, and assigns them this custom value. You'll wait the custom value 0 to be the unit's X co-ordinates, and the custom value 1 to be it's Y co-ordinates. Sounds complicated, but it's not. It's 3 actions.
Now make a second trigger that activates when your revive ability is used, that instantly moves the creep to the XY co-ordinates that are stored in it's custom values.
If you've done all the above, you'll end up with infinitely respawning creeps that will never bug, require no hassle and take up nothing more than 1 ability, 1 effect and 2 triggers.
Well, I feel like using Death Time -1 and a revive trigger works the easiest and most reliable (When a unit dies it checks if it was a creep or a hero and then waits X seconds and then revives it, I'm pretty sure that accomplishes the same as your solution). However, I still have the problem to relocate the heros to the 3 places depending on which is closer.
I couldn't find an action to get the distance between two points.
About the creeps - the problem starts with my creeps not being in a unit group. I used a buff that times out after 0.1 seconds which puts the creep in the Creep unit group. Is there a better way?
I then have another trigger that goes 2 seconds after map initialisation that assigns the custom values.
The last trigger checks the unit type when a unit dies and if it's hover (the attribute for all my creeps) it then waits X, revives them, sets HP to 100%, and moves them to Custom Value 1 = X, Custom Value 2 = Y and Custom Value 3 = Facing.
This is working 100% fine, but it's sadly not the solution for the hero respawn problem.
Well, I feel like using Death Time -1 and a revive trigger works the easiest and most reliable (When a unit dies it checks if it was a creep or a hero and then waits X seconds and then revives it, I'm pretty sure that accomplishes the same as your solution). However, I still have the problem to relocate the heros to the 3 places depending on which is closer.
Make the "graveyards" a unit. Even an invisible one will do. Now, when your hero dies, use a "pick closest unit" action to get the closet graveyard. Then, move the hero to the picked unit.
About the creeps - the problem starts with my creeps not being in a unit group. I used a buff that times out after 0.1 seconds which puts the creep in the Creep unit group. Is there a better way?
Give them a unifying attribute. Maybe all creeps are owned by player 15? In which case you'd use a "pick all units in unit group" action. Maybe all the creeps have some (typically) useless flag like "Prevent Reveal"? Then, again, you can use "pick all units in unit group", with "units owned by player matching filter" to get all creep units. It's up to you.
Over 10 bridges and edges... why can't there be a function like that for points? >_>
----
There is; however you will need to compare the difference in distance between the points; as I stated above. Using a unit, the game will compare the distances for you, and pick the closest one. It saves you work to use a dummy unit, a little bit.
I'm not new to triggers, so complicated solutions welcome.
Right now I'm using in data Deathtime = -1 and a simple trigger:
Event: Any unit dies
Condition: Triggering unit = Biological
Actions: Wait X, Revive Unit
... because I don't want the units to lose items, levels etc.. Now my question for my creeps is: If I give them a buff that periodically applies another buff so they get stronger over time, does that buff keep running while they are dead?
For my "heros" it's a bit more complicated. I have 3 points on my map for them to respawn and I want them to respawn at the closest of those. How can I do that?
I would doubt they'd keep getting the buff, but since this is a data thing, I'm not entirely sure. I know triggers for instance, you can make things necessary and exclude them altogether. For example the "pick each unit in unit group" combined with "units in region matching condition" by default excludes dead units. Is there not something like that when creating your buff?
@MaskedImposter: Go
buffs have a flag to be OFF when dead. just uncheck
Aren't many buffs removed when a unit dies? I ran into this problem in my game; I needed to keep track of what buffs a unit had on death to make sure I could reapply them.
A good method I have seen other people use; they put a buff on units, so that when they take fatal damage, the unit becomes invulnerable, and cannot move/attack/ect for X seconds; then the unit is moved and healed to wherever you want your units to respawn. It takes the "death" part out of dying; but it serves the same purpose; except no buffs/attributes/items will be lost.
To get the closest respawn point; there should be an action to get the distance between 2 points. You simply get the distance from "position of dying unit" to points 1, 2 and 3. Then you compare those values to get the lowest value.
You didn't ask, but here is another good solution for creeps respawning. Use custom values to save the initial X and Y values of the unit; on map init. Set custom value 1 to X position on map, and value 2 to Y position. Then as your units move around the map; they will always respawn at their initial locations (move unit to X,Y coordinate)
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
Tick the "permanent" and "enabled while dead" flags in the behavior, and this will stop buffs from being removed while the unit is dead.
I could need something like that, so how do I do that in a good way? I have a real large amount of creep camps (about 20-30 or so) and I dont want to make points for them. Best would be if you give me an example or describe it a bit more thoroughly.
I know my way around triggers, but I've never done something like this before, so keep that in mind.
I found a good solution for this by using fake unit death (just actor visual) and then hide unit and teleport to whatever place out of battle. It is also good because if you have some persistent trigger abilities based on "damage unit" function it won't fire errors like "couldn't find "Attacker", because hero won't be dead actualy.
Make an ability, effect-instant.
Make it have a prepare time of 20 seconds (or however long you want the creep to take to respawn).
Make the ability require "dead" and "self" in the target filters. Apply the same to the autocast filters.
Give the ability a 1 second cooldown. Not required, but reduces lag if you have a lot of these respawning creeps.
Make the ability's effect be a modify unit effect. Tick "revive" in the modify effect's flags, and set the modify life, energy and shield fraction values to "1".
Flag the ability to be autocast, with autocast initially on.
Untick the "Disabled when dead" option from the ability.
Put the ability on the unit you want to respawn. Make sure the unit has a death time of -1.
Now, when your unit dies, it will autocast this ability and revive where it died after the prepare time.
Now, you have the problem of the creep potentially being kited far from it's spawn point. There are many ways to fix this, but I think the best way was described above.
At the start of the game, give each creep a custom value. You can make a trigger that just goes through all units in a unit group, and assigns them this custom value. You'll wait the custom value 0 to be the unit's X co-ordinates, and the custom value 1 to be it's Y co-ordinates. Sounds complicated, but it's not. It's 3 actions.
Now make a second trigger that activates when your revive ability is used, that instantly moves the creep to the XY co-ordinates that are stored in it's custom values.
If you've done all the above, you'll end up with infinitely respawning creeps that will never bug, require no hassle and take up nothing more than 1 ability, 1 effect and 2 triggers.
Good luck!
Well, I feel like using Death Time -1 and a revive trigger works the easiest and most reliable (When a unit dies it checks if it was a creep or a hero and then waits X seconds and then revives it, I'm pretty sure that accomplishes the same as your solution). However, I still have the problem to relocate the heros to the 3 places depending on which is closer.
I couldn't find an action to get the distance between two points.
About the creeps - the problem starts with my creeps not being in a unit group. I used a buff that times out after 0.1 seconds which puts the creep in the Creep unit group. Is there a better way?
I then have another trigger that goes 2 seconds after map initialisation that assigns the custom values.
The last trigger checks the unit type when a unit dies and if it's hover (the attribute for all my creeps) it then waits X, revives them, sets HP to 100%, and moves them to Custom Value 1 = X, Custom Value 2 = Y and Custom Value 3 = Facing.
This is working 100% fine, but it's sadly not the solution for the hero respawn problem.
Make the "graveyards" a unit. Even an invisible one will do. Now, when your hero dies, use a "pick closest unit" action to get the closet graveyard. Then, move the hero to the picked unit.
Give them a unifying attribute. Maybe all creeps are owned by player 15? In which case you'd use a "pick all units in unit group" action. Maybe all the creeps have some (typically) useless flag like "Prevent Reveal"? Then, again, you can use "pick all units in unit group", with "units owned by player matching filter" to get all creep units. It's up to you.
Then I guess my buff is an acceptable solution (it works fine).
As for the graveyards - where can I get that action? It's not in the normal list, so maybe it's part of another action.
Edit: yeah it's a unit function so I need to make it this way:
Move unit instantly to (Position Of Unit) -> Unit = Unit closest to Point in Unitgroup.
Over 10 bridges and edges... why can't there be a function like that for points? >_>
Okay, so far it's working fine. If a problem occurs I will note it.
Now I only have this problem left: http://www.sc2mapster.com/forums/development/triggers/67866-how-to-make-a-neutral-unit-train-units-for-players/#p1
I'm thinking to take a hero selection asset and do it that way, but honestly, I hate dialogs so much. They eat so much time.
Quote from Scythe1250:
Over 10 bridges and edges... why can't there be a function like that for points? >_>
----
There is; however you will need to compare the difference in distance between the points; as I stated above. Using a unit, the game will compare the distances for you, and pick the closest one. It saves you work to use a dummy unit, a little bit.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418