First off we are going to need a Behavior. So go to your Behaviors Tab.
Right Click > Insert New Object
Name the Object Add Damage (or whatever you want), suggest a name, make it a Buff, then click okay.
Go to your modification field and go to the Combat Tab.
Under Damage Dealt (Unscaled) set everything to 1 (or how ever much damage you want to add) then click OK.
Under the Stats - Flags field check Hidden, this will hide an Icon when the behavior is applied to a unit.
Thats it for the Data Editor.
Trigger Editor
Creating a Dialog
Open up the Trigger Editor and make a new Variable, name it dialogButtons and set it to Dialog Item. Set it to an Array of 1.
Create a new Action Definition and name it Create UI.
Under Actions create 6 actions (in this order):
Create Dialog
Create Dialog Item (Button)
Set Variable
Create Dialog Item (Button)
Set Variable
Show/Hide Dialog
The 1st action's (Create Dialog) stats should be:
Modal: Modal
Width: 300
Height: 205
OffsetX: 0
OffsetY: 0
Anchor: Left
The 2nd action's (Create Dialog Item [Button]) stats should be:
Dialog: Last Created Dialog
Width: 200
Height: 50
Anchor: Top Left
Offset X: 50
Offset Y: 50
Tooltip: ""
Button Text: Add Damage
Hover Image: ""
The 3rd action's (Set Variable) stats should be:
Variable: dialogButtons[0]
-Index 1: 0
Value: Last Created Dialog Item
The 4th action's (Create Dialog Item [Button]) stats should be:
Dialog: Last Created Dialog
Width: 200
Height: 50
Anchor: Top Left
Offset X: 50
Offset Y: 105
Tooltip: ""
Button Text: Remove Damage
Hover Image: ""
The 5th action's (Set Variable) stats should be:
Variable: dialogButtons
-Index 1: 1
Value: Last Created Dialog Item
The last action's (Show/Hide Dialog) stats should be:
Visible: Show
Dialog: Last Created Dialog
Players: All Players
Under your initilization trigger insert a Action and search for Create UI.
Adding and Removing the Add Damage Behavior from your Unit
Create a new Trigger and name it Add Damage.
Add a Dialog Item is Used Event to the new trigger.
Add a Comparison condition to the Trigger.
Stats of the Comparison Condition:
Value 1: Used Dialog Item
Operator: ==
Value 2: dialogButtons
-Index 1: 0
Add a Add Behavior action to the trigger.
Add Behavior stats:
Count: 1
Behavior: Add Damage
Unit: Pre-Placed Unit [Set This to the unit you placed at the start of this tutorial]
Caster: Pre-Placed Unit [Set This to the unit you placed at the start of this tutorial]
Now we are going to do pretty much the same thing in the next trigger so copy and paste the Add Damage trigger and rename it Remove Damage
We are going to change the condition and the action.
Condition Stats:
Value 1: Used Dialog Item
Operator: ==
Value 2: dialogButtons
-Index: 1
Change the action to Remove Behavior and the stats should be:
Count: 1
Behavior: Add Damage
Unit: Pre-Placed Unit [Set This to the unit you placed at the start of this tutorial]
Hope this made sense and helped you!
If you need pictures tell me and I'll set them up for you...
Please give me some advice as it is my first tutorial...
I had a bit of a skim over. Dialog probably isn't necessary to the tutorial, maybe simplify it a little by just using the 'chat message' event handler I.E. if any player types "hitme"
then do actions
The bigger issue though (sorry to pick it apart) is that using a behaviour to apply damage is NOT going to give credit to the attacking unit, since there is no attacking unit. Rather you should be using the 'Environment - Damage unit from unit' command. Create a dummy 'damage' effect that applies 0 zero and set this as the damaging effect in the trigger command. Then you can specify the target, as well as the source, and then add the damage you'd like applied as the 'extra damage' parameter. So if the target dies from taking this damage, kill count/resources/experience are creditted to the source unit
I've just created an ability in my map that uses a combination of this as well as behaviors to deal damage. Basically the source unit has an ability that can be toggled on/off, when it's on the source unit gains a dummy behavior buff. When any unit with that behavior attacks something, the target gains a 'burn' behavior which is just a dummy behavior buff as well. That 'buff' applies a dummy damage effect every second for X amount of seconds. Whenever that effect goes off (it does no damage itself), it executes the Deal Damage to Unit action. Which then finally uses yet ANOTHER dummy damage effect (since if it was the same it'd create an infinate loop) to deal 1/2/3 damage each time depending on your level
Ultimately if you active this ability, then every time you shoot someone they begin to burn and take additional damage over time. But that damage is creditted to the original attacking unit. Even if multiple sources attack the same target using the same ability, the damage stacks and is creditted to the correct sources
Tried this quickly, And it seem to work!
I had been trying to get this to work earlier with Attributes, but there seem to be no way to modify Attribute Behaviours with triggers, witch bums me a bit since I want to be able to add Attribute Tomes to my map.
Try this. instead of attributes having a behavior to change stats... like damage, have a set of variables that add the behavior. That way you can modify the variables when the player uses a str tome and have a trigger that when the str variable changes-> add behavior to unit.
That should work well. You could even have regular attributes and I believe there is an event for when attributes change. So if str goes up when a hero levels then increase the str variable and apply the behavior. This way you still have the strength attribute visable in the unit display.
Be carefull, if you are adding insane amount behaviors, that can lag the map (like 10 units with 1000xdamage behavior).
Here is simple way to add only few behavior:
Unit - Add ("wanted damage value"/ 1000) "Damage 1000" to (Last created unit) from (Last created unit)
Unit - Add (("wanted damage value" mod 1000) / 100) "Damage 100" to (Last created unit) from (Last created unit)
Unit - Add (("wanted damage value" mod 100) / 10) "Damage 10" to (Last created unit) from (Last created unit)
Unit - Add ("wanted damage value" mod 10) "Damage 1" to (Last created unit) from (Last created unit)
"damage x" = is a behavior with x damage.
this will nicely reduce the added behaviors up 9999 damage.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Damage Adding though Triggers
by XDret
Before you do anything put a unit on your map.Starting with the Data Editor
First off we are going to need a Behavior. So go to your Behaviors Tab. Right Click > Insert New Object Name the Object Add Damage (or whatever you want), suggest a name, make it a Buff, then click okay. Go to your modification field and go to the Combat Tab. Under Damage Dealt (Unscaled) set everything to 1 (or how ever much damage you want to add) then click OK. Under the Stats - Flags field check Hidden, this will hide an Icon when the behavior is applied to a unit. Thats it for the Data Editor.
Trigger Editor
Creating a Dialog
Open up the Trigger Editor and make a new Variable, name it dialogButtons and set it to Dialog Item. Set it to an Array of 1. Create a new Action Definition and name it Create UI. Under Actions create 6 actions (in this order): Create Dialog Create Dialog Item (Button) Set Variable Create Dialog Item (Button) Set Variable Show/Hide Dialog The 1st action's (Create Dialog) stats should be: Modal: Modal Width: 300 Height: 205 OffsetX: 0 OffsetY: 0 Anchor: Left The 2nd action's (Create Dialog Item [Button]) stats should be: Dialog: Last Created Dialog Width: 200 Height: 50 Anchor: Top Left Offset X: 50 Offset Y: 50 Tooltip: "" Button Text: Add Damage Hover Image: "" The 3rd action's (Set Variable) stats should be: Variable: dialogButtons[0] -Index 1: 0 Value: Last Created Dialog Item The 4th action's (Create Dialog Item [Button]) stats should be: Dialog: Last Created Dialog Width: 200 Height: 50 Anchor: Top Left Offset X: 50 Offset Y: 105 Tooltip: "" Button Text: Remove Damage Hover Image: "" The 5th action's (Set Variable) stats should be: Variable: dialogButtons -Index 1: 1 Value: Last Created Dialog Item The last action's (Show/Hide Dialog) stats should be: Visible: Show Dialog: Last Created Dialog Players: All Players Under your initilization trigger insert a Action and search for Create UI.Adding and Removing the Add Damage Behavior from your Unit
Create a new Trigger and name it Add Damage. Add a Dialog Item is Used Event to the new trigger. Add a Comparison condition to the Trigger. Stats of the Comparison Condition: Value 1: Used Dialog Item Operator: == Value 2: dialogButtons -Index 1: 0 Add a Add Behavior action to the trigger. Add Behavior stats: Count: 1 Behavior: Add Damage Unit: Pre-Placed Unit [Set This to the unit you placed at the start of this tutorial] Caster: Pre-Placed Unit [Set This to the unit you placed at the start of this tutorial] Now we are going to do pretty much the same thing in the next trigger so copy and paste the Add Damage trigger and rename it Remove Damage We are going to change the condition and the action. Condition Stats: Value 1: Used Dialog Item Operator: == Value 2: dialogButtons -Index: 1 Change the action to Remove Behavior and the stats should be: Count: 1 Behavior: Add Damage Unit: Pre-Placed Unit [Set This to the unit you placed at the start of this tutorial] Hope this made sense and helped you! If you need pictures tell me and I'll set them up for you... Please give me some advice as it is my first tutorial...@XDretsamtovip:
I had a bit of a skim over. Dialog probably isn't necessary to the tutorial, maybe simplify it a little by just using the 'chat message' event handler I.E. if any player types "hitme"
then do actions
The bigger issue though (sorry to pick it apart) is that using a behaviour to apply damage is NOT going to give credit to the attacking unit, since there is no attacking unit. Rather you should be using the 'Environment - Damage unit from unit' command. Create a dummy 'damage' effect that applies 0 zero and set this as the damaging effect in the trigger command. Then you can specify the target, as well as the source, and then add the damage you'd like applied as the 'extra damage' parameter. So if the target dies from taking this damage, kill count/resources/experience are creditted to the source unit
I've just created an ability in my map that uses a combination of this as well as behaviors to deal damage. Basically the source unit has an ability that can be toggled on/off, when it's on the source unit gains a dummy behavior buff. When any unit with that behavior attacks something, the target gains a 'burn' behavior which is just a dummy behavior buff as well. That 'buff' applies a dummy damage effect every second for X amount of seconds. Whenever that effect goes off (it does no damage itself), it executes the Deal Damage to Unit action. Which then finally uses yet ANOTHER dummy damage effect (since if it was the same it'd create an infinate loop) to deal 1/2/3 damage each time depending on your level
Ultimately if you active this ability, then every time you shoot someone they begin to burn and take additional damage over time. But that damage is creditted to the original attacking unit. Even if multiple sources attack the same target using the same ability, the damage stacks and is creditted to the correct sources
Tried this quickly, And it seem to work! I had been trying to get this to work earlier with Attributes, but there seem to be no way to modify Attribute Behaviours with triggers, witch bums me a bit since I want to be able to add Attribute Tomes to my map.
Shardshifter,
Try this. instead of attributes having a behavior to change stats... like damage, have a set of variables that add the behavior. That way you can modify the variables when the player uses a str tome and have a trigger that when the str variable changes-> add behavior to unit.
That should work well. You could even have regular attributes and I believe there is an event for when attributes change. So if str goes up when a hero levels then increase the str variable and apply the behavior. This way you still have the strength attribute visable in the unit display.
If you have any questions ask.
And to XDret, good stuff.
Be carefull, if you are adding insane amount behaviors, that can lag the map (like 10 units with 1000xdamage behavior).
Here is simple way to add only few behavior:
Unit - Add ("wanted damage value"/ 1000) "Damage 1000" to (Last created unit) from (Last created unit)
Unit - Add (("wanted damage value" mod 1000) / 100) "Damage 100" to (Last created unit) from (Last created unit)
Unit - Add (("wanted damage value" mod 100) / 10) "Damage 10" to (Last created unit) from (Last created unit)
Unit - Add ("wanted damage value" mod 10) "Damage 1" to (Last created unit) from (Last created unit)
"damage x" = is a behavior with x damage.
this will nicely reduce the added behaviors up 9999 damage.