TR_m1_IL_UrenimSc
TR_Mainland.esm
Variables
8
Local Variables
TR_Map
control
controlQ
arrest
DoOnce
T_Local_NPC
NoLore
timer
Source
1Begin TR_m1_IL_UrenimSc
2
3short TR_Map
4short control
5short controlQ
6short arrest
7short DoOnce
8float timer
9short T_Local_NPC
10short NoLore
11
12if ( MenuMode )
13 return
14endif
15
16if ( GetJournalIndex "TR_m3_IL_Sabotage" >= 100 )
17 if ( GetDisabled == 0 )
18 disable
19 endif
20 return
21elseif ( GetDisabled )
22 enable
23endif
24
25if ( OnDeath )
26 if ( GetJournalIndex "TR_m3_IL_Sabotage" >= 10 )
27 if ( GetJournalIndex "TR_m3_IL_Sabotage" < 100 )
28 Journal "TR_m3_IL_Sabotage" 50
29 endif
30 endif
31endif
32
33;surrender when at quarter health in Tel Thenim
34if ( DoOnce < 1 )
35 if ( GetJournalIndex TR_m3_IL_Sabotage >= 10 )
36 if ( GetJournalIndex TR_m3_IL_Sabotage < 30 )
37 if ( GetHealthGetRatio <= 0.25 )
38 setfight 30
39 stopcombat
40 set DoOnce to 1
41 ForceGreeting
42 endif
43 endif
44 endif
45endif
46
47if ( GetJournalIndex "TR_m3_IL_Sabotage" >= 25 )
48 return
49elseif ( GetJournalIndex "TR_m3_IL_Sabotage" >= 10 )
50 if ( GetSpell "TR_m3_IL_Urenim_Spell" )
51 if ( CellChanged )
52 SetMagicka 110 ;reset magicka control if player comes back
53 endif
54 else ;teach spell before combat, so AI can use it
55 addspell "TR_m3_IL_Urenim_Spell"
56 SetDestruction 99
57 ;he'll want to cast Poisonbloom and Shockbloom (cost 37 or 39)
58 ;give him enough magicka to cast twice
59 ;but not enough to cast the teleport spell (costs 120)
60 ;he should have 32-34 pts left, not enough for a third cast
61 SetMagicka 110
62 additem "glass stormsword" 1
63 endif
64 if ( GetTarget player )
65 if ( GetWeaponDrawn + GetSpellReadied )
66 set timer to ( timer + GetSecondsPassed )
67 if ( timer > 4 )
68 if ( controlQ == 0 )
69 If ( GetMagicka < 4 )
70 ;if he cast twice, player removed over 30 magicka from him
71 ModCurrentMagicka 30 ;no teleport spell
72 else
73 SetMagicka 130 ;else give him enough to cast his teleport spell
74 Endif
75 set controlQ to 1
76 endif
77 if ( timer > 10 )
78 set controlQ to 0
79 set timer to 0
80 if ( GetMagicka > 120 ) ;he hasn't cast it
81 set timer to -5
82 else
83 SetMagicka 34 ;not enough magicka to cast
84 ;so we're not giving him infinite magicka for other spells
85 endif
86 endif
87 endif
88 endif
89 endif
90 if ( Player->GetSpellEffects "TR_m3_IL_Urenim_Spell" == 1 )
91 Player->RemoveSpellEffects "TR_m3_IL_Urenim_Spell"
92 Player->PositionCell 4188 1616 127 270 "Girithammu Grotto" ; TR_m1_MARK_IL_Weikal
93 If ( GetJournalIndex "TR_m3_IL_Sabotage" < 25 )
94 Journal "TR_m3_IL_Sabotage" 25
95 Endif
96 endif
97endif
98
99if ( TR_Map )
100 return
101endif
102
103set TR_Map to 1
104
105End