Scripts

TR_m4_NPC_Nivis_Dalomo

TR_Mainland.esm
Variables 11
Local Variables
TR_Map
control
controlQ
NoLore
T_Local_NPC
T_Local_NoLore
T_Local_HHScripExchange
ScripCount
ScripStart
GoldStart
GoldEnd
Source
1begin TR_m4_NPC_Nivis_Dalomo 2; This short script is there to allow dialogue to be filtered on the TR_Map local variable, 3; allowing for regional topics such as "Morrowind Lore" or "Geographic Regions" to be 4; appropriate to the location the NPC is. 5 6short TR_Map 7short control 8short controlQ 9short NoLore 10short T_Local_NPC 11short T_Local_NoLore 12short T_Local_HHScripExchange 13long ScripCount 14long ScripStart 15long GoldStart 16long GoldEnd 17 18if ( TR_m4_FG_UshuFree == 2 ) 19 if ( GetDisabled == 0 ) 20 disable 21 endif 22endif 23 24if ( TR_m4_FG_UshuFree >= 3 ) 25 if ( GetDisabled == 1 ) 26 enable 27 endif 28endif 29 30if ( OnDeath ) 31 set T_Local_HHScripExchange to -1 32 set TR_m4_UshuKur_D_Nivis.disableOnce to -1 33endif 34 35if ( OnActivate ) 36 if ( GetPCSneaking ) ; when PC is pickpocketing, ignore. 37 elseif ( GetFatigue < 10 ) ; when NPC is knocked out, ignore. <10 is for recovery animation. 38 elseif ( T_Local_HHScripExchange == 0 ) ; else initiate scrip exchange if PC has scrip 39 if ( player->GetItemCount T_De_HlaaluCompanyScrip_01 > 0 ) 40 41 set T_Local_HHScripExchange to 1 42 43 ; add the topic so the merchant can be asked about it, in case player is confused 44 AddTopic "Hlaalu Company scrip" 45 46 set ScripStart to ( player->GetItemCount T_De_HlaaluCompanyScrip_01 ) 47 set GoldStart to ( player->GetItemCount gold_001 ) 48 set ScripCount to ScripStart 49 50 while ( ScripCount > 0 ) 51 if ( ScripCount >= 10000 ) 52 set ScripCount to ( ScripCount - 10000 ) 53 player->RemoveItem T_De_HlaaluCompanyScrip_01 10000 54 player->AddItem gold_001 10000 55 elseif ( ScripCount >= 1000 ) 56 set ScripCount to ( ScripCount - 1000 ) 57 player->RemoveItem T_De_HlaaluCompanyScrip_01 1000 58 player->AddItem gold_001 1000 59 elseif ( ScripCount >= 100 ) 60 set ScripCount to ( ScripCount - 100 ) 61 player->RemoveItem T_De_HlaaluCompanyScrip_01 100 62 player->AddItem gold_001 100 63 elseif ( ScripCount >= 10 ) 64 set ScripCount to ( ScripCount - 10 ) 65 player->RemoveItem T_De_HlaaluCompanyScrip_01 10 66 player->AddItem gold_001 10 67 elseif ( ScripCount >= 1 ) 68 set ScripCount to ( ScripCount - 1 ) 69 player->RemoveItem T_De_HlaaluCompanyScrip_01 1 70 player->AddItem gold_001 1 71 endif 72 endwhile 73 Return ; no activate now, delay one frame instead. 74 endif 75 endif 76 Activate 77elseif ( T_Local_HHScripExchange == 1 ) 78 set T_Local_HHScripExchange to 2 79 Activate 80elseif ( T_Local_HHScripExchange == 2 ) 81 set T_Local_HHScripExchange to 3 ; skip one frame 82elseif ( T_local_HHScripExchange == 3 ) 83 if ( MenuMode == 0 ) 84 85 set GoldEnd to ( player->GetItemCount gold_001 ) 86 set GoldEnd to ( GoldEnd - ScripStart ) 87 set ScripCount to ( ScripStart - ( GoldStart - GoldEnd ) ) 88 89 if ( ScripCount > ScripStart ) 90 set ScripCount to ScripStart ; don't give the player more scrip than they had at the start, have profits be gold instead. 91 endif 92 93 while ( ScripCount > 0 ) 94 if ( ScripCount >= 10000 ) 95 set ScripCount to ( ScripCount - 10000 ) 96 player->AddItem T_De_HlaaluCompanyScrip_01 10000 97 player->RemoveItem gold_001 10000 98 elseif ( ScripCount >= 1000 ) 99 set ScripCount to ( ScripCount - 1000 ) 100 player->AddItem T_De_HlaaluCompanyScrip_01 1000 101 player->RemoveItem gold_001 1000 102 elseif ( ScripCount >= 100 ) 103 set ScripCount to ( ScripCount - 100 ) 104 player->AddItem T_De_HlaaluCompanyScrip_01 100 105 player->RemoveItem gold_001 100 106 elseif ( ScripCount >= 10 ) 107 set ScripCount to ( ScripCount - 10 ) 108 player->AddItem T_De_HlaaluCompanyScrip_01 10 109 player->RemoveItem gold_001 10 110 elseif ( ScripCount >= 1 ) 111 set ScripCount to ( ScripCount - 1 ) 112 player->AddItem T_De_HlaaluCompanyScrip_01 1 113 player->RemoveItem gold_001 1 114 endif 115 endwhile 116 set ScripCount to 0 117 set ScripStart to 0 118 set GoldStart to 0 119 set GoldEnd to 0 120 set T_local_HHScripExchange to 0 121 122 endif 123endif 124 125if ( TR_Map == 4 ) 126 return 127endif 128 129set TR_Map to 4 130 131End