I am working on a unit splitting mini game, and I need to change a unit's attack range, max health, and attack priority on the fly with some equations. I did not see any options in the unit editor or the trigger's list of actions to make these stats change according to variables or equations. Here's more details on how & why each are needed:
Attack Range: The unit's attack range is determined by an equation of how many units are left alive. As units die, the attack range of the units lowers. The attack range only matters for the basic attack. My demo is using Ghosts with their C-10 Canister Rifle.
Max Health: The unit's max health is to be equal to the number of units that are alive. I found a few ways to do this already, but I would prefer to change the unit's max health instead of these methods:
* * Amplify the damage the unit takes.
* * Damage the unit.
Attack Priority: Units that are grouped together will be targeted over units that are by themselves, and then the targets are prioritized by distance. I imagined creating a hidden ability that scans to determine how many units are within a certain radius of that unit.
One alternative for all three I thought of is doing unit upgrades; however, that would mean having a rank of the upgrade for each possible value. Does anyone have any other suggestions on how these can be done?
Additionally, here's some other features I'm considering that I could use advice for:
Zooming out the player's camera
Displaying text like a texture on the ground (rather than making the text a part of the UI); preferably with the ability to update the text like in dialog
Apply a colored aura on a unit whenever the unit is within range of a point or target unit
With damage stuff you can use the "catalog" triggers. But I've never tried to figure out how to use an equation with them. Some people will just use the set handicap trigger to set increased difficulty over time, as it affects many things.
I successfully got the maximum health of units to change by changing units' properties.
However, I have not found any way to change a unit's attack range or a unit's attack priority by an equation. I could create upgrades, but the game has 50+ units which would mean creating 50+ upgrades and manually changing the value of each upgrade to tune it. I can also do the attack priority with a lengthy trigger that determines what unit is the highest value target and then sends an order to the attacking unit, but similarly would require changing 50+ actions if I wanted to make a single change to the equation.
Attack priority is locked once the game is started. Changing it is impossible by any means.
You can make a unit not be a threat (which will set it's attack priority to 0) by disabling it's weapons, but you can not, say, change attack priority from 20 to 19 mid-game.
What I need to have happen is changing the target of a Baneling's attack to target the Ghost that will kill the most Ghosts. I think I could make an ability for Ghosts that would scan to see how many Ghosts are within a Baneling's blast radius of that individual Ghost. Using that number (X), I would prefer to create the equation:
P = X + .1 * D; where P is that Ghost's priority score and D is the distance between
Then when Banelings are to be given an attack order, the Baneling scans all alive Ghosts to determine which has the highest priority score and is ordered to attack that Ghost. This scan would have to reoccur often. I also will need to lock in the Baneling's target after 5 seconds to ensure players don't kite the AI.
Would a trigger be the way to tell the Baneling what to do, or is there some kind of AI script that could be edited to do this?
I didn't test any of this, its on the fly. And I can't say if its the most optimised way to do it, but that how I would do it.
What you need
A behavior that is on all your unit
Event
I suggest you add unit into a group upon creation. Its easier to manage
I suggest you use that same group when unit "die"
Event death
That where you want your trigger. Applying to any unit in a group.
------- To change attack range and health UnitGroup-ForeachunitUnitVariablein(Lastcreatedunits)do(Actions)Actions------- Attack range BEHAVIORCatalog-SetvalueofBehaviorsBehaviorVariableModification.WeaponRangeforplayer(OwnerofUnitVariable)to(String(((ValueofBehaviorsBehaviorVariableModification.WeaponRangeforplayer(OwnerofUnitVariable)asaninteger)-1)))------- HealthCatalog-SetvalueofUnits(UnittypeofUnitVariable)LifeMaxforplayer(OwnerofUnitVariable)to(String(((ValueofUnits(UnittypeofUnitVariable)LifeMaxforplayer(OwnerofUnitVariable)asaninteger)-1)))
Camera distance
Data ->
Cameras ->
Default Camera ->
Zoom level ->
Increase the data as the other zoon increase which is +4/+4 0 mean the maximum. 9 is the most zoomed.
Countdown
I don't know if its what your talking about...
Map ->
Map properties ->
Options ->
Show game start countdown
Colored aura
Can be done through data, I can explain more, if actually data interest you.
Attack priority
Make a dummy ability that trigger each .5 second with auto-cast on.
And add a event that trigger every time that ability is used.
In this example I use 10 as range anyway you got the idea, you can work from there. Just warning you, might be laggy, you will need a lot of optimisation.
You can easy get how much unit are stack within which range. And then apply the attack priority according to the number.
I have no clue if the other guy say the truth about you cannot change attack priority.
I assume you know how to make your calculation, you just have to change the 1 according to the value you want.
low cost approach: you can give every unit some basic range (0 for example) and then create behaviour that will increase range of the unit by 0.5. To get the unit with weapon range of 5 you will need to add 10 buffs to that unit, and you can calculate that via trigger by estimating amount of stacks of that behaviour.
high cost approach without limitation (what i'm using lately): fully triggered alternative for default attack&weapon using unit's custom values.
I am working on a unit splitting mini game, and I need to change a unit's attack range, max health, and attack priority on the fly with some equations. I did not see any options in the unit editor or the trigger's list of actions to make these stats change according to variables or equations. Here's more details on how & why each are needed:
One alternative for all three I thought of is doing unit upgrades; however, that would mean having a rank of the upgrade for each possible value. Does anyone have any other suggestions on how these can be done?
Additionally, here's some other features I'm considering that I could use advice for:
For the health changer, you can just use the set unit property action and set life to whatever, I don't know how to do the other 2 things.
To zoom out a player's camera, make a new camera that is more zoomed out and use the action set camera.
For the countdown, use a 10 second timer, unless you want it bigger then I can't help you.
GL
With damage stuff you can use the "catalog" triggers. But I've never tried to figure out how to use an equation with them. Some people will just use the set handicap trigger to set increased difficulty over time, as it affects many things.
I successfully got the maximum health of units to change by changing units' properties.
However, I have not found any way to change a unit's attack range or a unit's attack priority by an equation. I could create upgrades, but the game has 50+ units which would mean creating 50+ upgrades and manually changing the value of each upgrade to tune it. I can also do the attack priority with a lengthy trigger that determines what unit is the highest value target and then sends an order to the attacking unit, but similarly would require changing 50+ actions if I wanted to make a single change to the equation.
Any more suggestions?
Attack priority is locked once the game is started. Changing it is impossible by any means.
You can make a unit not be a threat (which will set it's attack priority to 0) by disabling it's weapons, but you can not, say, change attack priority from 20 to 19 mid-game.
What I need to have happen is changing the target of a Baneling's attack to target the Ghost that will kill the most Ghosts. I think I could make an ability for Ghosts that would scan to see how many Ghosts are within a Baneling's blast radius of that individual Ghost. Using that number (X), I would prefer to create the equation:
P = X + .1 * D; where P is that Ghost's priority score and D is the distance between
Then when Banelings are to be given an attack order, the Baneling scans all alive Ghosts to determine which has the highest priority score and is ordered to attack that Ghost. This scan would have to reoccur often. I also will need to lock in the Baneling's target after 5 seconds to ensure players don't kite the AI.
Would a trigger be the way to tell the Baneling what to do, or is there some kind of AI script that could be edited to do this?
First :
I didn't test any of this, its on the fly. And I can't say if its the most optimised way to do it, but that how I would do it.
What you need
A behavior that is on all your unit
Event
I suggest you add unit into a group upon creation. Its easier to manage I suggest you use that same group when unit "die"
Event death
That where you want your trigger. Applying to any unit in a group.
Camera distance
Data -> Cameras -> Default Camera -> Zoom level -> Increase the data as the other zoon increase which is +4/+4 0 mean the maximum. 9 is the most zoomed.
Countdown
I don't know if its what your talking about... Map -> Map properties -> Options -> Show game start countdown
Colored aura
Can be done through data, I can explain more, if actually data interest you.
Attack priority
Make a dummy ability that trigger each .5 second with auto-cast on. And add a event that trigger every time that ability is used. In this example I use 10 as range anyway you got the idea, you can work from there. Just warning you, might be laggy, you will need a lot of optimisation. You can easy get how much unit are stack within which range. And then apply the attack priority according to the number.
Final note
I have no clue if the other guy say the truth about you cannot change attack priority. I assume you know how to make your calculation, you just have to change the 1 according to the value you want.
For weapon range:
low cost approach: you can give every unit some basic range (0 for example) and then create behaviour that will increase range of the unit by 0.5. To get the unit with weapon range of 5 you will need to add 10 buffs to that unit, and you can calculate that via trigger by estimating amount of stacks of that behaviour.
high cost approach without limitation (what i'm using lately): fully triggered alternative for default attack&weapon using unit's custom values.
I saw your pm. I will continue here cuz pm sometimes doesn't work.
I dont know why you insist on using upgrades, but i suggest using buffs instead. Made very simple map, cuz i assume you are total novice in editor.