1 |
i now have the know how to complete this project. starting work.
|
1 |
i now have the know how to complete this project. starting work.
|
2 |
\n
|
2 |
\n
|
3 |
here is a look at my revised code doing the same thing as above:
|
3 |
here is a look at my revised code doing the same thing as above:
|
4 |
\n
|
4 |
\n
|
5 |
[spoiler]
|
5 |
[spoiler]
|
6 |
\n
|
6 |
\n
|
7 |
local highesthealth = 0
|
7 |
local highesthealth = 0
|
8 |
local lowesthealth = math.huge
|
8 |
local lowesthealth = math.huge
|
9 |
for name, ud in pairs(UnitDefs) do
|
9 |
for name, ud in pairs(UnitDefs) do
|
10 |
if ud.health and ud.speed and ud.health > 0 and ud.speed > 0 and ud.health < 100000 then
|
10 |
if ud.health and ud.speed and ud.health > 0 and ud.speed > 0 and ud.health < 100000 then
|
11 |
if ud.health > highesthealth then
|
11 |
if ud.health > highesthealth then
|
12 |
highesthealth = ud.health
|
12 |
highesthealth = ud.health
|
13 |
end
|
13 |
end
|
14 |
if ud.health < lowesthealth then
|
14 |
if ud.health < lowesthealth then
|
15 |
lowesthealth = ud.health
|
15 |
lowesthealth = ud.health
|
16 |
end
|
16 |
end
|
17 |
end
|
17 |
end
|
18 |
end
|
18 |
end
|
19 |
for name, ud in pairs(UnitDefs) do
|
19 |
for name, ud in pairs(UnitDefs) do
|
20 |
if ud.health and ud.speed and ud.health > 0 and ud.speed > 0 and ud.health < 100000 then
|
20 |
if ud.health and ud.speed and ud.health > 0 and ud.speed > 0 and ud.health < 100000 then
|
21 |
local distance_health_midpoint = ud.health - lowesthealth
|
21 |
local distance_health_midpoint = ud.health - lowesthealth
|
22 |
ud.health = highesthealth - distance_health_midpoint
|
22 |
ud.health = highesthealth - distance_health_midpoint
|
23 |
end
|
23 |
end
|
24 |
end
|
24 |
end
|
25 |
\n
|
25 |
\n
|
26 |
\n
|
26 |
\n
|
27 |
>>>
|
27 |
>>>
|
28 |
maybe might use this:
|
28 |
maybe might use this:
|
29 |
\n
|
29 |
\n
|
30 |
local function adjustvalues(property)
|
30 |
local function adjustvalues(property)
|
31 |
local highest = 0
|
31 |
local highest = 0
|
32 |
local lowest = math.huge
|
32 |
local lowest = math.huge
|
33 |
|
33 |
|
34 |
for name, ud in pairs(UnitDefs) do
|
34 |
for name, ud in pairs(UnitDefs) do
|
35 |
if ud[property] and ud.speed and ud[property] > 0 and ud.speed > 0 and ud[property] < 100000 then
|
35 |
if ud[property] and ud.speed and ud[property] > 0 and ud.speed > 0 and ud[property] < 100000 then
|
36 |
if ud[property] > highest then
|
36 |
if ud[property] > highest then
|
37 |
highest = ud[property]
|
37 |
highest = ud[property]
|
38 |
end
|
38 |
end
|
39 |
if ud[property] < lowest then
|
39 |
if ud[property] < lowest then
|
40 |
lowest = ud[property]
|
40 |
lowest = ud[property]
|
41 |
end
|
41 |
end
|
42 |
end
|
42 |
end
|
43 |
end
|
43 |
end
|
44 |
|
44 |
|
45 |
for name, ud in pairs(UnitDefs) do
|
45 |
for name, ud in pairs(UnitDefs) do
|
46 |
if ud[property] and ud.speed and ud[property] > 0 and ud.speed > 0 and ud[property] < 100000 then
|
46 |
if ud[property] and ud.speed and ud[property] > 0 and ud.speed > 0 and ud[property] < 100000 then
|
47 |
local distance_midpoint = ud[property] - lowest
|
47 |
local distance_midpoint = ud[property] - lowest
|
48 |
ud[property] = highest - distance_midpoint
|
48 |
ud[property] = highest - distance_midpoint
|
49 |
end
|
49 |
end
|
50 |
end
|
50 |
end
|
51 |
end
|
51 |
end
|
52 |
\n
|
52 |
\n
|
53 |
adjustvalues("health")
|
53 |
adjustvalues("health")
|
54 |
adjustvalues("metalcost")
|
54 |
adjustvalues("metalcost")
|
55 |
\n
|
55 |
\n
|
56 |
and
possible
an
exclusion
list:
|
56 |
and
possible
an
inclusion
list:
|
57 |
\n
|
57 |
\n
|
58 |
not
(
|
58 |
if
(
|
59 |
ud.
name
==
"athena"
or
|
59 |
ud.
name
==
"Glaive"
or
|
60 |
ud.
name
==
"ultimatum"
or
|
60 |
ud.
name
==
"Ronin"
or
|
61 |
ud.
name
==
"scorpion"
or
|
61 |
ud.
name
==
"Reaver"
or
|
62 |
ud.
name
==
"dante"
or
|
62 |
ud.
name
==
"Knight"
or
|
63 |
ud.
name
==
"merlin"
or
|
63 |
ud.
name
==
"Sling"
or
|
64 |
ud.
name
==
"funnelweb"
or
|
64 |
ud.
name
==
"Scythe"
or
|
65 |
ud.
name
==
"paladin"
or
|
65 |
ud.
name
==
"Phantom"
or
|
66 |
ud.
name
==
"detriment"
or
|
66 |
ud.
name
==
"Imp"
or
|
67 |
ud.
name
==
"shogun"
or
|
67 |
ud.
name
==
"Bandit"
or
|
68 |
ud.
name
==
"reef"
or
|
68 |
ud.
name
==
"Rogue"
or
|
69 |
ud.
name
==
"scylla"
|
69 |
ud.
name
==
"Outlaw"
or
|
|
|
70 |
ud.name == "Thug" or
|
|
|
71 |
ud.name == "Racketeer" or
|
|
|
72 |
ud.name == "Dirtbag" or
|
|
|
73 |
ud.name == "Felon" or
|
|
|
74 |
ud.name == "Snitch" or
|
|
|
75 |
ud.name == "Scorcher" or
|
|
|
76 |
ud.name == "Fencer" or
|
|
|
77 |
ud.name == "Ripper" or
|
|
|
78 |
ud.name == "Ravager" or
|
|
|
79 |
ud.name == "Badger" or
|
|
|
80 |
ud.name == "Dart" or
|
|
|
81 |
ud.name == "Impaler" or
|
|
|
82 |
ud.name == "Dominatrix" or
|
|
|
83 |
ud.name == "Dagger" or
|
|
|
84 |
ud.name == "Scalpel" or
|
|
|
85 |
ud.name == "Mace" or
|
|
|
86 |
ud.name == "Halberd" or
|
|
|
87 |
ud.name == "Lance" or
|
|
|
88 |
ud.name == "Bolas" or
|
|
|
89 |
ud.name == "Claymore" or
|
|
|
90 |
ud.name == "Locust" or
|
|
|
91 |
ud.name == "Harpy" or
|
|
|
92 |
ud.name == "Blastwing" or
|
|
|
93 |
ud.name == "Revenant" or
|
|
|
94 |
ud.name == "Nimbus" or
|
|
|
95 |
ud.name == "Gnat" or
|
|
|
96 |
ud.name == "Krow" or
|
|
|
97 |
ud.name == "Charon" or
|
|
|
98 |
ud.name == "Hercules" or
|
|
|
99 |
ud.name == "Swift" or
|
|
|
100 |
ud.name == "Phoenix" or
|
|
|
101 |
ud.name == "Raven" or
|
|
|
102 |
ud.name == "Sparrow" or
|
|
|
103 |
ud.name == "Likho" or
|
|
|
104 |
ud.name == "Thunderbird" or
|
|
|
105 |
ud.name == "Owl" or
|
|
|
106 |
ud.name == "Flea" or
|
|
|
107 |
ud.name == "Recluse" or
|
|
|
108 |
ud.name == "Redback" or
|
|
|
109 |
ud.name == "Hermit" or
|
|
|
110 |
ud.name == "Venom" or
|
|
|
111 |
ud.name == "Crab" or
|
|
|
112 |
ud.name == "Widow" or
|
|
|
113 |
ud.name == "Pyro" or
|
|
|
114 |
ud.name == "Moderator" or
|
|
|
115 |
ud.name == "Placeholder" or
|
|
|
116 |
ud.name == "Jack" or
|
|
|
117 |
ud.name == "Firewalker" or
|
|
|
118 |
ud.name == "Puppy" or
|
|
|
119 |
ud.name == "Jugglenaut" or
|
|
|
120 |
ud.name == "Skuttle" or
|
|
|
121 |
ud.name == "Blitz" or
|
|
|
122 |
ud.name == "Ogre" or
|
|
|
123 |
ud.name == "Minotaur" or
|
|
|
124 |
ud.name == "Emissary" or
|
|
|
125 |
ud.name == "Kodachi" or
|
|
|
126 |
ud.name == "Cyclops" or
|
|
|
127 |
ud.name == "Tremor" or
|
|
|
128 |
ud.name == "Duck" or
|
|
|
129 |
ud.name == "Buoy" or
|
|
|
130 |
ud.name == "Scallop" or
|
|
|
131 |
ud.name == "Bulkhead" or
|
|
|
132 |
ud.name == "Lobster" or
|
|
|
133 |
ud.name == "Archer" or
|
|
|
134 |
ud.name == "Grizzly" or
|
|
|
135 |
ud.name == "Limpet" or
|
|
|
136 |
ud.name == "Hunter" or
|
|
|
137 |
ud.name == "Mistral" or
|
|
|
138 |
ud.name == "Corsair" or
|
|
|
139 |
ud.name == "Siren" or
|
|
|
140 |
ud.name == "Envoy" or
|
|
|
141 |
ud.name == "Cutter" or
|
|
|
142 |
ud.name == "Seawolf" or
|
70 |
) then
|
143 |
) then
|
71 |
\n
|
144 |
\n
|
72 |
\n
|
145 |
\n
|
73 |
[/spoiler]
|
146 |
[/spoiler]
|