begin "Tii_Guar_Companion_Script";Variables.short topics ;used to add all necessary topics at the right times to Tii Guar.short acompanion ;used for setting AI to follow player.short timerOn ; used for setting the timer (used in relation to timer).short objectCount ;used for checking how many arrows Tii Guar has.short supplies ;used for the feature of resupplying Tii Guars inventory.short greeting ;used for checking distance for force greet.short repair ;used for reparing Tii Guar's equipment.float timer ;used for timing an event for resupplying.;set variables.set topics to 0;skip acompanion because we don't want it to continuesly be set to 0.set timerOn to 0set timer to 0set objectCount to ( GetItemCount, "chitin arrow" ) ;sets objectCount to the amount of arrows Tii Guar has in her inventory.set supplies to -1set greeting to 0set repair to 0;control all topicsif ( topics == 0 ) ;topics added the moment you talk to Tii Guar AddTopic "Why are you in Seyda Neen?" AddTopic "Why do you trade at Arrille's Tradehouse?" AddTopic "Why are you a hunter?" AddTopic "That is a very nice amulet." AddTopic "Who is Hircine?" AddTopic "Supplies" set topics to 1endif;controls setting Tii Guar as a companion.if ( acompanion == 1 ) "aa shaddow_Tii Guar"-> AIFollow Player 0, 0, 0, 0 ;sets Tii Guar to Follow player. set supplies to 0elseif ( acompanion == 0 ) "aa shaddow_Tii Guar"-> AIWander, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0endif;control timerOn settingsif ( timerOn == 1 ) set timer to ( timer + GetSecondsPassed ) "aa shaddow_Tii Guar"-> AIWander, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0endif;control timerif ( timer > 15.0 ) set supplies to 4 set timer to 0 set timerOn to 0endif;control resupplying (for use with objectCount, timer, timerOn, acompanion, and greeting)if ( supplies == 0 ) if ( objectCount < 25 ) ;if Tii Guar has less then 25 chitin arrows. if ( GetPCCell "Seyda Neen, Arrille's Tradehouse" == 1 ) set supplies to 1 endif ;only ends checking cell. endif ;only ends checking objectCount.elseif ( supplies == 1 ) if ( greeting == 0 ) if ( GetDistance, Player <= 200 ) ForceGreeting set greeting to 1 set supplies to 2 ;after the greeting is forced moves to the next step. CHECK IF ERROR ACCURS. endif ;only ends checking distance and setting greeting. endif ;only ends checking greeting.elseif ( supplies == 2 ) set acompanion to 0 setHello 0 ;makes Tii Guar not initiate voice dialog wile the walking. "aa shaddow_Tii Guar"-> AITravel, -324, -64, 387 ;makes Tii Guar start heading up stairs. set supplies to 3elseif ( supplies == 3 ) if ( GetAIPackageDone == 1 ) ;if Tii Guar has made it to her destination. set timerOn to 1 else Return endifelseif ( supplies == 4 ) if ( greeting == 1 ) set acompanion to 1 if ( GetDistance, Player <= 200 ) ForceGreeting set greeting to 0 set supplies to 5 ;after the greeting is forced moves to the next step. CHECK IF ERROR ACCURS. endif ;only ends checking distance and setting greeting. endif ;only ends checking greeting.elseif ( supplies == 5 ) ;this is where set repair to 1 will be. set supplies to 6 ;change to 0 when repair feature is implemented.endifend