I am re-doing a builder for a map that my friend and me are developing.
The unit can split itself if there is enough supply, to create two units with the exact same abilities and stats, but with 50% growth. Growth reduces the damage dealt and the maximum life, but can also increase it if it's over 100%. So a 50% unit deals only 50% damage and only has 50% max HP. They grow with time until they reach 100%. At any given time the units can be united to get a unit with >100% growth, which then has more than the usual HP and damage.
To do this in a nice-looking and proper fashion, I would like "growth" to be an attribute. But I don't know how to setup the attribute to act like I want and I also don't know what to do with triggers. I assume I need two different behaviors or attributes for this, because I cannot think of a way to have a single attribute/behavior reduce the % of damage and HP aswell as increase it, depending on stackcount.
you can create a behavior that lasts forever; with a periodic effect which adds 1 behavior that adds 1% life and 1% damage. Set the periodic time to however often you want this growth. add this behavior to the units in the data editor; so they always have it.
create another behavior which reduced life and damage by 50% each (easily doable in the same behavior)
whatever trigger or ability you use to split your workers; just add this second behavior to the workers when they are split, and remove all behaviors of type (the one above that you created)
When you combine your units, add X stack of behaviors to there, where X is the number of behaviors on the unit being removed. This should be done through triggers.
Well, but they can split more than once. You start with one builder, who then splits into up to 5 smaller versions of itself. It should work with every thinkable variation.
Also keep in mind that I want to be able to combine two of those workers at any given time to add their growth to the unit that is created.
okay; I do not mean to be rude at all, but you needs to talk more in the text of triggers. I dont see how what I posted is unusable for 20 splits, or 300 mergers.
every time you split, the split units will have half of their normal HP and damage. When they merge, the single remainng unit will have all of the bonus %'s that the 2 smaller units had.
As you suggesting that a unit currently at 50% hp can split again? cutting that 50% in half once again? if that is the case; add the 50% reduction buff twice (for a total of 75% reduction)
Yes - and it can happen that for example you have 4 units at 25% and then 3 die. And you split the last remaining one into 4 again, each having 6.25% of the normal strength then.
alright; so, you are still being reasonably unclear in the grand scheme of things. I would still like that say that with minor manipulation to what I gave you above, you can still create any of this.
a unit has 110% its normal strength and splits into 2:
add a -50% buff, add 5 1% buffs
split it into 4? add 2 -50% buffs and 2 (rounded down) 1% buff
you could do the entire thing through + and - 1% buffs but that would create lag if more than a couple of people are playing.
Another way to do it, possibly more easily to keep track of numbers (if you decide to use all 1% buffs) would be to use the units custom values as variables to count buff stacks in a nicer way.
Sorry, I am trying to be clear, but it's not that easy.
So my own idea was to have 2 behaviors where one reduces the maximum vitals fraction by 0.01 and the damage dealt fraction by 0.01 [#1] and the other increases it by that amount [#2]. And then tie them to an attribute via triggers.
So the unit starts with 100 Growth - the attribute I want to make. Whenever it gets below 100 Growth (by splitting) it gets stacks of the first behavior [#1] depending on [100 - Current Attribute Stack]. And whenever it gets above 100% it gets stacks of the other behavior [#2] depending on [Current Attribute Stack - 100].
And there is another behavior on the unit that gives +1 of that attribute periodically - but I guess that's obvious.
So I tried it with mostly Data, but it doesn't work. I now need to find a way to make the trigger remove 50% of the stacks of the behavior that adds the attribute when the unit splits. I am not good at triggers so any help appreciated (I know this isn't really hard, but I still can't do it).
Eh - could solve my problems, but I might have one left.
Whenever the growth on a unit changes, I run a bunch of actions: Remove all growth buffs/debuffs from the unit and add an amount of those buffs/debuffs again depending on the growth. This causes the unit to be healed to 100% though. What can I do to leave the system like this (because it perfectly adjust to any change to growth that can happen) and make sure when the unit gains growth it isn't fully healed?
You have to grab the value the units life current before the growth, save it to a variable of sorts, do the growth, and then set the units life stat back to the variable.
I recommend storing the unit's current HP in a custom value for that unit. That way you don't have to deal with making new variables or setting a variable to have 1000 dimensions, etc. You could also store the current HP % so, whenever growth occurs, that unit's current HP will increase proportionately.
Yup thats why i said a variable of sorts. Custom value are great if you need to store tons of numbers unique to each unit; then again if you could do this all in a single trigger from before the growth you could just use a single local variable that would get cleared everytime.
I used a signle local variable. I just didn't know how to get the current life percentage as integer, but I figured it out. Thanks, everything working great.
Just out of curiosity - if I split a unit at very low HP, the unit dies. I used the same local variable and the same trigger basically (first action is setting the variable to current life percentage and the last action is to set it to this value again). Now I changed the "Set Variable" function to an expression "current life percentage" +1 and due to the +1 it now works properly and the unit doesn't die.
Anyone know why this happened? What does the life percentage trigger return? I think when at very low HP it returns "0" as percentage if life is under 0.5% and thus kills the unit. The +1 prevents that of course.
I am re-doing a builder for a map that my friend and me are developing.
The unit can split itself if there is enough supply, to create two units with the exact same abilities and stats, but with 50% growth. Growth reduces the damage dealt and the maximum life, but can also increase it if it's over 100%. So a 50% unit deals only 50% damage and only has 50% max HP. They grow with time until they reach 100%. At any given time the units can be united to get a unit with >100% growth, which then has more than the usual HP and damage.
To do this in a nice-looking and proper fashion, I would like "growth" to be an attribute. But I don't know how to setup the attribute to act like I want and I also don't know what to do with triggers. I assume I need two different behaviors or attributes for this, because I cannot think of a way to have a single attribute/behavior reduce the % of damage and HP aswell as increase it, depending on stackcount.
you can create a behavior that lasts forever; with a periodic effect which adds 1 behavior that adds 1% life and 1% damage. Set the periodic time to however often you want this growth. add this behavior to the units in the data editor; so they always have it.
create another behavior which reduced life and damage by 50% each (easily doable in the same behavior)
whatever trigger or ability you use to split your workers; just add this second behavior to the workers when they are split, and remove all behaviors of type (the one above that you created)
When you combine your units, add X stack of behaviors to there, where X is the number of behaviors on the unit being removed. This should be done through triggers.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
Well, but they can split more than once. You start with one builder, who then splits into up to 5 smaller versions of itself. It should work with every thinkable variation.
Also keep in mind that I want to be able to combine two of those workers at any given time to add their growth to the unit that is created.
okay; I do not mean to be rude at all, but you needs to talk more in the text of triggers. I dont see how what I posted is unusable for 20 splits, or 300 mergers.
every time you split, the split units will have half of their normal HP and damage. When they merge, the single remainng unit will have all of the bonus %'s that the 2 smaller units had.
As you suggesting that a unit currently at 50% hp can split again? cutting that 50% in half once again? if that is the case; add the 50% reduction buff twice (for a total of 75% reduction)
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
Yes - and it can happen that for example you have 4 units at 25% and then 3 die. And you split the last remaining one into 4 again, each having 6.25% of the normal strength then.
alright; so, you are still being reasonably unclear in the grand scheme of things. I would still like that say that with minor manipulation to what I gave you above, you can still create any of this.
a unit has 110% its normal strength and splits into 2:
add a -50% buff, add 5 1% buffs
split it into 4? add 2 -50% buffs and 2 (rounded down) 1% buff
you could do the entire thing through + and - 1% buffs but that would create lag if more than a couple of people are playing.
Another way to do it, possibly more easily to keep track of numbers (if you decide to use all 1% buffs) would be to use the units custom values as variables to count buff stacks in a nicer way.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
Sorry, I am trying to be clear, but it's not that easy.
So my own idea was to have 2 behaviors where one reduces the maximum vitals fraction by 0.01 and the damage dealt fraction by 0.01 [#1] and the other increases it by that amount [#2]. And then tie them to an attribute via triggers.
So the unit starts with 100 Growth - the attribute I want to make. Whenever it gets below 100 Growth (by splitting) it gets stacks of the first behavior [#1] depending on [100 - Current Attribute Stack]. And whenever it gets above 100% it gets stacks of the other behavior [#2] depending on [Current Attribute Stack - 100].
And there is another behavior on the unit that gives +1 of that attribute periodically - but I guess that's obvious.
So I tried it with mostly Data, but it doesn't work. I now need to find a way to make the trigger remove 50% of the stacks of the behavior that adds the attribute when the unit splits. I am not good at triggers so any help appreciated (I know this isn't really hard, but I still can't do it).
Surprisingly, I got it to work myself. Seems like I learn quite fast in terms of triggers.
If anyone wants to do a similar ability or unit, write it, so I can post you the map.
I might need further help - if so, I will reply here another time.
Eh - could solve my problems, but I might have one left.
Whenever the growth on a unit changes, I run a bunch of actions: Remove all growth buffs/debuffs from the unit and add an amount of those buffs/debuffs again depending on the growth. This causes the unit to be healed to 100% though. What can I do to leave the system like this (because it perfectly adjust to any change to growth that can happen) and make sure when the unit gains growth it isn't fully healed?
You have to grab the value the units life current before the growth, save it to a variable of sorts, do the growth, and then set the units life stat back to the variable.
@hobbidude: Go
I recommend storing the unit's current HP in a custom value for that unit. That way you don't have to deal with making new variables or setting a variable to have 1000 dimensions, etc. You could also store the current HP % so, whenever growth occurs, that unit's current HP will increase proportionately.
@BasharTeg: Go
Yup thats why i said a variable of sorts. Custom value are great if you need to store tons of numbers unique to each unit; then again if you could do this all in a single trigger from before the growth you could just use a single local variable that would get cleared everytime.
I used a signle local variable. I just didn't know how to get the current life percentage as integer, but I figured it out. Thanks, everything working great.
Just out of curiosity - if I split a unit at very low HP, the unit dies. I used the same local variable and the same trigger basically (first action is setting the variable to current life percentage and the last action is to set it to this value again). Now I changed the "Set Variable" function to an expression "current life percentage" +1 and due to the +1 it now works properly and the unit doesn't die.
Anyone know why this happened? What does the life percentage trigger return? I think when at very low HP it returns "0" as percentage if life is under 0.5% and thus kills the unit. The +1 prevents that of course.
@Scythe1250: Go
The difference is between integers and reals as most unit stats are actually real numbers.