TR_m4_NPC_Cornelius_Vulpo
TR_Mainland.esm
Variables
8
Local Variables
TR_Map
control
controlQ
T_Local_NPC
NoLore
state
outdoors
frameHour
Source
1Begin TR_m4_NPC_Cornelius_Vulpo
2; Script to control Cornelius' forcegreeting and movement after the player has talked to Alvuru Omayn during the Omaynis Inn quest
3
4short TR_Map
5short control
6short controlQ
7short T_Local_NPC
8short NoLore
9short state
10short outdoors
11float frameHour ; time stamp of previous frame
12
13if ( MenuMode )
14 return
15endif
16
17if ( TR_Map < 4 )
18 Set TR_Map to 4
19endif
20
21if ( GetJournalIndex "TR_m4_HH_AND_OmaynisInn" < 20 )
22 return
23elseif ( state == 6 )
24 return
25endif
26
27if ( GetJournalIndex "TR_m4_HH_AND_OmaynisInn" < 30 )
28 if ( state == 0 )
29 if ( GetDeadCount "TR_m4_Olvys Omayn" >= 1 )
30 ; skip all this if Olvys is dead
31 Set state to 6
32 return
33 endif
34 ; move to a more favourable position
35 PositionCell -479 -101 -120 18600 "Omaynis, Omayn Manor"
36 AIWander 0 5 0 0 60 20 10 0 0 0 0 0
37 Set state to 1
38 StartScript TR_m4_HH_CorneliusRelocate
39 return
40 endif
41elseif ( GetJournalIndex "TR_m4_HH_AND_OmaynisInn" >= 65 )
42 if ( state >= 1 )
43 if ( state <= 2 )
44 ; move him back if the player has finished all tasked without talking to him
45 Set state to 5
46 endif
47 endif
48endif
49
50if ( GetJournalIndex "TR_m4_HH_AND_OmaynisInn3" == 80 )
51 ; chose Nalvos instead
52 if ( state >= 1 )
53 if ( state <= 2 )
54 Set state to 5
55 endif
56 endif
57endif
58
59if ( state == 1 )
60 ; force greet the placer if they are close enough, prepare for walking back
61 if ( GetDistance Player < 150 )
62 ForceGreeting
63 StopScript TR_m4_HH_CorneliusRelocate
64 return
65 elseif ( GetInterior == 0 )
66 if ( GetDistance Player < 210 )
67 Set outdoors to 1
68 ForceGreeting
69 StopScript TR_m4_HH_CorneliusRelocate
70 return
71 endif
72 endif
73
74elseif ( state == 5 )
75 if ( GetSoundPlaying "Door Heavy Open" )
76 return
77 endif
78 if ( ScriptRunning "TR_m4_HH_CorneliusRelocate" )
79 StopScript "TR_m4_HH_CorneliusRelocate"
80 endif
81 ; teleport him to his initial position
82 PositionCell -455 -186 -120 20640 "Omaynis, Omayn Manor"
83 AIWander 0 5 0 0 60 20 10 0 0 0 0 0
84 SetHello 30
85 Set outdoors to 0
86 Set state to 6
87
88elseif ( state >= 3 )
89 ; 3 or 4
90 ; walk back, or wait for player to move/rest
91 if ( GetInterior == 0 )
92 if ( GetAIPackageDone )
93 if ( state == 3 )
94 AITravel -53873 -127696 2782
95 Set state to 4
96 return
97 else
98 PlaySound3D "Door Heavy Open"
99 Set state to 5
100 return
101 endif
102 endif
103 endif
104 if ( CellChanged )
105 Set state to 5
106 elseif ( GameHour >= ( frameHour + 1 ) ) ; player rested
107 Set state to 5
108 elseif ( GameHour < frameHour )
109 if ( GameHour >= ( frameHour - 23 ) )
110 Set state to 5
111 endif
112 endif
113 Set frameHour to GameHour
114 return
115endif
116
117End