Scripts

T_ScNpc_Mw_Map4HHScrip

Tamriel_Data.esm
Variables 11
Local Variables
TR_Map
control
controlQ
T_Local_NPC
T_Local_Khajiit
NoLore
T_Local_HHScripExchange
ScripCount
ScripStart
GoldStart
GoldEnd
Source
1Begin T_ScNpc_Mw_Map4HHScrip 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; This script also facilitates the treatment of Hlaalu Company Scrip as equivalent to gold, 6; this is done by temporarily exchanging them for each other outside dialogue 7; so no messages are displayed on the player's screen. 8 9short TR_Map 10short control 11short controlQ 12short T_Local_NPC 13short T_Local_Khajiit 14short NoLore 15short T_Local_HHScripExchange 16long ScripCount 17long ScripStart 18long GoldStart 19long GoldEnd 20 21if ( OnDeath ) 22 set T_Local_HHScripExchange to -1 23endif 24 25if ( OnActivate ) 26 if ( GetPCSneaking ) ; when PC is pickpocketing, ignore. 27 elseif ( GetFatigue < 10 ) ; when NPC is knocked out, ignore. <10 is for recovery animation. 28 elseif ( T_Local_HHScripExchange == 0 ) ; else initiate scrip exchange if PC has scrip 29 if ( player->GetItemCount T_De_HlaaluCompanyScrip_01 > 0 ) 30 31 set T_Local_HHScripExchange to 1 32 33 ; add the topic so the merchant can be asked about it, in case player is confused 34 AddTopic "Hlaalu Company scrip" 35 36 set ScripStart to ( player->GetItemCount T_De_HlaaluCompanyScrip_01 ) 37 set GoldStart to ( player->GetItemCount gold_001 ) 38 set ScripCount to ScripStart 39 40 while ( ScripCount > 0 ) 41 if ( ScripCount >= 10000 ) 42 set ScripCount to ( ScripCount - 10000 ) 43 player->RemoveItem T_De_HlaaluCompanyScrip_01 10000 44 player->AddItem gold_001 10000 45 elseif ( ScripCount >= 1000 ) 46 set ScripCount to ( ScripCount - 1000 ) 47 player->RemoveItem T_De_HlaaluCompanyScrip_01 1000 48 player->AddItem gold_001 1000 49 elseif ( ScripCount >= 100 ) 50 set ScripCount to ( ScripCount - 100 ) 51 player->RemoveItem T_De_HlaaluCompanyScrip_01 100 52 player->AddItem gold_001 100 53 elseif ( ScripCount >= 10 ) 54 set ScripCount to ( ScripCount - 10 ) 55 player->RemoveItem T_De_HlaaluCompanyScrip_01 10 56 player->AddItem gold_001 10 57 elseif ( ScripCount >= 1 ) 58 set ScripCount to ( ScripCount - 1 ) 59 player->RemoveItem T_De_HlaaluCompanyScrip_01 1 60 player->AddItem gold_001 1 61 endif 62 endwhile 63 Return ; no activate now, delay one frame instead. 64 endif 65 endif 66 Activate 67elseif ( T_Local_HHScripExchange == 1 ) 68 set T_Local_HHScripExchange to 2 69 Activate 70elseif ( T_Local_HHScripExchange == 2 ) 71 set T_Local_HHScripExchange to 3 ; skip one frame 72elseif ( T_local_HHScripExchange == 3 ) 73 if ( MenuMode == 0 ) 74 75 set GoldEnd to ( player->GetItemCount gold_001 ) 76 set GoldEnd to ( GoldEnd - ScripStart ) 77 set ScripCount to ( ScripStart - ( GoldStart - GoldEnd ) ) 78 79 if ( ScripCount > ScripStart ) 80 set ScripCount to ScripStart ; don't give the player more scrip than they had at the start, have profits be gold instead. 81 endif 82 83 while ( ScripCount > 0 ) 84 if ( ScripCount >= 10000 ) 85 set ScripCount to ( ScripCount - 10000 ) 86 player->AddItem T_De_HlaaluCompanyScrip_01 10000 87 player->RemoveItem gold_001 10000 88 elseif ( ScripCount >= 1000 ) 89 set ScripCount to ( ScripCount - 1000 ) 90 player->AddItem T_De_HlaaluCompanyScrip_01 1000 91 player->RemoveItem gold_001 1000 92 elseif ( ScripCount >= 100 ) 93 set ScripCount to ( ScripCount - 100 ) 94 player->AddItem T_De_HlaaluCompanyScrip_01 100 95 player->RemoveItem gold_001 100 96 elseif ( ScripCount >= 10 ) 97 set ScripCount to ( ScripCount - 10 ) 98 player->AddItem T_De_HlaaluCompanyScrip_01 10 99 player->RemoveItem gold_001 10 100 elseif ( ScripCount >= 1 ) 101 set ScripCount to ( ScripCount - 1 ) 102 player->AddItem T_De_HlaaluCompanyScrip_01 1 103 player->RemoveItem gold_001 1 104 endif 105 endwhile 106 set ScripCount to 0 107 set ScripStart to 0 108 set GoldStart to 0 109 set GoldEnd to 0 110 set T_local_HHScripExchange to 0 111 112 endif 113endif 114 115if ( T_Local_Khajiit ) 116 return 117endif 118 119set T_Local_Khajiit to -1 120 121if ( GetRace "T_Els_Cathay" ) 122 set T_Local_Khajiit to 1 123elseif ( GetRace "T_Els_Cathay-raht" ) 124 set T_Local_Khajiit to 1 125elseif ( GetRace "T_Els_Dagi-raht" ) 126 set T_Local_Khajiit to 1 127elseif ( GetRace "T_Els_Ohmes" ) 128 set T_Local_Khajiit to 1 129elseif ( GetRace "T_Els_Ohmes-raht" ) 130 set T_Local_Khajiit to 1 131elseif ( GetRace "T_Els_Suthay" ) 132 set T_Local_Khajiit to 1 133elseif ( GetRace "T_Els_Tojay" ) 134 set T_Local_Khajiit to 1 135elseif ( GetRace "Khajiit" ) 136 set T_Local_Khajiit to 1 137endif 138set TR_Map to 4 139 140End