- Joined
- Aug 31, 2005
- Messages
- 823
In this tutorial I will explain the following:
-What are Custom Values?
-The Purpose of using Custom Values
-How to change Custom Values in-game
-How to use Custom Values in abilitys and other triggers
Introduction:
For those of you not familiar with the Custom Value system, it can be very helpful and prevent you from writing long strips of code. For example, have you ever seen a trigger like this?
What Are Custom Values?
Custom Values are numbers set up by Blizzard with a default of 100. Unlike Point Values they can only be edited in-game. Changing these values will not affect the unit/item directly in any way.
The Purpose of Using Custom Values
The purpose of using Custom Values is simple really: It reduces the time it takes for you to create your map, and (more importantly) it saves you from writing the same GUI trigger 1,000 times. However, the uses for Custom Values are nearly endless. You could set up a map to recognize a unit because of its Custom Value, kill a unit because of it, change their size/color, add/remove them from certain groups etc.
How to Change Custom Values In-Game
Ok, now that you know the basics of changing Custom Values lets apply them to a in-game situation. Place a unit on the map (It doesnt matter what unit it is). Now draw a region somewhere so that our unit can walk into it.
Alright, now that you have your unit and region drawn its time to write a small trigger.
How to Use Custom Values in Abilities and other Triggers
Now that you understand how to manipulate Custom Values both in-game and in the editor, you should find it easy to apply them to a useable scenario. Remember our friend who made a copy of Wintermaul at the beginning of this tutorial?
Chao-san Website----------Vote----------Need a sig?
-What are Custom Values?
-The Purpose of using Custom Values
-How to change Custom Values in-game
-How to use Custom Values in abilitys and other triggers
Introduction:
For those of you not familiar with the Custom Value system, it can be very helpful and prevent you from writing long strips of code. For example, have you ever seen a trigger like this?
- Events: Unit - A unit Finishes casting an ability
- Conditions: (Ability being cast) equal to Sell
- Actions:
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Triggering unit)) Equal to Icicle Tosser
-
Then - Actions
- Player - Add 7 to (Owner of (Triggering unit)) Current gold
- Unit - Remove (Triggering unit) from the game
-
Else - Actions
- Do nothing
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Triggering unit)) Equal to Spark Tower
-
Then - Actions
- Player - Add 6 to (Owner of (Triggering unit)) Current gold
- Unit - Remove (Triggering unit) from the game
-
Else - Actions
- Do nothing
-
If - Conditions
What Are Custom Values?
Custom Values are numbers set up by Blizzard with a default of 100. Unlike Point Values they can only be edited in-game. Changing these values will not affect the unit/item directly in any way.
The Purpose of Using Custom Values
The purpose of using Custom Values is simple really: It reduces the time it takes for you to create your map, and (more importantly) it saves you from writing the same GUI trigger 1,000 times. However, the uses for Custom Values are nearly endless. You could set up a map to recognize a unit because of its Custom Value, kill a unit because of it, change their size/color, add/remove them from certain groups etc.
How to Change Custom Values In-Game
Ok, now that you know the basics of changing Custom Values lets apply them to a in-game situation. Place a unit on the map (It doesnt matter what unit it is). Now draw a region somewhere so that our unit can walk into it.
Alright, now that you have your unit and region drawn its time to write a small trigger.
-
Unit Enters Region
-
Events
- Unit - A unit enters Region 001<gen>
- Conditions
-
Actions
- Unit - Set the Custom Value of (Triggering unit) to ((Custom Value of (Triggering unit)) + 1)
- Game - Display to (All players) the text: ((Name of (Triggering unit)) + ('s value is + (String((Custom Value of (Triggering unit))))))
-
Events
How to Use Custom Values in Abilities and other Triggers
Now that you understand how to manipulate Custom Values both in-game and in the editor, you should find it easy to apply them to a useable scenario. Remember our friend who made a copy of Wintermaul at the beginning of this tutorial?
- Events: Unit - A unit Finishes casting an ability
- Conditions: (Ability being cast) equal to Sell
- Actions:
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Triggering unit)) Equal to Icicle Tosser
-
Then - Actions
- Player - Add 7 to (Owner of (Triggering unit)) Current gold
- Unit - Remove (Triggering unit) from the game
-
Else - Actions
- Do nothing
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Triggering unit)) Equal to Spark Tower
-
Then - Actions
- Player - Add 6 to (Owner of (Triggering unit)) Current gold
- Unit - Remove (Triggering unit) from the game
-
Else - Actions
- Do nothing
-
If - Conditions
- Events: Unit - A unit Finishes casting an ability
- Conditions: (Ability being cast) equal to Sell
- Actions: Player - Add (Custom Value of (Triggering unit)) to (Owner of (Triggering unit)) Current gold
- Unit - Remove (Triggering unit) from the game
Chao-san Website----------Vote----------Need a sig?
Last edited by a moderator: