Scripts

TR_m4_NPC_Sarus_Savrethi

TR_Mainland.esm
Variables 8
Local Variables
TR_m4_SavrethiCouple
TR_Map
control
controlQ
equipped
OnPCHitMe
NoLore
T_Local_NPC
Source
1Begin TR_m4_NPC_Sarus_Savrethi 2; Script for controlling Sarus and Milune Savrethi's dialogue in the cave 3 4short TR_m4_SavrethiCouple ; identifier 5short TR_Map 6short control ; controls greetings in cave 7short controlQ ; controls combat 8short equipped ; checks if weapons are equipped 9short OnPCHitMe 10short NoLore 11short T_Local_NPC 12 13if ( MenuMode ) 14 return 15endif 16 17if ( OnDeath ) 18 if ( GetItemCount "steel shortsword" == 0 ) 19 ; create illusion that they had a steel shortsword with them all the time 20 AddItem "steel shortsword" 1 21 endif 22 return 23endif 24 25if ( equipped == 1 ) 26 if ( GetHealth >= 1 ) 27 Equip "steel shortsword" 28 if ( GetItemCount "steel shortsword" > 0 ) 29 ; ensures that weapon has indeed been equipped, since there is a limit of one equip per frame 30 Set equipped to 2 31 endif 32 else 33 Set equipped to 2 34 endif 35 return 36endif 37 38if ( controlQ == 1 ) ; in combat 39 if ( equipped == 0 ) 40 if ( Player->GetWeaponType != -1 ) 41 ; re-equip weapons if player is drawing a weapon (done in next frame) 42 if ( Player->GetWeaponDrawn ) 43 Set "TR_m4_Sarus Savrethi".equipped to 1 ; covers both 44 Set "TR_m4_Milune Savrethi".equipped to 1 45 elseif ( Player->GetSpellReadied ) 46 Set "TR_m4_Sarus Savrethi".equipped to 1 47 Set "TR_m4_Milune Savrethi".equipped to 1 48 endif 49 return 50 endif 51 endif 52endif 53 54if ( GetJournalIndex "TR_m4_HH_AND_Greef" >= 70 ) 55 if ( GetJournalIndex "TR_m4_HH_AND_Greef" < 80 ) 56 if ( OnPCHitMe ) 57 Set OnPCHitMe to 0 58 if ( controlQ == 0 ) 59 if ( Player->GetWeaponType == -1 ) 60 ; force hand-to-hand if player chooses to 61 if ( "TR_m4_Sarus Savrethi"->GetHealth >= 1 ) 62 if ( "TR_m4_Sarus Savrethi"->GetItemCount "steel shortsword" > 0 ) 63 "TR_m4_Sarus Savrethi"->RemoveItem "steel shortsword" 1 64 endif 65 endif 66 if ( "TR_m4_Milune Savrethi"->GetHealth >= 1 ) 67 if ( "TR_m4_Milune Savrethi"->GetItemCount "steel shortsword" > 0 ) 68 "TR_m4_Milune Savrethi"->RemoveItem "steel shortsword" 1 69 endif 70 endif 71 endif 72 "TR_m4_Sarus Savrethi"->StartCombat Player 73 "TR_m4_Milune Savrethi"->StartCombat Player 74 Set "TR_m4_Sarus Savrethi".controlQ to 1 75 Set "TR_m4_Milune Savrethi".controlQ to 1 76 endif 77 endif 78 if ( GetFatigue < 40 ) 79 ; safe margin, since force greet doesn't work for knocked out NPCs 80 if ( controlQ == 1 ) 81 ForceGreeting 82 endif 83 endif 84 endif 85endif 86 87if ( TR_Map == 4 ) 88 return 89endif 90 91set TR_Map to 4 92 93End