forked from xWar131x/TPT2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkill enemies.tpt2
54 lines (46 loc) · 1.44 KB
/
kill enemies.tpt2
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
:import adventure_lib
:name {package}:kill enemies
:global bool leon.adventure.running
key.k()
isopen("arcade")
#enemyInDir(x, y) adventure.isEnemy(adventure.playerPos() + vec({x},{y}))
#enemyDirection if({enemyInDir(0., 1.)}, vec(0., 1.),\
if({enemyInDir(1., 0.)}, vec(1., 0.),\
if({enemyInDir(0., -1.)}, vec(0., -1.),\
if({enemyInDir(-1., 0.)}, vec(-1., 0.), vec(0., 0.)))))
#anyEnemies {enemyInDir(0., 1.)} || {enemyInDir(0., -1.)} || {enemyInDir(1., 0.)} || {enemyInDir(-1., 0.)}
; Initialize variables so that pressing "k" after resetting AI
; toggles leon.adventure.running. We're using plain execute here
; because we want the launching script to continue and die while
; the copy of init we execute will keep running, and eventually
; launch another copy of "kill enemies".
; This architecture, although roundabout, keeps the starting and
; stopping of turbo in a single place (init) and thus ultimately
; is simpler.
execute(if(\
contains(impulse(), "key."),\
"{package}:init",\
"{package}:xNOOPx"\
))
goto(if(contains(impulse(), "key."), end, loop))
wait:
adventure.wait()
attack:
executesync("TE2.2:stop")
adventure.move({enemyDirection})
executesync("TE2.2:start")
loop:
gotoif(\
if(\
{anyEnemies},\
attack,\
if(\
max(max(adventure.countEntities("Enemy"), adventure.countEntities("Elite")), adventure.countEntities("Mimic")) > 0,\
wait,\
end\
)\
),\
leon.adventure.running\
)
end:
wait(0.)