TR_m4_HautharmoScript
TR_Mainland.esm
Variables
7
Local Variables
doOnce
doDelay
amuletDestroyed
banished
accepted
greetOnce
oldHealth
Source
1Begin TR_m4_HautharmoScript
2
3short doOnce
4short doDelay
5short amuletDestroyed
6short banished
7short accepted
8float oldHealth
9short greetOnce
10
11if ( MenuMode == 1 )
12 return
13endif
14
15if ( OnDeath == 1 )
16 if ( GetJournalIndex "TR_m4_wil_HautharmoKill" != 200 )
17 Journal "TR_m4_wil_HautharmoKill" 200
18 endif
19endif
20
21if ( greetOnce == 0 )
22 if ( GetDistance, player < 300 )
23 ForceGreeting
24 set greetOnce to 1
25 endif
26endif
27
28if ( doOnce == 0 )
29 if ( GetHealth < 475 ) ; it seems that GetAttacked doesn't work on creatures, hence this workaround
30 StartCombat player
31 SetFight 100
32 if ( GetDeadCount "TR_m4_cr_Hautharmo" < 1 )
33 "TR_m4_cr_Hautharmo"->StartCombat player
34 "TR_m4_cr_Hautharmo"->SetFight 100
35 endif
36 Set doOnce to 1
37 endif
38endif
39
40if ( GetDeadCount "TR_m4_cr_Hautharmo" == 0 )
41 if ( amuletDestroyed == 1 )
42 if ( player->GetItemCount TR_m4_HautharmoPearl > 0 )
43 player->RemoveItem TR_m4_HautharmoPearl 1
44 endif
45 if ( doDelay == 0 )
46 Set doDelay to 1
47 elseif ( GetHealth > oldHealth )
48 RemoveSpell "TR_m4_Hautharmo unlife"
49 endif
50 Set oldHealth to GetHealth
51 endif
52endif
53
54
55End