Scripts

TR_m7_oth_q_EdalvelLetterSC

TR_Mainland.esm
Variables 8
Local Variables
sealFailed
PCSkipEquip
OnPCEquip
letterState
securityCheck
button
wasActivated
questupdate
Source
1begin TR_m7_oth_q_EdalvelLetterSC 2 3;MESSAGE FROM MR.POTATO: I don't know if this is allowed but I basically made small edits to the vanilla script. 4 5;allows player to open and read "sealed" letter... 6;and gives the player the chance to "re-seal" them 7;the global tr_m7_oth_q_eldavelletter_seal is used for dialogue... 8;to tell if the letterl is CURRENTLY sealed or not 9;for quest TR_m7_Oth_EdalvelLetter 10 11short sealFailed 12short PCSkipEquip 13short OnPCEquip 14short letterState 15short securityCheck 16short button 17short wasActivated 18short questupdate 19;global tr_m7_oth_q_eldavelletter_seal 20 21;letterState... 22;0 never been loaded, sets PCSkipEquip once 23;1 scoll is sealed, ask if you want to unseal 24;2 player has been asked to unseal, wait for response 25;3 it is unsealed and can be read 26;4 it has been read once, ask if you want to re-seal 27;5 player has been asked to re-seal, wait for response 28 29if ( GetDisabled == 1 ) 30 Return 31endif 32 33if ( letterState == 0 ) 34 ;set up PCSkipEquip for first use 35 Set PCSkipEquip to 1 36 Set letterState to 1 37endif 38 39if ( OnActivate == 1 ) 40 Set wasActivated to 1 41 ;handle activate method of reading books 42endif 43 44if ( wasActivated == 1 ) 45 set wasActivated to 0 46 if ( letterState == 1 ) 47 MessageBox "This letter has been sealed. If you want to break the seal, drop the letter on your character." "Okay." "Pick up Letter." 48 set letterState to 10 49 Return 50 endif 51 52 if ( letterState == 10 ) 53 set button to GetButtonPressed 54 if ( button == 0 ) 55 Set letterState to 0 56 Set wasActivated to 0 57 elseif ( button == 1 ) 58 ;can't get around activate... so we add on copy to the player and disable this reference 59 Player->AddItem "tr_m7_oth_q_edalvelletter" 1 60 Set letterState to 0 61 Set wasActivated to 0 62 Disable 63 endif 64 Return 65 endif 66 67 ;if ( letterState == SOMETHING ELSE ) 68 Activate 69 70endif 71 72 73if ( OnPCEquip == 0 ) 74 Set button to -1 75 Return 76endif 77 78if ( letterState == 1 ) 79 MessageBox "Do you want to break the seal and read the letter?" "Yes" "No" 80 Set letterState to 2 81endif 82 83if ( letterState == 2 ) 84 set button to GetButtonPressed 85 if ( button == 0 ) 86 Set letterState to 3 87 Set tr_m7_oth_q_eldavelletter_seal to 1 88 Set OnPCEquip to 0 89 Set PCSkipEquip to 0 90 MessageBox "You have broken the seal." "Okay" 91 player->equip "TR_m7_oth_q_edalvelletter" 92 if ( GetJournalIndex TR_m7_Oth_EdalvelLetter < 50 ) 93 if ( GetJournalIndex TR_m7_Oth_EdalvelLetter >= 10 ) 94 Journal TR_m7_Oth_EdalvelLetter 50 95 endif 96 endif 97 98 99;unseal it and set global 100 elseif ( button == 1 ) 101 Set letterState to 1 102 Set PCSkipEquip to 1 103 Set OnPCEquip to 0 104 ;leave it sealed and reset PCSkipEquip 105 endif 106 Return 107endif 108 109if ( letterState == 3 ) 110 Set letterState to 4 111 Set PCSkipEquip to 1 112 Return 113endif 114 115if ( letterState == 4 ) 116 MessageBox "Do you want to read the letter again, or try to re-seal it?" "Read again" "Re-seal it" 117 Set letterState to 5 118 Return 119endif 120 121if ( letterState == 5 ) 122 set button to GetButtonPressed 123 if ( button == 0 ) 124 Set letterState to 3 125 Set OnPCEquip to 0 126 Set PCSkipEquip to 0 127 elseif ( button == 1 ) 128 if ( sealFailed == 0 ) 129 Set securityCheck to Random 100 130 if ( Player->GetSecurity > securityCheck ) 131 Set letterState to 1 132 Set PCSkipEquip to 1 133 Set tr_m7_oth_q_eldavelletter_seal to 0 134 MessageBox "You have resealed the letter." "Okay" 135 ;reset state and conditions here 136 else 137 set sealFailed to 1 138 MessageBox "You have damaged the seal." "Okay" 139 endif 140 else 141 MessageBox "The seal has been damaged." "Okay" 142 endif 143 Set OnPCEquip to 0 144 endif 145endif 146 147 148End