Exfyre
hmm...
- Reaction score
- 60
This system allows you to attach multiple custom values to a unit via GUI.
Import Difficulty: Easy
GUI/JASS: GUI
Difficulty of Use: Moderate
Leakless: yup
Other: This system recycles unused custom values as units are removed from the game.
I made this earlier today because i was making a TD which uses the custom values for selling. I also wanted to use it to keep track of how many kills each tower made. So I made this.
Importing:
Main Code
Import Difficulty: Easy
GUI/JASS: GUI
Difficulty of Use: Moderate
Leakless: yup
Other: This system recycles unused custom values as units are removed from the game.
I made this earlier today because i was making a TD which uses the custom values for selling. I also wanted to use it to keep track of how many kills each tower made. So I made this.
Importing:
Code:
Steps:
Copy this trigger into your map.
Create variables:
MCVS_spacer = integer. default value should be zero
MCVS_NumberOfValuesPerUnit = integer. default value should be the number of custom values you want each unit to have.
MCVS_booleantest = boolean. default value should be true.
MCVS_CustomValue = integer array with 8192 dimensions. default value should be zero.
Use:
When using this system, you can call the custom value by the following syntax (in GUI):
MCVS_CustomValue[Custom Value of (Your Unit Here)] + ((index of your custom value)- 1)
NOTE:
If you would like to give preset units custom values, copy this trigger and replace the event 'Unit - A unit enters (Entire map)' with the event 'Map initialization'
Main Code
Code:
Set Custom Values
Events
Unit - A unit enters (Entire map)
Conditions
Actions
Set MCVS_spacer = (1 - MCVS_NumberOfValuesPerUnit)
Do Multiple ActionsFor each (Integer A) from 1 to (8172 / MCVS_NumberOfValuesPerUnit), do (Actions)
Loop - Actions
Set MCVS_booleantest = True
Set MCVS_spacer = (MCVS_spacer + MCVS_NumberOfValuesPerUnit)
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Picked unit)) Equal to (==) MCVS_spacer
Then - Actions
Set MCVS_booleantest = False
Else - Actions
Else - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MCVS_booleantest Equal to (==) True
Then - Actions
Unit - Set the custom value of (Triggering unit) to MCVS_spacer
Skip remaining actions
Else - Actions