Stuff that might help you:
- Trigger: On unit clicked set a variable with the unit being clicked as your hero target
- Trigger: On ability hotkey pressed: Issue Unit Order (ability) Targeting Unit (your hero target)
You might intercept the Select Target ability state in a trigger and perform the Issue Unit Order on any target you want. By default pressing a command card button will take you step by step through all ability execution state machine (Select target -> Execution)
Catalog Set Value seems a good way to modify combat mechanics like damage, critical strike chances, armor reduction based on hero attributes.
The way I modify the hero's melee weapon damage based on the Strength attribute is like this:
Create a MeleeDamage damage effect
Use this effect on all melee weapons the hero can equip
Create a trigger that updates the MeleeDamage effect amount and random values whenever the hero attributes change. With this trigger you can set the damage based on whatever formula you wish to use, pretty useful. To modify the MeleeDamage effect Catalog Set Value can be used as follows:
Catalog - Set value of Effects "MeleeDamage" "Amount" for player player to (String(minDmg) with Any Precision decimal places)
Catalog - Set value of Effects "MeleeDamage" "Random" for player player to (String((maxDmg - minDmg)) with Any Precision decimal places)
To obtain weapons with different damage ranges you can create another 2 attributes (MinMeleeDamage, MaxMeleeDamage) and have the item equipping the weapon buff this 2 attributes
Works like a charm so far although I haven't tested it yet in multiplayer but since each player has a different catalog I suppose it should work.
Now we can extend this method to model the critical strike mechanic based on stats (e.g.: 1 point in Agility modifies the critical strike chance by 0.1%)
Basically all weapons and abilities will use a SetEffect as their damage effect containing an ApplyBehavior effect and the actual Damage effect.
The ApplyBehavior effect will apply a Buff effect on the target named CriticalStrikeDebuff.
The CriticalStrikeDebuff's DamageResponse is set up like this:
Has only 1 charge (this way will be consumed by the following damage effect in this case the damage effect from your set)
Has a chance to occur
Has the ModifyFraction field set to 2.0
Basically you can use the same CriticalStrikeDebuff on all abilities and weapons inflicting damage (or you can create separate ones for Melee damage and Spell damage or some abilities having a higher critical chance)
So far it works however Set Catalog Value doesn't work for CriticalStrikeDebuff:
Catalog - Set value of Behaviors "CriticalStrikeDebuff " "DamageResponse.Chance" for player player to (String(critChance) with Any Precision decimal places)
This action issues a ErrorCatalogFieldNotWritten.
Note that Catalog - Get value works using the same parameters.
I can only think about 2 possible answers:
1. Some catalog entries are read-only, that is we cannot modify them.
2. Catalog Set Value is bugged or I don't know how to properly use it. Maybe Catalog Set Value uses a different way to index subfields I don't know about (hopefully)
Does anyone know which is which or a way to use Catalog Set Value that works?
Make a Buff Behavior, in the Damage Response field set the Chance to whatever you want the critical strike % to be. (You can make multiple behaviors for multiple levels of Critical Strike if you want) and then set the Modify Fraction to whatever you want (2 for double damage.) Set this behavior to have a duration of 0.1.
Now make two new effects, an Apply Behavior effect that applies the behavior you just created to the effect target, and a Set that adds both the Apply Behavior and the Damage effect from your hero's attack. Make sure that the Apply Behavior comes first in the list. Now wherever the Damage effect is referenced, change it to reference the Set instead.
What happens is that when your hero attacks, the behavior will be applied to the target of the attack, and there's a chance the damage response will be triggered and increase the damage taken, and then the behavior immediately expires.
If there's a simpler way of doing it I haven't found it.
This seems a good way to go at it with some minor modifications:
The Damage Response Behavior can remove itself by adding only 1 charge on it (no need for duration 0.01 seconds, leave duration to 0). That also means you don't need to add a remove behavior on the effect. I don't think any _other_ damage effect will consume the buff before your damage effect (seems reasonable)
Doubling the damage by dealing another identical Damage Effect to the target might have some undesired side effects like:
- one of the damage effect being dodged (won't be much of a crit in this case)
- if the defender has a damage response that retaliates with some damage against an attack it will retaliate twice on a critical strike
0
@threeleven: Go
Stuff that might help you: - Trigger: On unit clicked set a variable with the unit being clicked as your hero target - Trigger: On ability hotkey pressed: Issue Unit Order (ability) Targeting Unit (your hero target)
You might intercept the Select Target ability state in a trigger and perform the Issue Unit Order on any target you want. By default pressing a command card button will take you step by step through all ability execution state machine (Select target -> Execution)
0
@TJjOriS: Go
You can create a TextActor to display the unit name. Didn't use it myself yet but it might be just what you need.
0
@gizmachu: Go
Same problem here. You can get the value but you cannot set it.
Does anyone know anything?
0
Catalog Set Value seems a good way to modify combat mechanics like damage, critical strike chances, armor reduction based on hero attributes. The way I modify the hero's melee weapon damage based on the Strength attribute is like this:
Works like a charm so far although I haven't tested it yet in multiplayer but since each player has a different catalog I suppose it should work.
Now we can extend this method to model the critical strike mechanic based on stats (e.g.: 1 point in Agility modifies the critical strike chance by 0.1%)
Basically all weapons and abilities will use a SetEffect as their damage effect containing an ApplyBehavior effect and the actual Damage effect. The ApplyBehavior effect will apply a Buff effect on the target named CriticalStrikeDebuff. The CriticalStrikeDebuff's DamageResponse is set up like this:
Basically you can use the same CriticalStrikeDebuff on all abilities and weapons inflicting damage (or you can create separate ones for Melee damage and Spell damage or some abilities having a higher critical chance)
So far it works however Set Catalog Value doesn't work for CriticalStrikeDebuff:
I can only think about 2 possible answers: 1. Some catalog entries are read-only, that is we cannot modify them. 2. Catalog Set Value is bugged or I don't know how to properly use it. Maybe Catalog Set Value uses a different way to index subfields I don't know about (hopefully)
Does anyone know which is which or a way to use Catalog Set Value that works?
Thank you
0
This seems a good way to go at it with some minor modifications: The Damage Response Behavior can remove itself by adding only 1 charge on it (no need for duration 0.01 seconds, leave duration to 0). That also means you don't need to add a remove behavior on the effect. I don't think any _other_ damage effect will consume the buff before your damage effect (seems reasonable)
Doubling the damage by dealing another identical Damage Effect to the target might have some undesired side effects like: - one of the damage effect being dodged (won't be much of a crit in this case) - if the defender has a damage response that retaliates with some damage against an attack it will retaliate twice on a critical strike