File: university.lua

package info (click to toggle)
btanks 0.9.8083-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 43,616 kB
  • sloc: cpp: 46,425; ansic: 12,005; xml: 4,262; python: 313; sh: 13; makefile: 13
file content (44 lines) | stat: -rw-r--r-- 1,012 bytes parent folder | download | duplicates (6)
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
-- sample lua test file

ai_stage = 0
ai_ids = {}
throttle = 0
heli = 1

function on_tick(dt)
	if ai_stage > 3 then game_over('messages', 'mission-accomplished', 4, true) return end

	throttle = throttle + dt
	if throttle < 5 then return end
	throttle = 0

	if #ai_ids == 0 then 
		
		ai_stage = ai_stage + 1
		if ai_stage > 3 then return end
		
		local i = 1
		while i <= ai_stage do
			ai_ids[i] = show_item('object:helicopter:helicopter:special-'..heli)
			i = i + 1
			heli = heli + 1
		end
	else 
		--checking ai units
		local i = 1
		while i <= #ai_ids do 
			if object_exists(ai_ids[i]) then return end -- live ai player
			i = i + 1
		end
		ai_ids = {}
	end
end

function on_load()
	hide_item('object:helicopter:helicopter:special-1')
	hide_item('object:helicopter:helicopter:special-2')
	hide_item('object:helicopter:helicopter:special-3')
	hide_item('object:helicopter:helicopter:special-4')
	hide_item('object:helicopter:helicopter:special-5')
	hide_item('object:helicopter:helicopter:special-6')
end