First I am new to editing in general and SC2Mapster and would like to know how you add min-max damage to a unit when attacking so it doses like 5 damage one attack and 6 the next and so on etc? And how can I add a chance for all units to miss when attacking a unit on high ground or attacking a moving unit? If any one has instructions for ether that would be a let of help (sorry, new to the editor).
I'm not sure if it can be done in the data editor but I believe triggers could give you the desired effect.
Try something like this:
first, use the data editor to make the desired attack deal 1 damange.
Then for the trigger:
create a variable called "damage"
create a trigger
Event:
unit is attacked
Action:
set variable "damage" to random number between 1-10 (or however bit a range you want on how much dmg the attack might do)
general - if (conditions) then do (actions) else do (actions)
if variable = 1
then
set unit property (set(triggering unit) life to (((triggering unit) life (current)) - 5)
stop trigger
repeat the "if-then-else" chain until all desired variables are covered and i think this should work for ya.
for example, say you want a unit to deal 5-10 damage. have the variable create a random number between 1 and 7. if the variable is 1, inflict four damage (since the triggering attack already deals 1 damage) if the variable is 2, inflict 5 damage. if the variable is 3, inflict 6 damage. etc. And, to give your unit a chance to miss, have the variable 7 add +1 damage to offset the triggering attack and it will be as if you had a 1/7 chance of totally missing the target.
This might all need some tweaking, but I hope it works for ya.
on another note, if you were using this for an rpg you could create a dif trigger like this for every weapon available and under conditions have it check "only if weapon X" is equipped. that way it will deal dif randomized damage for each weapon available.
You can create a "buff" behavior, and set it to hidden.
The behavior needs "Damage Response" to be set to the % (1 = 100%, 0 = 0%) to activate, then down at the bottom you can select what types of attacks will be dodged. The "Modify Fraction" should be set to 0.
Thanks everyone for the help. I got the min-max damage to work but, steal having problems getting the chance to miss when attacking a unit on high ground or attacking a moving unit working.
For that you'll want to create a behavior with a damage response:
20% block 999 damage or whatever (there's multiple ways to do this)
then put a disable validator on it, you'll want to base these validators on:
CasterIsStationery
&
CliffLevelGreater
Then you want to put the behavior on every single unit and probably put a Show - Requirement on the behavior equal to constant 0 (so it never shows a tooltip).
That's basically how it's done, though you may have to tinker a bit to get it working.
Steal need help with high ground and moving miss percentage mechanics; I find the Behaviors data and do not know what to do or how to make a damage response. And hare is one attempt I made: first I added a CBehaviorBuff and copy from DamageDealtNone and based it on CBehaviorBuff and race set to Neutral.
Next I set the CBehaviorBuff_Damage Response_Chane to 0.99
Next I set the CBehaviorBuff_Damage_ModifyFraction to 1
Next I set the CBehaviorBuff_DiableValidatorArray to CasterlsStationary and CliffLevelGreater but, at this point I have know idea what to do or change.
And how do you add a Behavior(s) to a unit? I tried to add the Behavior I made to a unit in Unit data at the CUnit_BehaviorArray_Link and at the CUnit_AddedOnArray_BehaviorLink and when I test the map with the unit I changed it dose not look like any of my changes worked.
First I am new to editing in general and SC2Mapster and would like to know how you add min-max damage to a unit when attacking so it doses like 5 damage one attack and 6 the next and so on etc? And how can I add a chance for all units to miss when attacking a unit on high ground or attacking a moving unit? If any one has instructions for ether that would be a let of help (sorry, new to the editor).
I'm not sure if it can be done in the data editor but I believe triggers could give you the desired effect.
Try something like this: first, use the data editor to make the desired attack deal 1 damange.
Then for the trigger: create a variable called "damage"
create a trigger Event: unit is attacked Action:
repeat the "if-then-else" chain until all desired variables are covered and i think this should work for ya.
for example, say you want a unit to deal 5-10 damage. have the variable create a random number between 1 and 7. if the variable is 1, inflict four damage (since the triggering attack already deals 1 damage) if the variable is 2, inflict 5 damage. if the variable is 3, inflict 6 damage. etc. And, to give your unit a chance to miss, have the variable 7 add +1 damage to offset the triggering attack and it will be as if you had a 1/7 chance of totally missing the target.
This might all need some tweaking, but I hope it works for ya.
on another note, if you were using this for an rpg you could create a dif trigger like this for every weapon available and under conditions have it check "only if weapon X" is equipped. that way it will deal dif randomized damage for each weapon available.
hope it helps!
You can create a "buff" behavior, and set it to hidden.
The behavior needs "Damage Response" to be set to the % (1 = 100%, 0 = 0%) to activate, then down at the bottom you can select what types of attacks will be dodged. The "Modify Fraction" should be set to 0.
This *should* work
Giving a weapon a damage range can be done entirely in the data editor by just changing a couple fields without the need of any triggers.
1. Find the damage effect for the weapon you wish to modify.
2. Change the "Amount" field to the minimum damage of the weapon.
3. Change the "Random" field to the size of the range you wish.
For example: Amount = 5 and a Random = 3 will give your weapon a damage range of 5 - 8.
I don't know how to add in the miss chance, but fortunately Grogian seems to have found a solution while I was looking.
I hope this helps.
Thanks everyone for the help. I got the min-max damage to work but, steal having problems getting the chance to miss when attacking a unit on high ground or attacking a moving unit working.
@Betagame: Go
For that you'll want to create a behavior with a damage response:
20% block 999 damage or whatever (there's multiple ways to do this)
then put a disable validator on it, you'll want to base these validators on:
CasterIsStationery
&
CliffLevelGreater
Then you want to put the behavior on every single unit and probably put a Show - Requirement on the behavior equal to constant 0 (so it never shows a tooltip).
That's basically how it's done, though you may have to tinker a bit to get it working.
Steal need help with high ground and moving miss percentage mechanics; I find the Behaviors data and do not know what to do or how to make a damage response. And hare is one attempt I made: first I added a CBehaviorBuff and copy from DamageDealtNone and based it on CBehaviorBuff and race set to Neutral.
Next I set the CBehaviorBuff_Damage Response_Chane to 0.99
Next I set the CBehaviorBuff_Damage_ModifyFraction to 1
Next I set the CBehaviorBuff_DiableValidatorArray to CasterlsStationary and CliffLevelGreater but, at this point I have know idea what to do or change.
And how do you add a Behavior(s) to a unit? I tried to add the Behavior I made to a unit in Unit data at the CUnit_BehaviorArray_Link and at the CUnit_AddedOnArray_BehaviorLink and when I test the map with the unit I changed it dose not look like any of my changes worked.
@Grogian: Go
@SirLyrrad: Go
Works like a charm
Thanks!