those systems looked interesting because i thought i dont need to make 2040 upgrades to increase damage via data. Can i increase damage with +1 thing via trigger?
I am largely inactive, but I am still around. Feel free to poke me if you need some help, just be warned that I only really come back if I need help and/or if I'm posting a new map/library.
Like they said, you can change weapons of a unit but increasing damage is a bit trickier. If you want to increase the damage done of a unit type then use catalog field set functions. Changing a unit's damage via catalog will change the weapon damage of all units of that type, though. So you can't just increase one unit's damage via catalog.
However, there is a work around. By making about four stackable behaviors, which increase a unit's damage by +1, +10, -1, and -10 then you can make your own functions in triggers to set a unit's bonus damage to whatever you want. I can provide more information if you're interested.
Like they said, you can change weapons of a unit but increasing damage is a bit trickier. If you want to increase the damage done of a unit type then use catalog field set functions. Changing a unit's damage via catalog will change the weapon damage of all units of that type, though. So you can't just increase one unit's damage via catalog.
However, there is a work around. By making about four stackable behaviors, which increase a unit's damage by +1, +10, -1, and -10 then you can make your own functions in triggers to set a unit's bonus damage to whatever you want. I can provide more information if you're interested.
so i can make a trigger increasing damage by clicking button or must i make 20 triggers for 20 upgrades?
LevelUnitUpgradeOptions:Action,CreateThreadReturnType:(None)ParametersPlayer=0<Integer>Array#<Real>Unit=NoUnit<Unit>GrammarText:LevelUnitUpgrade(Player,Array#,Unit)HintText:Levelsunitsviaupgrades.CustomScriptCodeLocalVariablesActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfConvertingtoUpgrades==TrueThenGeneral-Switch(Actions)dependingonCappingUpgradesCasesGeneral-If(False)ActionsGeneral-Pickeachintegerfrom1toMaximumUnitCount,anddo(Actions)ActionsGeneral-Switch(Actions)dependingon(UnittypeofUnit)CasesGeneral-If(UnitArray[(Pickedinteger)])
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Increasing Upgrades Beyond 100 == True
Then
General - Switch (Actions) depending on (Upgrade for Unit[(Pickedinteger)] count for player Player, counting In Progress Or Better)
Cases
General - If (100)
Actions
Tech Tree - Add 1 to Upgrade for Unit x100[(Pickedinteger)] upgrade for player Player
Tech Tree - Set Upgrade for Unit[(Pickedinteger)] upgrade level to 0 for player Player
Default
Tech Tree - Add 1 to Upgrade for Unit[(Pickedinteger)] upgrade for player Player
Else
Tech Tree - Add 1 to Upgrade for Unit[(Pickedinteger)] upgrade for player Player
Default
Default
General - Pick each integer from 1 to Maximum Unit Count, and do (Actions)
Actions
General - Switch (Actions) depending on (Unit type of Unit)
Cases
General - If (Unit Array[(Pickedinteger)])
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Upgrade for Unit W/ Cap[(Pickedinteger)] count for player Player, counting In Progress Or Better) < MaximumUpgradeW/CapCountThenTechTree-Add1toUpgradeforUnitW/Cap[(Pickedinteger)]upgradeforplayerPlayerElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfIncreasingUpgradesBeyond100 ==TrueThenGeneral-Switch(Actions)dependingon(UpgradeforUnit[(Pickedinteger)]countforplayerPlayer,countingInProgressOrBetter)CasesGeneral-If(100)ActionsTechTree-Add1toUpgradeforUnitx100[(Pickedinteger)]upgradeforplayerPlayerTechTree-SetUpgradeforUnit[(Pickedinteger)]upgradelevelto0forplayerPlayerDefaultTechTree-Add1toUpgradeforUnit[(Pickedinteger)]upgradeforplayerPlayerElseTechTree-Add1toUpgradeforUnit[(Pickedinteger)]upgradeforplayerPlayerDefaultElse
Not sure how well this will work now, as the library I pulled this from is rather old, but the basic premise should remain the same.
Rollback Post to RevisionRollBack
I am largely inactive, but I am still around. Feel free to poke me if you need some help, just be warned that I only really come back if I need help and/or if I'm posting a new map/library.
so i can make a trigger increasing damage by clicking button or must i make 20 triggers for 20 upgrades?
Not really sure what that monster of a code segment was supposed to do, but there's a simpler solution.
1. Creating the Behaviors in Data
I stay away from data so I'm going to say this briefly: Make the four stackable behaviors in data which modify unit damage by +1, -1, +10, and -10. Call them "Damage +1", "Damage +10", "Damage -1", and "Damage -10".
Now we can modify any unit's respective bonus damage through triggers by applying and removing behaviors.
2. Creating a Custom Definition to Accept an Integer Value to Modify Unit Damage
As the title of this part says, we're going to need a custom definition. I'm assuming you don't know how to work with custom definitions so I'll go through this with you.
Very briefly, custom action definitions are like your very own homemade triggers.
Right click on the left in the field containing your triggers. Go to New, click on New Action Definition.
Let's rename it to "Set Unit Bonus Damage".
Right click on "Parameters" and create a new parameter.
Name it "Unit".
Set it to type Unit.
Create another parameter. Name it "Amount". Set it to type Integer.
So we got our custom action's input slots set up. Time for the actions within our custom action.
Create a new action, Remove Behavior from Unit (this works similar to a normal trigger).
For amount of behaviors, put 10. You'll see why later.
For behavior, put the behavior we made "Damage +10".
Click on where it says "unit" in the action. When it brings up the unit input window, click on Parameter" Then click on the parameter we made, "Unit".
Copy and paste this action three times, for a total of four.
Change the behavior in each so that there's one of each, +1, -1, +10, and -10. (see screen shots attached).
By doing this, we erase all bonus damage from a unit before the rest of the action runs.
We're going to go back up the action really quick and create a new local variable in this action.
Local variable, type string, let's call it "Absolut Amount". (Vodka reference).
Set the value of it to convert integer to string, absolute value, then put in our parameter Amount.
Now we're going to do the rest of the actions. This is still in our custom action.
Create a new action, type If then Else.
Create a condition for the if, type comparison, set it to our parameter Value < 0.
For the then part, create the action "Add Behavior to Unit from Player."
For the amount value, set it to Convert String to Integer > Substring of String. For the string part, set It to our variable "Absolute Amount". Set both of the other to integer values to 1.
For the behavior, set it to Damage -10.
For the player, set it to 0.
Copy and paste this action. Change the two 1s to 2s. Change the behavior to "-1 Damage" instead of -10.
Now we have the functionality to reduce a unit's damage using this action. Time to make it so we can add damage as well.
Copy and paste the two actions under Then to Else. Change the behaviors to the opposite one (Damage -10 to Damage + 10 and Damage -1 to Damage +1)
That functionality has been added and it's time to test this custom action.
3. Testing Our New Custom Action
Open the terrain module. Slap a unit down, let's say, a marine.
Create a new trigger.
For the event, do Map Initialization.
For the action, create our action that we just made, "Set Unit Damage".
For the integer value input, put in any number -99 to 99. For the unit, put the unit we created.
is there any simple trigger changing weapon and removing weapon and increasing damage?
http://www.galaxywiki.net/Simple_Kill_Tracking_Leaderboard
http://www.sc2mapster.com/forums/development/triggers/48466-simple-resource-leaderboard-please-help/
those systems looked interesting because i thought i dont need to make 2040 upgrades to increase damage via data. Can i increase damage with +1 thing via trigger?
@cleanto: Go
You cant. But through behavior maybe. Like adding an Attribute :D
@cleanto: Go
@DuckyTheDuck: Go
This, but you can also switch weapons via catalog. I forget how, but I've done it before so.
Unfortunately, you cannot add or remove weapons via catalogs.
@cleanto: Go
Like they said, you can change weapons of a unit but increasing damage is a bit trickier. If you want to increase the damage done of a unit type then use catalog field set functions. Changing a unit's damage via catalog will change the weapon damage of all units of that type, though. So you can't just increase one unit's damage via catalog.
However, there is a work around. By making about four stackable behaviors, which increase a unit's damage by +1, +10, -1, and -10 then you can make your own functions in triggers to set a unit's bonus damage to whatever you want. I can provide more information if you're interested.
so i can make a trigger increasing damage by clicking button or must i make 20 triggers for 20 upgrades?
@cleanto: Go
Not sure how well this will work now, as the library I pulled this from is rather old, but the basic premise should remain the same.
@Yaksmanofage: Go
@cleanto: Go
Not really sure what that monster of a code segment was supposed to do, but there's a simpler solution.
1. Creating the Behaviors in Data
Now we can modify any unit's respective bonus damage through triggers by applying and removing behaviors.
2. Creating a Custom Definition to Accept an Integer Value to Modify Unit Damage
As the title of this part says, we're going to need a custom definition. I'm assuming you don't know how to work with custom definitions so I'll go through this with you.
So we got our custom action's input slots set up. Time for the actions within our custom action.
By doing this, we erase all bonus damage from a unit before the rest of the action runs.
We're going to go back up the action really quick and create a new local variable in this action.
Now we're going to do the rest of the actions. This is still in our custom action.
Now we have the functionality to reduce a unit's damage using this action. Time to make it so we can add damage as well.
That functionality has been added and it's time to test this custom action.
3. Testing Our New Custom Action
Mapster isn't letting me attach another image to that post.