TR_m4_NPC_Immetarca_script
TR_Mainland.esm
Variables
9
Local Variables
doOnce
startWalk
deadOnce
NoLore
TimeToDie
T_Local_NPC
T_Local_NoLore
TR_Map
timer
Source
1Begin TR_m4_NPC_Immetarca_script
2
3; Script on NPC TR_m4_Immetarca for quest TR_m4_wil_Immetarca.
4
5;if you move this NPC I will kill you -mort
6
7short doOnce
8short startWalk
9short deadOnce
10short NoLore
11short TimeToDie
12float timer
13short T_Local_NPC
14short T_Local_NoLore
15short TR_Map
16
17if ( TR_Map != 4 )
18 set TR_Map to 4
19endif
20
21if ( MenuMode )
22 return
23endif
24
25if ( deadOnce == 1 )
26 return
27endif
28
29if ( OnDeath == 1 )
30 Journal "TR_m4_wil_Immetarca" 20
31 set deadOnce to 1
32 if ( TimeToDie == 1 )
33 ; Insane failsave for an insane scripting engine.
34 ; "sethealth 0" causes Immetarca to fall down for a while,
35 ; but usually she stops midair before falling all the way down.
36 ; The following two lines should teleport her to the ground.
37 disable
38 enable
39 endif
40endif
41
42if ( doOnce == 0 )
43 ; showtime!
44
45 if ( GetJournalIndex "TR_m4_wil_Immetarca" == 15 )
46 if ( startWalk == 0 )
47 AddSpell, "TR_m4_immetarca_walks"
48 AITravel, 33000, -158032, 3000
49 set startWalk to 1
50 endif
51 endif
52
53 if ( startWalk > 0 )
54 ; falling time
55 if ( GetAIPackageDone == 1 )
56 if ( getpos y > -157410 )
57 ; We are still (most likely) on the cliff and somehow the pathfinding failed.
58 ; So try again.
59 AITravel, 33000, -158032, 3000
60 return
61 endif
62 RemoveSpell, "TR_m4_immetarca_walks"
63 RemoveEffects, 10
64 set doOnce to 1
65 endif
66
67 if ( TimeToDie == 1 )
68 ; Kill her after a while, in case removing the levitation spell
69 ; does not work (this is Bethesda).
70 set timer to ( timer + GetSecondsPassed )
71 if ( timer > 3 )
72 ; But first let her try to fall...
73 sethealth 0
74 endif
75 return
76 endif
77
78 if ( GetDistance, player > 2000 )
79 ; Failsave in case the player bails out:
80 RemoveSpell, "TR_m4_immetarca_walks"
81 RemoveEffects, 10
82 ; And because this apparently isn't enough (the engine doesn't
83 ; recompute her collision?):
84 Disable
85 Enable
86 set TimeToDie to 1
87 endif
88 endif
89
90endif
91
92end