Scripts

TR_m4_Pub_Grey_Lodge

TR_Mainland.esm
Variables 23
Local Variables
TR_Map
control
controlQ
rent
rentDay
rentMonth
setup
cleanup
TR_pubquiz
TR_pubquiz_Q
TR_pubquiz_Correct
TR_pubquiz_Prize
TR_pubquiz_Done
TR_pubquiz_Day
TR_pubquiz_Month
TR_pubquiz_Setup
TR_pubquiz_Clean
TR_pubquiz_End
T_Local_NPC
NoLore
TR_pubquiz_R
TR_pubquiz_Tally
TR_pubquiz_TallyOp
Source
1begin TR_m4_Pub_Grey_Lodge 2 3;Cell: The Grey Lodge 4;Publican: "TR_m4_Kraki the Grey" 5;Flag: TR_m4_Rent_Grey_Lodge 6;Room Door: TR_m4_rd_GreyLodge 7 8;all rooms get rented for one day 9;This NPC must be in the map where the room is if you use the locked door cell loading cleanup 10;rename the script for the NPC and make a specific door to unlock or flag to set 11;NO actual key is given to player, a global flag is set that removes the ownership on the beds. 12 13;this script fires off when RENT is set true. Rent is set true through the BEDS topic in dialogue, which all Publicans have. 14;Each publican will also have a separate response to buying the bed, so they can give simple directions. There is also a default one. 15 16short TR_Map 17short control 18short controlQ 19short rent ;if room is rented, set through dialogue on this NPC 20short rentDay ;the day of the rental 21short rentMonth ;the month of the rental 22short setup ;if setup has been done 23short cleanup ;true if you want to cleanup all the flags, rental is over and can be reset 24;this script also uses a global variable (TR_m1_Rent_Queens_Cutlass). Make a new one for each rental. You can have as many 25;beds as you want use that variable, it is used through the ownership data on the object reference 26 27 28;pub quiz shorts 29 30short TR_pubquiz ;for the NPC 31short TR_pubquiz_Q ;question number 32float TR_pubquiz_R ;round 33short TR_pubquiz_Correct ;correct answer: 1 - A, 2 - B, 3 - C 34float TR_pubquiz_Tally ;keeps the score 35float TR_pubquiz_TallyOp ;the opponent's tally 36short TR_pubquiz_Prize ;random prize 37short TR_pubquiz_Done ;just had a quiz -- gotta wait for the next one 38short TR_pubquiz_Day 39short TR_pubquiz_Month 40short TR_pubquiz_Setup 41short TR_pubquiz_Clean 42short TR_pubquiz_End 43short T_Local_NPC 44short NoLore 45 46if ( TR_pubquiz_Done == 1 ) 47 48 if ( TR_pubquiz_Setup == 0 ) 49 set TR_pubquiz_Day to Day 50 set TR_pubquiz_Month to Month 51 set TR_pubquiz_Setup to 1 52 53 elseif ( TR_pubquiz_Setup == 1 ) ;setup is done so check to see if a couple of days have passed 54 55 if ( Day != TR_pubquiz_Day ) 56 set TR_pubquiz_Setup to 2 57 elseif ( Month != TR_pubquiz_Month ) 58 set TR_pubquiz_Setup to 2 59 endif 60 61 endif 62 63 64 65 if ( TR_pubquiz_Setup == 2 ) 66 set TR_pubquiz_Day to Day 67 set TR_pubquiz_Month to Month 68 set TR_pubquiz_Clean to 1 69 70 else ;setup is done so check to see if a couple of days have passed 71 72 if ( Day != TR_pubquiz_Day ) 73 set TR_pubquiz_Clean to 1 74 elseif ( Month != TR_pubquiz_Month ) 75 set TR_pubquiz_Clean to 1 76 endif 77 78 endif 79 80 81 if ( TR_pubquiz_Clean == 1 ) 82 set TR_pubquiz_Done to 0 83 set TR_pubquiz_Setup to 0 84 set TR_pubquiz_Day to 0 85 set TR_pubquiz_Month to 0 86 set TR_pubquiz_Clean to 0 87 endif 88 89endif 90 91 92if ( rent == 1 ) 93 94 if ( setup == 0 ) 95 set rentDay to Day 96 set rentMonth to Month 97 set setup to 1 98 set TR_m4_Rent_Grey_Lodge to 1 ;this is the flag for the ownership on the bed 99 TR_m4_rd_GreyLodge->unlock ;opens the door 100 TR_m4_rd_GreyLodge->PlaySound3D "Open Lock" 101 102 else ;setup is done so check to see if the day is over 103 104 if ( Day != rentDay ) 105 set cleanup to 1 106 107 elseif ( Month != rentMonth ) 108 set cleanup to 1 109 110 endif 111 112 endif 113 114 if ( CellChanged ) ;this is only needed if you've done a locked door. If so, you only want to do this on cell change so you don't lock them in the room 115 if ( cleanup == 1 ) ;this gets called when the rental is over and everything can be cleaned up 116 set rent to 0 117 set TR_m4_Rent_Grey_Lodge to 0 118 TR_m4_rd_GreyLodge->lock 50 ;locks the door 119 TR_m4_rd_GreyLodge->PlaySound3D "LockedDoor" 120 set setup to 0 121 set rentDay to 0 122 set rentMonth to 0 123 set cleanup to 0 124 endif 125 endif 126 127endif 128 129; This short script is there to allow dialogue to be filtered on the TR_Map local variable, 130; allowing for regional topics such as "Morrowind Lore" or "Geographic Regions" to be 131; appropriate to the location the NPC is. 132 133if ( TR_Map == 4 ) 134 return 135endif 136 137AddTopic "pub quiz" 138set TR_Map to 4 139 140End