Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
--BUILD function fai_build(id) 	if playerweapons(id,74) then 		ai_selectweapon(id, 74) 		px=player(id,"tilex") 		py=player(id,"tilex") 		-- 20 Search Attempts 		for i=1,20 do 			-- Random Adjacend 			tilex=px+math.random(-1,1) 			tiley=py+math.random(-1,1) 			-- Not the player tile itself 			if (x~=px or y~=py) then 				x=tilex*32-16 				y=tiley*32-16 				ai_aim(id,x,y) 				if object(tilex,tiley,exists==true) then 					building_properties(id) 					if player(id,"team")==1 then 						if object(tilex,tiley,"team")==1 then 							if repairable==1 then 								if object(tilex,tiley,"health")<healthpercent*10 then 									local repair=math.random(0,4) 									if repair==4 then 										ai_attack(id,secondary==0) 									end 								elseif object(tilex,tiley,"health")<healthpercent*25 then 									ai_attack(id,secondary==0) 									end 								elseif object(tilex,tiley,"health")<healthpercent*50 then 									local repair=math.random(0,1) 									if repair==1 then 										ai_attack(id,secondary==0) 									end 								elseif object(tilex,tiley,"health")<healthpercent*75 then 									local repair=math.random(0,2) 									if repair==2 then 										ai_attack(id,secondary==0) 									end 								elseif object(tilex,tiley,"health")<healthpercent*100 then 									local repair=math.random(0,3) 									if repair==3 then 										ai_attack(id,secondary==0) 									end 								elseif upgradable==1 then 									ai_attack(id,secondary==0) 							elseif upgradable==1 then 								ai_attack(id,secondary==0) 							end 						end 					elseif player(id,"team")==2 then 						if object(tilex,tiley,"team")==2 then 							if repairable==1 then 								if object(tilex,tiley,"health")<healthpercent*10 then 									local repair=math.random(0,4) 									if repair==4 then 										ai_attack(id,secondary==0) 									end 								elseif object(tilex,tiley,"health")<healthpercent*25 then 									ai_attack(id,secondary==0) 									end 								elseif object(tilex,tiley,"health")<healthpercent*50 then 									local repair=math.random(0,1) 									if repair==1 then 										ai_attack(id,secondary==0) 									end 								elseif object(tilex,tiley,"health")<healthpercent*75 then 									local repair=math.random(0,2) 									if repair==2 then 										ai_attack(id,secondary==0) 									end 								elseif object(tilex,tiley,"health")<healthpercent*100 then 									local repair=math.random(0,3) 									if repair==3 then 										ai_attack(id,secondary==0) 									end 								elseif upgradable==1 then 									ai_attack(id,secondary==0) 								end 							elseif upgradable==1 then 								ai_attack(id,secondary==0) 						end 					end 				else 					fai_buildstart(id) 				end 			end 		end 	end end --BUILD function fai_buildstart(id) 	local money=player(id,"money") 	x=tilex 	y=tiley 	if money==16000 then 		local build=math.random(0,5) 		if build==0 then ai_build(id,6,x,y) -- gate field 		elseif build==1 then ai_build(id,7,x,y) -- dispenser 		elseif build==2 then ai_build(id,8,x,y) -- turret 		elseif build==3 then ai_build(id,9,x,y) -- supply 		elseif build==4 then ai_build(id,13,x,y) -- teleporter entrance 		elseif build==5 then ai_build(id,14,x,y) end -- teleporter exit 	elseif money>=10000 then 		local build=math.random(0,3) 		if build==1 then ai_build(id,7,x,y) -- dispenser 		elseif build==2 then ai_build(id,8,x,y) -- turret 		elseif build==3 then ai_build(id,9,x,y) end -- supply 	elseif money>=5000 then 		local build=math.random(0,3) 		if build==1 then ai_build(id,14,x,y) -- teleporter exit 		elseif build==2 then ai_build(id,7,x,y) -- dispenser 		elseif build==3 then ai_build(id,7,x,y) end -- dispenser 	end end function building_properties(id) 	if object(id,"type")==1 then --Barricade 		local maxhealth=150 		local repairable=1 		local upgradable=0 	elseif object(id,"type")==2 then --Barbed wire 		local maxhealth=300 		local repairable=0 		local upgradable=0 	elseif object(id,"type")==3 then --Wall I 		local maxhealth=500 		local repairable=1 		local upgradable=1 	elseif object(id,"type")==4 then --Wall II 		local maxhealth=1000 		local repairable=1 		local upgradable=1 	elseif object(id,"type")==5 then --Wall III 		local maxhealth=2000 		local repairable=1 		local upgradable=0 	elseif object(id,"type")==6 then --Gate field 		local maxhealth=1000 		local repairable=0 		local upgradable=0 	elseif object(id,"type")==7 then --Dispenser 		local maxhealth=1000 		local repairable=1 		local upgradable=0 	elseif object(id,"type")==8 then --Turret 		local maxhealth=500 		local repairable=1 		local upgradable=1 	elseif object(id,"type")==9 then --Supply 		local maxhealth=1000 		local repairable=1 		local upgradable=1 	elseif object(id,"type")==10 then --Construction site 		local maxhealth=100 		local repairable=1 		local upgradable=0 	elseif object(id,"type")==11 then --Dual turret 		local maxhealth=750 		local repairable=1 		local upgradable=1 	elseif object(id,"type")==12 then --Triple turret 		local maxhealth=1000 		local repairable=1 		local upgradable=0 	elseif object(id,"type")==13 then --Teleporter entrance 		local maxhealth=500 		local repairable=0 		local upgradable=0 	elseif object(id,"type")==14 then --Teleporter exit 		local maxhealth=500 		local repairable=0 		local upgradable=0 	elseif object(id,"type")==15 then --Super supply 		local maxhealth=1500 		local repairable=1 		local upgradable=0 	end 	local healthpercent=maxhealth/100 end
EDIT: Did I put it in the german section...?
edited 1×, last 14.04.14 05:08:09 pm