(i already know the existence of a teach spell mod, but if a similar mod is bundled inside the B3w4r3's mod, will be more perfect)
ScriptName PartnerScriptshort partnershort npctypeshort partyshort inpartyshort standbyshort stayshort packageshort followshort followingshort controlfloat controltimershort commandshort interiorshort dooncefloat timershort timepastfloat partytimershort fspeedshort fathleticsfloat pfacingshort incombatshort deadshort isdeadshort alertshort lootref reftargetshort dispositionshort crimeshort npccrimeshort bountyshort forcecombatshort pccombatfloat combattimershort sparringshort adversaryfloat xposfloat yposfloat zposshort warpshort localwarpshort teleportshort lockoutshort loadshort mapshort pczshort npczshort runningshort sittingshort torchshort sneakingshort chameleonshort invisibleshort waterbreathingshort waterwalkingshort hoodshort shieldshort countshort hoodsetref hoodrefshort npcspeedshort npcathleticsshort npchealthshort npcmagickashort npcfatigueshort npcacrobaticsshort npcresponsibilityshort npcaggressionshort npcdispshort dispdiff ; Defined as ( npcdisp - disposition )short setupdoonceshort npclevelshort pclevelshort levelupshort pchealthshort inventoryshort regulatorshort repairref refnpcref refboxshort joinshort menushort mjoinshort mmenuref hatBegin OnDeath set isdead to 1 if inparty == 1 Message, "Your partner is dead." endif EndBegin MenuMode 1023 set map to 1 set hat to getequippedobject 1EndBegin OnLoadif inparty == 1 && map == 1 set load to 1endifif teleport == 2 set teleport to 0 RemoveScriptPackage AddScriptPackage "cmStandby" SetFactionRank NPCStand, 1 SetFactionRank NPCParty, 0 endifset partner to ( GetFactionRank Partners )set npctype to ( GetFactionRank NPCType )set inparty to ( GetFactionRank NPCParty )set standby to ( GetFactionRank NPCStand )set stay to ( GetFactionRank NPCStay )set follow to GetCurrentAiPackage == 1set npclevel to GetLevelset pclevel to Player.GetLevelset npcdisp to GetDisposition Playerset npcmagicka to ( GetBaseActorValue Magicka )set npcfatigue to ( GetBaseActorValue Fatigue )set npcspeed to ( GetBaseActorValue Speed )set npcathletics to ( GetBaseActorValue Athletics )set npcacrobatics to ( GetBaseActorValue Acrobatics ) set npcresponsibility to ( GetBaseActorValue Responsibility )set npcaggression to ( GetBaseActorValue Aggression ) set pchealth to ( Player.GetBaseActorValue Health )set refnpc to GetSelfset dead to GetDeadif npctype == 1 set npchealth to ( 0.85 * pchealth ) SetActorValue Health, npchealthelseif npctype == 2 set npchealth to ( 0.80 * pchealth ) SetActorValue Health, npchealthelseif npctype == 3 set npchealth to ( 0.75 * pchealth ) SetActorValue Health, npchealth endifif inparty == 1 && dead != 1 set control to 1endifif cmPartnersQuest.nRead == 1 set cmPartnersQuest.nRead to 0endifEndBegin OnActivate ; Sets Quest variables when Dialogue is activated. This allows every Partner NPC to use the Quest dialogue as their own.Set cmPartnersQuest.nType to npctypeset cmPartnersQuest.nInParty to inpartyset cmPartnersQuest.npcRef to GetSelfif IsActionRef Player == 1 && Player.IsSneaking == 1 && partner >= 1 && disposition >= 50 && dead != 1 ; Activates the Quick Menu if the Player is sneaking, or works normal if the Player is not.. if partner == 1 && join == 0 MessageBox "Partner:" "Join me" "Stats" "Nevermind" set join to 1 elseif partner == 2 && inparty == 1 && menu == 0 MessageBox "Partner:" "Follow Me" "Stats" "Share" "Guard" "Standby" "Stay" "Nevermind" set menu to 1 elseif partner == 2 && inparty == 0 && menu == 0 MessageBox "Partner:" "Follow Me" "Stats" "Nevermind" set menu to 1 endifelseif IsActionRef Player == 1 && Player.IsSneaking == 1 && partner >= 1 && disposition < 50 && dead != 1 MessageBox "I'm sorry. I don't know you well enough."elseif IsActionRef Player == 1 && Player.IsSneaking == 0 Activateelse ActivateendifEndBegin GameMode ; Normal game scripting run in non-menu mode.; INITIAL SETUP - Sets all starting values for variables and adds topics and spells..if setupdoonce == 0 set partner to ( GetFactionRank Partners ) set npctype to ( GetFactionRank NPCType ) set inparty to ( GetFactionRank NPCParty ) set standby to ( GetFactionRank NPCStand ) set stay to ( GetFactionRank NPCStay ) set npclevel to GetLevel set pclevel to Player.GetLevel set pchealth to ( Player.GetBaseActorValue Health ) set npcdisp to GetDisposition Player set npcmagicka to ( GetBaseActorValue Magicka ) set npcfatigue to ( GetBaseActorValue Fatigue ) set npcspeed to ( GetBaseActorValue Speed ) set npcathletics to ( GetBaseActorValue Athletics ) set npcacrobatics to ( GetBaseActorValue Acrobatics ) set npcresponsibility to ( GetBaseActorValue Responsibility ) set npcaggression to ( GetBaseActorValue Aggression ) if npctype < 1 ; If NPCType is not set for NPC, then will set to 1, Combat. SetFactionRank NPCType, 1 endif AddTopic cmStats AddTopic cmJoinMe if npctype == 3 AddSpell "cmHealPlayer" AddSpell "cmRestoreHealth" else AddSpell "cmRestoreHealth10" endif set setupdoonce to -1endifif hat != 0if isincombat == 1 && getequipped hat == 0 equipitem hat elseif isincombat == 0 && getequipped hat == 1 unequipitem hatendifendifif dead == 1 && isdead == 1 ; Terminates script after 10 minutes if NPC is dead. set timer to ( timer + GetSecondsPassed ) If timer > 600 set timepast to -1 set isdead to -1; MoveTo cmDeadMark1 SetQuestObject refnpc 0 SetFactionRank Partners, 0 SetFactionRank NPCParty, 0 SetFactionRank NPCStand, 0 SetFactionRank NPCStay, 0 RemoveScriptPackage endif elseif dead == 1 && isdead == -1 Returnendif; MENU MODE - Quick Menuif join == 1 && partner == 1 Set mjoin to GetButtonPressed if mjoin == 0 ; Join set mjoin to -1 set join to 0 ModFactionRank Partners, 1 SetFactionRank NPCParty, 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" Return elseif mjoin == 1 ; Stats set mjoin to -1 set join to 0 AddItem cmQkStatToken 1 Return elseif mjoin == 2 ; Nevermind set mjoin to -1 set join to 0 Return endifelseif menu == 1 && partner == 2 && inparty == 1 set mmenu to GetButtonPressed if mmenu == 0 ; Follow set mmenu to -1 set menu to 0 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 SetFactionRank NPCStay, 0 SetFactionRank NPCStand, 0 Return elseif mmenu == 1 ; Stats set mmenu to -1 set menu to 0 AddItem cmQkStatToken 1 Return elseif mmenu == 2 ; Share set mmenu to -1 set menu to 0 set inventory to 1 Return elseif mmenu == 3 ; Guard RemoveScriptPackage AddScriptPackage "cmStandGuard" SetFactionRank NPCParty, 0 set mmenu to -1 set menu to 0 Return elseif mmenu == 4 ; Standby set mmenu to -1 set menu to 0 RemoveScriptPackage AddScriptPackage "cmStandby" SetFactionRank NPCParty, 0 SetFactionRank NPCStand, 1 Return elseif mmenu == 5 ; Stay set mmenu to -1 set menu to 0 RemoveScriptPackage AddScriptPackage "cmWander" SetFactionRank NPCParty, 0 SetFactionRank NPCStay, 1 Return elseif mmenu == 6 ; Nevermind set mmenu to -1 set menu to 0 Return endifelseif menu == 1 && partner == 2 && inparty == 0 set mmenu to GetButtonPressed if mmenu == 0 ; Follow set mmenu to -1 set menu to 0 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 SetFactionRank NPCStay, 0 SetFactionRank NPCStand, 0 Return elseif mmenu == 1 ; Stats set mmenu to -1 set menu to 0 AddItem cmQkStatToken 1 Return elseif mmenu == 2 ; Nevermind set mmenu to -1 set menu to 0 Return endif endif; TELEPORT MODEif load >= 1 && inparty == 1 ; Modified fix from Cecelia for double face bug. if load == 3 Enable set load to 0 RemoveScriptPackage AddScriptPackage cmFollowPlayer elseif load == 2 Disable set load to 3 elseif load == 1 set map to 0 set load to 2 endif endifif teleport == 1 && command == 0 && cmPartnersQuest.nLockNPC == 0 ; Teleport script for Mark and Return set teleport to 2 RemoveScriptPackage SetFactionRank NPCParty, 0 PlaySound AMBThunder if pfacing < 90 ; northeasterly MoveTo cmPartnersMark1, -50, -50, 10 elseif pfacing < 180 ; southeasterly MoveTo cmPartnersMark1, -50, 50, 10 elseif pfacing < 270 ; southwesterly MoveTo cmPartnersMark1, 50, 50, 10 else ; northwesterly MoveTo cmPartnersMark1, 50, -50, 10 endif set teleport to 0 RemoveScriptPackage AddScriptPackage "cmStandby" SetFactionRank NPCStand, 1 SetFactionRank NPCParty, 0 elseif teleport == 1 && command == 0 && cmPartnersQuest.nLockNPC == 1 set teleport to 0 Message, "Mark and Return doesn't work here."endifif warp == 1 && cmPartnersQuest.nLockout == 0 ; Warp script for Summon and Recall set warp to 0 if pfacing < 90 ; northeasterly MoveTo Player, -50, -50, 10 elseif pfacing < 180 ; southeasterly MoveTo Player, -50, 50, 10 elseif pfacing < 270 ; southwesterly MoveTo Player, 50, 50, 10 else ; northwesterly MoveTo Player, 50, -50, 10 endifelseif warp == 1 && command == 0 && cmPartnersQuest.nLockout == 1 set warp to 0 Message, "Warp doesn't work here." endifif localwarp == 1 ; Local warp script for the Partners Ring and Movement Warp set localwarp to 0 if pfacing < 90 ; northeasterly MoveTo Player, -50, -50, 10 elseif pfacing < 180 ; southeasterly MoveTo Player, -50, 50, 10 elseif pfacing < 270 ; southwesterly MoveTo Player, 50, 50, 10 else ; northwesterly MoveTo Player, 50, -50, 10 endifendifset package to GetCurrentAiPackage ; Updates main variables.set follow to GetCurrentAiPackage == 1set partner to ( GetFactionRank Partners )set inparty to ( GetFactionRank NPCParty )set standby to ( GetFactionRank NPCStand )set stay to ( GetFactionRank NPCStay )set interior to IsInInteriorset disposition to GetDisposition Playerset dispdiff to ( npcdisp - disposition )set incombat to IsInCombatset pccombat to Player.IsInCombatset adversary to ( GetInFaction Adversaries )set bounty to GetCrimeGoldset dead to GetDeadif crime == 1 && dispdiff > 0 ; Resets disposition if Player commits a crime. ModDisposition Player, dispdiff set disposition to GetDisposition Player set crime to 0endifif npccrime == 1 || bounty > 0 SetCrimeGold 0 set npccrime to 0 set bounty to 0endifif control == 1 && inparty == 1 && incombat == 0 && dead != 1 set controltimer to ( controltimer + GetSecondsPassed ) if controltimer > 2 set control to 0 set controltimer to 0 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" endifendif; FOLLOW MODE - Sets all the follow variables to define how the NPC follows the Player.if follow == 1 && following == 0 set fspeed to ( Player.GetActorValue Speed * 1.5 ) set fathletics to ( Player.GetActorValue Athletics * 1.5 ) SetActorValue Speed, fspeed SetActorValue Athletics, fathletics SetIgnoreFriendlyHits 10 set following to 1 elseif follow != 1 && following == 1 SetActorValue Speed, npcspeed SetActorValue Athletics, npcathletics SetIgnoreFriendlyHits 5 set following to 0endifif follow == 1 && incombat == 0 set pcz to Player.GetPos z set npcz to GetPos z set pfacing to Player.GetAngle z elseif follow != 1 && incombat == 0 set npcz to GetPos zendifif follow == 1 && isridinghorse == 0 ; Scripting in this block commands the NPC to follow the Player in many different ways. (b3w4r3 Edited this line for horse support) if incombat == 0 if IsSwimming == 0 && (GetDistance Player > 1024) || (pcz > (npcz + 400)) || (pcz < (npcz - 400)) ; Warp script: get the angle player is facing, and move to player, but behind. set localwarp to 1 elseif IsSwimming == 1 && (GetDistance Player > 1600) || (pcz > (npcz + 800)) || (pcz < (npcz - 800)) ; Warp script: get the angle player is facing, and move to player, but behind. set localwarp to 1 endif endif if alert == 0 && Player.IsWeaponOut == 1 SetAlert 1 set alert to 1 elseif alert == 1 && Player.IsWeaponOut == 0 SetAlert 0 set alert to 0 endif if sneaking == 0 && Player.IsSneaking == 1 && incombat == 0 SetForceSneak 1 set sneaking to 1 SetActorValue Responsibility, 0 SetActorValue Aggression, 5 elseif sneaking == 1 && Player.IsSneaking == 0 || incombat == 1 SetForceSneak 0 set sneaking to 0 SetActorValue Responsibility, npcresponsibility SetActorValue Aggression, npcaggression endif if chameleon == 0 && Player.HasMagicEffect CHML == 1 AddSpell "cmChameleonA" set chameleon to 1 elseif chameleon == 1 && Player.HasMagicEffect CHML == 0 RemoveSpell "cmChameleonA" set chameleon to 0 endif if invisible == 0 && Player.HasMagicEffect INVI == 1 AddSpell "cmInvisibilityA" set invisible to 1 elseif invisible == 1 && Player.HasMagicEffect INVI == 0 RemoveSpell "cmInvisibilityA" set invisible to 0 endif if running == 0 && Player.IsRunning == 1 SetForceRun 1 set running to 1 elseif running == 1 && Player.IsRunning == 0 SetForceRun 0 set running to 0 endif if waterwalking == 0 && Player.HasMagicEffect WAWA == 1 AddSpell "cmWaterWalkingA" set waterwalking to 1 elseif waterwalking == 1 && Player.HasMagicEffect WAWA == 0 RemoveSpell "cmWaterWalkingA" set waterwalking to 0 endif if npctype == 3 && sparring == 0 && cmPartnersQuest.nHeal == 1 ; Cast Party Heal spell. AddSpell "cmHealParty" Cast cmHealParty Player RemoveSpell "cmHealParty" set cmPartnersQuest.nHeal to 0 endif if sitting == 0 && Player.GetSitting == 3 AddScriptPackage "cmSitScript" set sitting to 1 endif endifif sitting == 1 && Player.GetSitting == 0 ; Forces NPC to rejoin Player after sitting package is complete. RemoveScriptPackage AddScriptPackage "cmFollowPlayer" set sitting to 0endif; COMBAT MODE ; Controls combat between Partner NPCs, the Player, and other NPCs.if forcecombat == 2 && inparty == 1 && pccombat == 0 && cmPartnersQuest.nSpar == 0 set forcecombat to 0 SetFactionRank Adversaries -1 ModActorValue Aggression -30 set cmPartnersQuest.nForce to 0 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" elseif forcecombat == 1 && follow == 1 && pccombat == 1 && GetDistance Player <= 2000 && npcaggression >= 5 && cmPartnersQuest.nSpar == 0 set forcecombat to 2 SetFactionRank Adversaries 1 ModActorValue Aggression 30 set reftarget to GetCombatTarget StartCombat reftargetelseif forcecombat == 0 && follow == 1 && cmPartnersQuest.nForce == 1 && cmPartnersQuest.nSpar == 0 set forcecombat to 1elseif forcecombat == 0 && follow == 1 && IsInCombat == 1 && npcaggression >= 5 && cmPartnersQuest.nSpar == 0 && cmPartnersQuest.nForce == 0 set reftarget to GetCombatTarget SetIgnoreFriendlyHits 30; set loot to 1 ; If activated will cause Partners to automatically loot the area after combat. if reftarget == Player Yield set loot to 0 Return elseif reftarget.GetInFaction Partners > -1 Yield ModDisposition reftarget 100 set loot to 0 Return elseif reftarget.GetInFaction Minions > -1 || reftarget.GetInFaction Beasts > -1 Yield ModDisposition reftarget 100 set loot to 0 Return endifendifif loot == 1 && incombat == 0 ; Automatically starts looting after combat. if reftarget.GetDead == 1 set loot to 0 Message, "Looting" RemoveScriptPackage AddScriptPackage "cmLootWeapon" SetPackDuration 8 endifendifif sparring == 1 && forcecombat == 0 && inparty == 1 && cmPartnersQuest.nSpar == 0 set sparring to 0 set cmPartnersQuest.nHeal to 1 SetFactionRank Adversaries -1 ModActorValue Aggression -100 StopCombat RemoveScriptPackage AddScriptPackage "cmFollowPlayer"endifif sparring == 0 && forcecombat == 0 && inparty == 1 && cmPartnersQuest.nSpar == 1 set sparring to 1 SetFactionRank Adversaries 0 ModActorValue Aggression 100 StartCombat Playerendif; INVENTORY MODE - Inventory scripting which is a modified Toaster script, but uses MoveTo rather than the PlaceAtMe command. .if inventory == 1 && follow == 1 if regulator == 3 AddItem cmTorch02 1 EquipItem cmTorch02 RemoveItem cmTorch02 1 set regulator to 0 toggleActorsAI RemoveScriptPackage "cmInventory" AddScriptPackage "cmFollowPlayer" set inventory to 0 endif if regulator == 2 && MenuMode == 0 set regulator to 3 cmInvNPC.RemoveAllItems refnpc endif if regulator == 1 toggleActorsAI RemoveAllItems cmInvNPC cmInvNPC.Activate Player set regulator to 2 endif if regulator == 0 cmInvNPC.MoveTo Player 0 0 -50 set refbox to cmInvNPC refbox.setOwnership set regulator to 1 endifendif; PARTY COMMANDS - Reads Quest variable nParty and executes party commands for NPC.if command == 1 && cmPartnersQuest.nParty >= 1 set partytimer to ( partytimer + GetSecondsPassed ) If partytimer > 3 set cmPartnersQuest.nParty to 0 set command to 0 set partytimer to 0 endifelseif command == 1 && cmPartnersQuest.nParty == 0 set command to 0 set partytimer to 0endifif partner == 2 && command == 0 && cmPartnersQuest.nParty==1 && inparty == 1 ; Party Follow set command to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCStay, 0 SetFactionRank NPCStand, 0 SetFactionRank NPCParty, 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==2 && inparty == 1 ; Party Guard set command to 1 RemoveScriptPackage AddScriptPackage "cmStandGuard" SetFactionRank NPCParty, 0elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==3 && inparty == 1 ; Party Stay set command to 1 RemoveScriptPackage AddScriptPackage "cmWander" SetFactionRank NPCStay, 1 SetFactionRank NPCParty, 0elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==4 && inparty == 1 ; Party Eat RemoveScriptPackage AddScriptPackage "cmEatCommand" set command to 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==5 && inparty == 1 ; Party Drink RemoveScriptPackage AddScriptPackage "cmDrunkCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==6 && inparty == 1 ; Party Sleep RemoveScriptPackage AddScriptPackage "cmSleepCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==7 && inparty == 1 && npctype >= 2 ; Party Harvest RemoveScriptPackage AddScriptPackage "cmHarvestCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==8 && inparty == 1 ; Party Melee RemoveScriptPackage AddScriptPackage "cmMeleeCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==9 && inparty == 1 ; Party Magic RemoveScriptPackage AddScriptPackage "cmCastAnyCommand" set command to 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==10 && inparty == 1 ; Party Attack NPC RemoveScriptPackage AddScriptPackage "cmAttackNPCCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==11 && inparty == 1 ; Party Attack Creature RemoveScriptPackage AddScriptPackage "cmAttackMonsterCommand" set command to 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==12 && stay == 1 && dead != 1 ; Party Recall set command to 1 set warp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCStay, 0 SetFactionRank NPCParty, 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==13 && inparty == 1 && dead != 1 ; Partners Ring set command to 1 set localwarp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==14 && standby == 1 && dead != 1 ; Party Summon set command to 1 set warp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCStand, 0 SetFactionRank NPCParty, 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==15 && inparty == 1 ; Party Loot set command to 1 RemoveScriptPackage AddScriptPackage "cmLootArmor" SetPackDuration 15elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==17 && inparty == 1 && dead != 1 ; Party Return set command to 1 set teleport to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==18 && inparty == 1 ; Party Standby set command to 1 RemoveScriptPackage AddScriptPackage "cmStandby" SetFactionRank NPCStand, 1 SetFactionRank NPCParty, 0endif; ITEMS - Items used by the party.if torch == 0 && IsActorUsingATorch == 0 && cmPartnersQuest.nTorch == 1 && IsSneaking == 0 AddItem cmTorch02 1 EquipItem cmTorch02 set torch to 1elseif torch == 1 && cmPartnersQuest.nTorch == 0 RemoveItem cmTorch02 1 set torch to 0elseif torch == 1 && IsSneaking == 1 RemoveItem cmTorch02 1 set torch to 0 endifif hoodset == 0 && cmPartnersQuest.nHood >= 1 ; HOODS - Adds hood to Stealth characters and a lighter hood of the same color to Magic characters outside at night or during the day when it's raining. Hoods are removed during the day when it's not raining or when you go inside. set hoodset to 1 if npctype == 2 && cmPartnersQuest.nHood == 1 ; Black Hood set hoodref to BlackHood elseif npctype == 3 && cmPartnersQuest.nHood == 1 ; Blue Hood set hoodref to ArchMageHood elseif npctype == 2 && cmPartnersQuest.nHood == 2 ; Green Hood set hoodref to LowerRobe04hood elseif npctype == 3 && cmPartnersQuest.nHood == 2 ; Aqua Silk Hood set hoodref to UpperRobe03hood elseif npctype == 2 && cmPartnersQuest.nHood == 3 ; Dark Gray Hood set hoodref to LowerRobe02hood elseif npctype == 3 && cmPartnersQuest.nHood == 3 ; Gray Hood set hoodref to LowerRobe05hood elseif npctype == 2 && cmPartnersQuest.nHood == 4 ; Red Hood set hoodref to MythicDawnRobeHood elseif npctype == 3 && cmPartnersQuest.nHood == 4 ; Red Silk Hood set hoodref to UpperRobe02hood endifelseif hoodset == 1 && cmPartnersQuest.nHood == 0 set hoodset to 0endif if hoodset == 1 && hood == 1 && interior == 1 set count to GetItemCount hoodref if count > 0 UnEquipItem hoodref RemoveItem hoodref 1 set hood to 0 endifelseif hoodset == 1 && hood == 1 && interior == 0 && Gamehour > 8 && GameHour < 19 && IsRaining == 0 set count to GetItemCount hoodref if count > 0 UnEquipItem hoodref RemoveItem hoodref 1 set hood to 0 endifelseif hoodset == 1 && hood == 0 && interior == 0 && ( GameHour > 19 || GameHour < 8 || IsRaining > 0.5 ) AddItem hoodref 1 EquipItem hoodref set hood to 1 elseif hoodset == 0 && hood == 1 UnEquipItem hoodref RemoveItem hoodref 1 set hood to 0endifif cmPartnersQuest.nShield == 1 && shield == 0 ; SHIELD & CUIRASS - Adds or removes a Kvatch Shield.& Cuirass if GetItemCount TownguardKvShield == 0 AddItem TownguardKvShield 1 EquipItem TownguardKvShield endif if GetItemCount TownguardCuirassKv == 0 AddItem TownguardCuirassKv 1 EquipItem TownguardCuirassKv endif set shield to 1elseif cmPartnersQuest.nShield == 2 && shield == 1 if GetItemCount TownguardKvShield >= 1 UnequipItem TownguardKvShield RemoveItem TownguardKvShield 1 endif if GetItemCount TownguardCuirassKv >= 1 UnequipItem TownguardCuirassKv RemoveItem TownguardCuirassKv 1 endif set shield to 0 AddItem cmTorch02 1 EquipItem cmTorch02 RemoveItem cmTorch02 1 endif; LEVELUPif cmPartnersQuest.nLevel == 0 && levelup == 1 set levelup to 0elseif cmPartnersQuest.nLevel == 0 && levelup == 0 && ( GetBaseActorValue Health < npchealth ) SetActorValue Health, npchealthelseif cmPartnersQuest.nLevel == 1 && levelup == 0 set npclevel to GetLevel set pclevel to Player.GetLevel set pchealth to ( Player.GetBaseActorValue Health ) set npcmagicka to ( GetBaseActorValue Magicka ) set npcfatigue to ( GetBaseActorValue Fatigue ) set npcspeed to ( GetBaseActorValue Speed ) set npcathletics to ( GetBaseActorValue Athletics ) set npcacrobatics to ( GetBaseActorValue Acrobatics ) set levelup to 1 if npctype == 1 set npchealth to ( 0.85 * pchealth ) SetActorValue Health, npchealth elseif npctype == 2 set npchealth to ( 0.80 * pchealth ) SetActorValue Health, npchealth elseif npctype == 3 set npchealth to ( 0.75 * pchealth ) SetActorValue Health, npchealth endif endifEnd; AI PACKAGE CONTROLSBegin OnPackageStart "cmInventory" if partner == 2 && IsInCombat != 1 set inventory to 1 endifEnd Begin OnPackageStart "cmFollowPlayer" SetFactionRank NPCParty, 1 SetFactionRank NPCStand, 0 SetFactionRank NPCStay, 0EndBegin OnPackageStart "cmStandGuard" SetFactionRank NPCParty, 0 EndBegin OnPackageStart "cmStandby" SetFactionRank NPCStand, 1 SetFactionRank NPCParty, 0 EndBegin OnPackageStart "cmWander" SetFactionRank NPCStay, 1 SetFactionRank NPCParty, 0 End Begin OnPackageStart "cmPickLockContainer" SetPackDuration 20EndBegin OnPackageDone "cmPickLockContainer" ; Commands NPC to rejoin Player after commands are executed. RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 EndBegin OnPackageDone "cmHarvestCommand" set warp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 EndBegin OnPackageStart "cmEatCommand" SetPackDuration 40 EndBegin OnPackageStart "cmDrinkCommand" SetPackDuration 40 EndBegin OnPackageStart "cmDrunkCommand" SetPackDuration 40EndBegin OnPackageDone "cmLootArmor" ; Daisy-chaining Loot AI Packages so that Partner NPC's will loot various items automatically after combat or on command, and then return to the Player when done. RemoveScriptPackage AddScriptPackage "cmLootWeapon" SetPackDuration 10EndBegin OnPackageDone "cmLootWeapon" RemoveScriptPackage AddScriptPackage "cmLootAmmo" SetPackDuration 5EndBegin OnPackageDone "cmLootAmmo" RemoveScriptPackage AddScriptPackage "cmLootIngred" SetPackDuration 5EndBegin OnPackageDone "cmLootIngred" RemoveScriptPackage AddScriptPackage "cmLootGold" SetPackDuration 5EndBegin OnPackageDone "cmLootGold" set warp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 EndBegin OnAlarm 0, Player set crime to 1EndBegin OnAlarm 1, Player set crime to 1EndBegin OnAlarm 2, Player set crime to 1EndBegin OnAlarm 3, Player set crime to 1EndBegin OnAlarm 4, Player set crime to 1EndBegin OnAlarm 0 set npccrime to 1EndBegin OnAlarm 1 set npccrime to 1EndBegin OnAlarm 2 set npccrime to 1EndBegin OnAlarm 3 set npccrime to 1EndBegin OnAlarm 4 set npccrime to 1End
float HatTimerBegin OnStartCombatif hat != 0 set HatTimer to 60 if getequipped hat == 0 equipitem hatendifendifEndif hat != 0it HatTimer > 0 && isincombat == 0set HatTimer to HatTimer - getsecondspassedelseif isincombat == 0 && getequipped hat == 1unequipitem hatendifendif
ScriptName PartnerScriptshort partnershort npctypeshort partyshort inpartyshort standbyshort stayshort packageshort followshort followingshort controlfloat controltimershort commandshort interiorshort dooncefloat timershort timepastfloat partytimershort fspeedshort fathleticsfloat pfacingshort incombatshort deadshort isdeadshort alertshort lootref reftargetshort dispositionshort crimeshort npccrimeshort bountyshort forcecombatshort pccombatfloat combattimershort sparringshort adversaryfloat xposfloat yposfloat zposshort warpshort localwarpshort teleportshort lockoutshort loadshort mapshort pczshort npczshort runningshort sittingshort torchshort sneakingshort chameleonshort invisibleshort waterbreathingshort waterwalkingshort hoodshort shieldshort countshort hoodsetref hoodrefshort npcspeedshort npcathleticsshort npchealthshort npcmagickashort npcfatigueshort npcacrobaticsshort npcresponsibilityshort npcaggressionshort npcdispshort dispdiff ; Defined as ( npcdisp - disposition )short setupdoonceshort npclevelshort pclevelshort levelupshort pchealthshort inventoryshort regulatorshort repairref refnpcref refboxshort joinshort menushort mjoinshort mmenuref hatfloat HatTimerBegin OnDeath set isdead to 1 if inparty == 1 Message, "Your partner is dead." endif EndBegin MenuMode 1023 set map to 1EndBegin OnLoadif inparty == 1 && map == 1 set load to 1endifif teleport == 2 set teleport to 0 RemoveScriptPackage AddScriptPackage "cmStandby" SetFactionRank NPCStand, 1 SetFactionRank NPCParty, 0 endifset partner to ( GetFactionRank Partners )set npctype to ( GetFactionRank NPCType )set inparty to ( GetFactionRank NPCParty )set standby to ( GetFactionRank NPCStand )set stay to ( GetFactionRank NPCStay )set follow to GetCurrentAiPackage == 1set npclevel to GetLevelset pclevel to Player.GetLevelset npcdisp to GetDisposition Playerset npcmagicka to ( GetBaseActorValue Magicka )set npcfatigue to ( GetBaseActorValue Fatigue )set npcspeed to ( GetBaseActorValue Speed )set npcathletics to ( GetBaseActorValue Athletics )set npcacrobatics to ( GetBaseActorValue Acrobatics ) set npcresponsibility to ( GetBaseActorValue Responsibility )set npcaggression to ( GetBaseActorValue Aggression ) set pchealth to ( Player.GetBaseActorValue Health )set refnpc to GetSelfset dead to GetDeadset hat to getequippedobject 1if npctype == 1 set npchealth to ( 0.85 * pchealth ) SetActorValue Health, npchealthelseif npctype == 2 set npchealth to ( 0.80 * pchealth ) SetActorValue Health, npchealthelseif npctype == 3 set npchealth to ( 0.75 * pchealth ) SetActorValue Health, npchealth endifif inparty == 1 && dead != 1 set control to 1endifif cmPartnersQuest.nRead == 1 set cmPartnersQuest.nRead to 0endifEndBegin OnStartCombatif hat != 0 set HatTimer to 60if getequipped hat == 0 equipitem hatendifendifEndBegin OnActivate ; Sets Quest variables when Dialogue is activated. This allows every Partner NPC to use the Quest dialogue as their own.Set cmPartnersQuest.nType to npctypeset cmPartnersQuest.nInParty to inpartyset cmPartnersQuest.npcRef to GetSelfif IsActionRef Player == 1 && Player.IsSneaking == 1 && partner >= 1 && disposition >= 50 && dead != 1 ; Activates the Quick Menu if the Player is sneaking, or works normal if the Player is not.. if partner == 1 && join == 0 MessageBox "Partner:" "Join me" "Stats" "Nevermind" set join to 1 elseif partner == 2 && inparty == 1 && menu == 0 MessageBox "Partner:" "Follow Me" "Stats" "Share" "Guard" "Standby" "Stay" "Nevermind" set menu to 1 elseif partner == 2 && inparty == 0 && menu == 0 MessageBox "Partner:" "Follow Me" "Stats" "Nevermind" set menu to 1 endifelseif IsActionRef Player == 1 && Player.IsSneaking == 1 && partner >= 1 && disposition < 50 && dead != 1 MessageBox "I'm sorry. I don't know you well enough."elseif IsActionRef Player == 1 && Player.IsSneaking == 0 Activateelse ActivateendifEndBegin GameMode ; Normal game scripting run in non-menu mode.; INITIAL SETUP - Sets all starting values for variables and adds topics and spells..if setupdoonce == 0 set partner to ( GetFactionRank Partners ) set npctype to ( GetFactionRank NPCType ) set inparty to ( GetFactionRank NPCParty ) set standby to ( GetFactionRank NPCStand ) set stay to ( GetFactionRank NPCStay ) set npclevel to GetLevel set pclevel to Player.GetLevel set pchealth to ( Player.GetBaseActorValue Health ) set npcdisp to GetDisposition Player set npcmagicka to ( GetBaseActorValue Magicka ) set npcfatigue to ( GetBaseActorValue Fatigue ) set npcspeed to ( GetBaseActorValue Speed ) set npcathletics to ( GetBaseActorValue Athletics ) set npcacrobatics to ( GetBaseActorValue Acrobatics ) set npcresponsibility to ( GetBaseActorValue Responsibility ) set npcaggression to ( GetBaseActorValue Aggression ) if npctype < 1 ; If NPCType is not set for NPC, then will set to 1, Combat. SetFactionRank NPCType, 1 endif AddTopic cmStats AddTopic cmJoinMe if npctype == 3 AddSpell "cmHealPlayer" AddSpell "cmRestoreHealth" else AddSpell "cmRestoreHealth10" endif set setupdoonce to -1endifif hat != 0it HatTimer > 0 && isincombat == 0set HatTimer to HatTimer - getsecondspassedelseif isincombat == 0 && getequipped hat == 1unequipitem hatendifendifif dead == 1 && isdead == 1 ; Terminates script after 10 minutes if NPC is dead. set timer to ( timer + GetSecondsPassed ) If timer > 600 set timepast to -1 set isdead to -1; MoveTo cmDeadMark1 SetQuestObject refnpc 0 SetFactionRank Partners, 0 SetFactionRank NPCParty, 0 SetFactionRank NPCStand, 0 SetFactionRank NPCStay, 0 RemoveScriptPackage endif elseif dead == 1 && isdead == -1 Returnendif; MENU MODE - Quick Menuif join == 1 && partner == 1 Set mjoin to GetButtonPressed if mjoin == 0 ; Join set mjoin to -1 set join to 0 ModFactionRank Partners, 1 SetFactionRank NPCParty, 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" Return elseif mjoin == 1 ; Stats set mjoin to -1 set join to 0 AddItem cmQkStatToken 1 Return elseif mjoin == 2 ; Nevermind set mjoin to -1 set join to 0 Return endifelseif menu == 1 && partner == 2 && inparty == 1 set mmenu to GetButtonPressed if mmenu == 0 ; Follow set mmenu to -1 set menu to 0 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 SetFactionRank NPCStay, 0 SetFactionRank NPCStand, 0 Return elseif mmenu == 1 ; Stats set mmenu to -1 set menu to 0 AddItem cmQkStatToken 1 Return elseif mmenu == 2 ; Share set mmenu to -1 set menu to 0 set inventory to 1 Return elseif mmenu == 3 ; Guard RemoveScriptPackage AddScriptPackage "cmStandGuard" SetFactionRank NPCParty, 0 set mmenu to -1 set menu to 0 Return elseif mmenu == 4 ; Standby set mmenu to -1 set menu to 0 RemoveScriptPackage AddScriptPackage "cmStandby" SetFactionRank NPCParty, 0 SetFactionRank NPCStand, 1 Return elseif mmenu == 5 ; Stay set mmenu to -1 set menu to 0 RemoveScriptPackage AddScriptPackage "cmWander" SetFactionRank NPCParty, 0 SetFactionRank NPCStay, 1 Return elseif mmenu == 6 ; Nevermind set mmenu to -1 set menu to 0 Return endifelseif menu == 1 && partner == 2 && inparty == 0 set mmenu to GetButtonPressed if mmenu == 0 ; Follow set mmenu to -1 set menu to 0 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 SetFactionRank NPCStay, 0 SetFactionRank NPCStand, 0 Return elseif mmenu == 1 ; Stats set mmenu to -1 set menu to 0 AddItem cmQkStatToken 1 Return elseif mmenu == 2 ; Nevermind set mmenu to -1 set menu to 0 Return endif endif; TELEPORT MODEif load >= 1 && inparty == 1 ; Modified fix from Cecelia for double face bug. if load == 3 Enable set load to 0 RemoveScriptPackage AddScriptPackage cmFollowPlayer elseif load == 2 Disable set load to 3 elseif load == 1 set map to 0 set load to 2 endif endifif teleport == 1 && command == 0 && cmPartnersQuest.nLockNPC == 0 ; Teleport script for Mark and Return set teleport to 2 RemoveScriptPackage SetFactionRank NPCParty, 0 PlaySound AMBThunder if pfacing < 90 ; northeasterly MoveTo cmPartnersMark1, -50, -50, 10 elseif pfacing < 180 ; southeasterly MoveTo cmPartnersMark1, -50, 50, 10 elseif pfacing < 270 ; southwesterly MoveTo cmPartnersMark1, 50, 50, 10 else ; northwesterly MoveTo cmPartnersMark1, 50, -50, 10 endif set teleport to 0 RemoveScriptPackage AddScriptPackage "cmStandby" SetFactionRank NPCStand, 1 SetFactionRank NPCParty, 0 elseif teleport == 1 && command == 0 && cmPartnersQuest.nLockNPC == 1 set teleport to 0 Message, "Mark and Return doesn't work here."endifif warp == 1 && cmPartnersQuest.nLockout == 0 ; Warp script for Summon and Recall set warp to 0 if pfacing < 90 ; northeasterly MoveTo Player, -50, -50, 10 elseif pfacing < 180 ; southeasterly MoveTo Player, -50, 50, 10 elseif pfacing < 270 ; southwesterly MoveTo Player, 50, 50, 10 else ; northwesterly MoveTo Player, 50, -50, 10 endifelseif warp == 1 && command == 0 && cmPartnersQuest.nLockout == 1 set warp to 0 Message, "Warp doesn't work here." endifif localwarp == 1 ; Local warp script for the Partners Ring and Movement Warp set localwarp to 0 if pfacing < 90 ; northeasterly MoveTo Player, -50, -50, 10 elseif pfacing < 180 ; southeasterly MoveTo Player, -50, 50, 10 elseif pfacing < 270 ; southwesterly MoveTo Player, 50, 50, 10 else ; northwesterly MoveTo Player, 50, -50, 10 endifendifset package to GetCurrentAiPackage ; Updates main variables.set follow to GetCurrentAiPackage == 1set partner to ( GetFactionRank Partners )set inparty to ( GetFactionRank NPCParty )set standby to ( GetFactionRank NPCStand )set stay to ( GetFactionRank NPCStay )set interior to IsInInteriorset disposition to GetDisposition Playerset dispdiff to ( npcdisp - disposition )set incombat to IsInCombatset pccombat to Player.IsInCombatset adversary to ( GetInFaction Adversaries )set bounty to GetCrimeGoldset dead to GetDeadif crime == 1 && dispdiff > 0 ; Resets disposition if Player commits a crime. ModDisposition Player, dispdiff set disposition to GetDisposition Player set crime to 0endifif npccrime == 1 || bounty > 0 SetCrimeGold 0 set npccrime to 0 set bounty to 0endifif control == 1 && inparty == 1 && incombat == 0 && dead != 1 set controltimer to ( controltimer + GetSecondsPassed ) if controltimer > 2 set control to 0 set controltimer to 0 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" endifendif; FOLLOW MODE - Sets all the follow variables to define how the NPC follows the Player.if follow == 1 && following == 0 set fspeed to ( Player.GetActorValue Speed * 1.5 ) set fathletics to ( Player.GetActorValue Athletics * 1.5 ) SetActorValue Speed, fspeed SetActorValue Athletics, fathletics SetIgnoreFriendlyHits 10 set following to 1 elseif follow != 1 && following == 1 SetActorValue Speed, npcspeed SetActorValue Athletics, npcathletics SetIgnoreFriendlyHits 5 set following to 0endifif follow == 1 && incombat == 0 set pcz to Player.GetPos z set npcz to GetPos z set pfacing to Player.GetAngle z elseif follow != 1 && incombat == 0 set npcz to GetPos zendifif follow == 1 && isridinghorse == 0 ; Scripting in this block commands the NPC to follow the Player in many different ways. (b3w4r3 Edited this line for horse support) if incombat == 0 if IsSwimming == 0 && (GetDistance Player > 1024) || (pcz > (npcz + 400)) || (pcz < (npcz - 400)) ; Warp script: get the angle player is facing, and move to player, but behind. set localwarp to 1 elseif IsSwimming == 1 && (GetDistance Player > 1600) || (pcz > (npcz + 800)) || (pcz < (npcz - 800)) ; Warp script: get the angle player is facing, and move to player, but behind. set localwarp to 1 endif endif if alert == 0 && Player.IsWeaponOut == 1 SetAlert 1 set alert to 1 elseif alert == 1 && Player.IsWeaponOut == 0 SetAlert 0 set alert to 0 endif if sneaking == 0 && Player.IsSneaking == 1 && incombat == 0 SetForceSneak 1 set sneaking to 1 SetActorValue Responsibility, 0 SetActorValue Aggression, 5 elseif sneaking == 1 && Player.IsSneaking == 0 || incombat == 1 SetForceSneak 0 set sneaking to 0 SetActorValue Responsibility, npcresponsibility SetActorValue Aggression, npcaggression endif if chameleon == 0 && Player.HasMagicEffect CHML == 1 AddSpell "cmChameleonA" set chameleon to 1 elseif chameleon == 1 && Player.HasMagicEffect CHML == 0 RemoveSpell "cmChameleonA" set chameleon to 0 endif if invisible == 0 && Player.HasMagicEffect INVI == 1 AddSpell "cmInvisibilityA" set invisible to 1 elseif invisible == 1 && Player.HasMagicEffect INVI == 0 RemoveSpell "cmInvisibilityA" set invisible to 0 endif if running == 0 && Player.IsRunning == 1 SetForceRun 1 set running to 1 elseif running == 1 && Player.IsRunning == 0 SetForceRun 0 set running to 0 endif if waterwalking == 0 && Player.HasMagicEffect WAWA == 1 AddSpell "cmWaterWalkingA" set waterwalking to 1 elseif waterwalking == 1 && Player.HasMagicEffect WAWA == 0 RemoveSpell "cmWaterWalkingA" set waterwalking to 0 endif if npctype == 3 && sparring == 0 && cmPartnersQuest.nHeal == 1 ; Cast Party Heal spell. AddSpell "cmHealParty" Cast cmHealParty Player RemoveSpell "cmHealParty" set cmPartnersQuest.nHeal to 0 endif if sitting == 0 && Player.GetSitting == 3 AddScriptPackage "cmSitScript" set sitting to 1 endif endifif sitting == 1 && Player.GetSitting == 0 ; Forces NPC to rejoin Player after sitting package is complete. RemoveScriptPackage AddScriptPackage "cmFollowPlayer" set sitting to 0endif; COMBAT MODE ; Controls combat between Partner NPCs, the Player, and other NPCs.if forcecombat == 2 && inparty == 1 && pccombat == 0 && cmPartnersQuest.nSpar == 0 set forcecombat to 0 SetFactionRank Adversaries -1 ModActorValue Aggression -30 set cmPartnersQuest.nForce to 0 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" elseif forcecombat == 1 && follow == 1 && pccombat == 1 && GetDistance Player <= 2000 && npcaggression >= 5 && cmPartnersQuest.nSpar == 0 set forcecombat to 2 SetFactionRank Adversaries 1 ModActorValue Aggression 30 set reftarget to GetCombatTarget StartCombat reftargetelseif forcecombat == 0 && follow == 1 && cmPartnersQuest.nForce == 1 && cmPartnersQuest.nSpar == 0 set forcecombat to 1elseif forcecombat == 0 && follow == 1 && IsInCombat == 1 && npcaggression >= 5 && cmPartnersQuest.nSpar == 0 && cmPartnersQuest.nForce == 0 set reftarget to GetCombatTarget SetIgnoreFriendlyHits 30; set loot to 1 ; If activated will cause Partners to automatically loot the area after combat. if reftarget == Player Yield set loot to 0 Return elseif reftarget.GetInFaction Partners > -1 Yield ModDisposition reftarget 100 set loot to 0 Return elseif reftarget.GetInFaction Minions > -1 || reftarget.GetInFaction Beasts > -1 Yield ModDisposition reftarget 100 set loot to 0 Return endifendifif loot == 1 && incombat == 0 ; Automatically starts looting after combat. if reftarget.GetDead == 1 set loot to 0 Message, "Looting" RemoveScriptPackage AddScriptPackage "cmLootWeapon" SetPackDuration 8 endifendifif sparring == 1 && forcecombat == 0 && inparty == 1 && cmPartnersQuest.nSpar == 0 set sparring to 0 set cmPartnersQuest.nHeal to 1 SetFactionRank Adversaries -1 ModActorValue Aggression -100 StopCombat RemoveScriptPackage AddScriptPackage "cmFollowPlayer"endifif sparring == 0 && forcecombat == 0 && inparty == 1 && cmPartnersQuest.nSpar == 1 set sparring to 1 SetFactionRank Adversaries 0 ModActorValue Aggression 100 StartCombat Playerendif; INVENTORY MODE - Inventory scripting which is a modified Toaster script, but uses MoveTo rather than the PlaceAtMe command. .if inventory == 1 && follow == 1 if regulator == 3 AddItem cmTorch02 1 EquipItem cmTorch02 RemoveItem cmTorch02 1 set regulator to 0 toggleActorsAI RemoveScriptPackage "cmInventory" AddScriptPackage "cmFollowPlayer" set inventory to 0 endif if regulator == 2 && MenuMode == 0 set regulator to 3 cmInvNPC.RemoveAllItems refnpc endif if regulator == 1 toggleActorsAI RemoveAllItems cmInvNPC cmInvNPC.Activate Player set regulator to 2 endif if regulator == 0 cmInvNPC.MoveTo Player 0 0 -50 set refbox to cmInvNPC refbox.setOwnership set regulator to 1 endifendif; PARTY COMMANDS - Reads Quest variable nParty and executes party commands for NPC.if command == 1 && cmPartnersQuest.nParty >= 1 set partytimer to ( partytimer + GetSecondsPassed ) If partytimer > 3 set cmPartnersQuest.nParty to 0 set command to 0 set partytimer to 0 endifelseif command == 1 && cmPartnersQuest.nParty == 0 set command to 0 set partytimer to 0endifif partner == 2 && command == 0 && cmPartnersQuest.nParty==1 && inparty == 1 ; Party Follow set command to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCStay, 0 SetFactionRank NPCStand, 0 SetFactionRank NPCParty, 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==2 && inparty == 1 ; Party Guard set command to 1 RemoveScriptPackage AddScriptPackage "cmStandGuard" SetFactionRank NPCParty, 0elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==3 && inparty == 1 ; Party Stay set command to 1 RemoveScriptPackage AddScriptPackage "cmWander" SetFactionRank NPCStay, 1 SetFactionRank NPCParty, 0elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==4 && inparty == 1 ; Party Eat RemoveScriptPackage AddScriptPackage "cmEatCommand" set command to 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==5 && inparty == 1 ; Party Drink RemoveScriptPackage AddScriptPackage "cmDrunkCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==6 && inparty == 1 ; Party Sleep RemoveScriptPackage AddScriptPackage "cmSleepCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==7 && inparty == 1 && npctype >= 2 ; Party Harvest RemoveScriptPackage AddScriptPackage "cmHarvestCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==8 && inparty == 1 ; Party Melee RemoveScriptPackage AddScriptPackage "cmMeleeCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==9 && inparty == 1 ; Party Magic RemoveScriptPackage AddScriptPackage "cmCastAnyCommand" set command to 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==10 && inparty == 1 ; Party Attack NPC RemoveScriptPackage AddScriptPackage "cmAttackNPCCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==11 && inparty == 1 ; Party Attack Creature RemoveScriptPackage AddScriptPackage "cmAttackMonsterCommand" set command to 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==12 && stay == 1 && dead != 1 ; Party Recall set command to 1 set warp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCStay, 0 SetFactionRank NPCParty, 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==13 && inparty == 1 && dead != 1 ; Partners Ring set command to 1 set localwarp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==14 && standby == 1 && dead != 1 ; Party Summon set command to 1 set warp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCStand, 0 SetFactionRank NPCParty, 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==15 && inparty == 1 ; Party Loot set command to 1 RemoveScriptPackage AddScriptPackage "cmLootArmor" SetPackDuration 15elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==17 && inparty == 1 && dead != 1 ; Party Return set command to 1 set teleport to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==18 && inparty == 1 ; Party Standby set command to 1 RemoveScriptPackage AddScriptPackage "cmStandby" SetFactionRank NPCStand, 1 SetFactionRank NPCParty, 0endif; ITEMS - Items used by the party.if torch == 0 && IsActorUsingATorch == 0 && cmPartnersQuest.nTorch == 1 && IsSneaking == 0 AddItem cmTorch02 1 EquipItem cmTorch02 set torch to 1elseif torch == 1 && cmPartnersQuest.nTorch == 0 RemoveItem cmTorch02 1 set torch to 0elseif torch == 1 && IsSneaking == 1 RemoveItem cmTorch02 1 set torch to 0 endifif hoodset == 0 && cmPartnersQuest.nHood >= 1 ; HOODS - Adds hood to Stealth characters and a lighter hood of the same color to Magic characters outside at night or during the day when it's raining. Hoods are removed during the day when it's not raining or when you go inside. set hoodset to 1 if npctype == 2 && cmPartnersQuest.nHood == 1 ; Black Hood set hoodref to BlackHood elseif npctype == 3 && cmPartnersQuest.nHood == 1 ; Blue Hood set hoodref to ArchMageHood elseif npctype == 2 && cmPartnersQuest.nHood == 2 ; Green Hood set hoodref to LowerRobe04hood elseif npctype == 3 && cmPartnersQuest.nHood == 2 ; Aqua Silk Hood set hoodref to UpperRobe03hood elseif npctype == 2 && cmPartnersQuest.nHood == 3 ; Dark Gray Hood set hoodref to LowerRobe02hood elseif npctype == 3 && cmPartnersQuest.nHood == 3 ; Gray Hood set hoodref to LowerRobe05hood elseif npctype == 2 && cmPartnersQuest.nHood == 4 ; Red Hood set hoodref to MythicDawnRobeHood elseif npctype == 3 && cmPartnersQuest.nHood == 4 ; Red Silk Hood set hoodref to UpperRobe02hood endifelseif hoodset == 1 && cmPartnersQuest.nHood == 0 set hoodset to 0endif if hoodset == 1 && hood == 1 && interior == 1 set count to GetItemCount hoodref if count > 0 UnEquipItem hoodref RemoveItem hoodref 1 set hood to 0 endifelseif hoodset == 1 && hood == 1 && interior == 0 && Gamehour > 8 && GameHour < 19 && IsRaining == 0 set count to GetItemCount hoodref if count > 0 UnEquipItem hoodref RemoveItem hoodref 1 set hood to 0 endifelseif hoodset == 1 && hood == 0 && interior == 0 && ( GameHour > 19 || GameHour < 8 || IsRaining > 0.5 ) AddItem hoodref 1 EquipItem hoodref set hood to 1 elseif hoodset == 0 && hood == 1 UnEquipItem hoodref RemoveItem hoodref 1 set hood to 0endifif cmPartnersQuest.nShield == 1 && shield == 0 ; SHIELD & CUIRASS - Adds or removes a Kvatch Shield.& Cuirass if GetItemCount TownguardKvShield == 0 AddItem TownguardKvShield 1 EquipItem TownguardKvShield endif if GetItemCount TownguardCuirassKv == 0 AddItem TownguardCuirassKv 1 EquipItem TownguardCuirassKv endif set shield to 1elseif cmPartnersQuest.nShield == 2 && shield == 1 if GetItemCount TownguardKvShield >= 1 UnequipItem TownguardKvShield RemoveItem TownguardKvShield 1 endif if GetItemCount TownguardCuirassKv >= 1 UnequipItem TownguardCuirassKv RemoveItem TownguardCuirassKv 1 endif set shield to 0 AddItem cmTorch02 1 EquipItem cmTorch02 RemoveItem cmTorch02 1 endif; LEVELUPif cmPartnersQuest.nLevel == 0 && levelup == 1 set levelup to 0elseif cmPartnersQuest.nLevel == 0 && levelup == 0 && ( GetBaseActorValue Health < npchealth ) SetActorValue Health, npchealthelseif cmPartnersQuest.nLevel == 1 && levelup == 0 set npclevel to GetLevel set pclevel to Player.GetLevel set pchealth to ( Player.GetBaseActorValue Health ) set npcmagicka to ( GetBaseActorValue Magicka ) set npcfatigue to ( GetBaseActorValue Fatigue ) set npcspeed to ( GetBaseActorValue Speed ) set npcathletics to ( GetBaseActorValue Athletics ) set npcacrobatics to ( GetBaseActorValue Acrobatics ) set levelup to 1 if npctype == 1 set npchealth to ( 0.85 * pchealth ) SetActorValue Health, npchealth elseif npctype == 2 set npchealth to ( 0.80 * pchealth ) SetActorValue Health, npchealth elseif npctype == 3 set npchealth to ( 0.75 * pchealth ) SetActorValue Health, npchealth endif endifEnd; AI PACKAGE CONTROLSBegin OnPackageStart "cmInventory" if partner == 2 && IsInCombat != 1 set inventory to 1 endifEnd Begin OnPackageStart "cmFollowPlayer" SetFactionRank NPCParty, 1 SetFactionRank NPCStand, 0 SetFactionRank NPCStay, 0EndBegin OnPackageStart "cmStandGuard" SetFactionRank NPCParty, 0 EndBegin OnPackageStart "cmStandby" SetFactionRank NPCStand, 1 SetFactionRank NPCParty, 0 EndBegin OnPackageStart "cmWander" SetFactionRank NPCStay, 1 SetFactionRank NPCParty, 0 End Begin OnPackageStart "cmPickLockContainer" SetPackDuration 20EndBegin OnPackageDone "cmPickLockContainer" ; Commands NPC to rejoin Player after commands are executed. RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 EndBegin OnPackageDone "cmHarvestCommand" set warp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 EndBegin OnPackageStart "cmEatCommand" SetPackDuration 40 EndBegin OnPackageStart "cmDrinkCommand" SetPackDuration 40 EndBegin OnPackageStart "cmDrunkCommand" SetPackDuration 40EndBegin OnPackageDone "cmLootArmor" ; Daisy-chaining Loot AI Packages so that Partner NPC's will loot various items automatically after combat or on command, and then return to the Player when done. RemoveScriptPackage AddScriptPackage "cmLootWeapon" SetPackDuration 10EndBegin OnPackageDone "cmLootWeapon" RemoveScriptPackage AddScriptPackage "cmLootAmmo" SetPackDuration 5EndBegin OnPackageDone "cmLootAmmo" RemoveScriptPackage AddScriptPackage "cmLootIngred" SetPackDuration 5EndBegin OnPackageDone "cmLootIngred" RemoveScriptPackage AddScriptPackage "cmLootGold" SetPackDuration 5EndBegin OnPackageDone "cmLootGold" set warp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 EndBegin OnAlarm 0, Player set crime to 1EndBegin OnAlarm 1, Player set crime to 1EndBegin OnAlarm 2, Player set crime to 1EndBegin OnAlarm 3, Player set crime to 1EndBegin OnAlarm 4, Player set crime to 1EndBegin OnAlarm 0 set npccrime to 1EndBegin OnAlarm 1 set npccrime to 1EndBegin OnAlarm 2 set npccrime to 1EndBegin OnAlarm 3 set npccrime to 1EndBegin OnAlarm 4 set npccrime to 1End
ScriptName PartnerScriptshort partnershort npctypeshort partyshort inpartyshort standbyshort stayshort packageshort followshort followingshort controlfloat controltimershort commandshort interiorshort dooncefloat timershort timepastfloat partytimershort fspeedshort fathleticsfloat pfacingshort incombatshort deadshort isdeadshort alertshort lootref reftargetshort dispositionshort crimeshort npccrimeshort bountyshort forcecombatshort pccombatfloat combattimershort sparringshort adversaryfloat xposfloat yposfloat zposshort warpshort localwarpshort teleportshort lockoutshort loadshort mapshort pczshort npczshort runningshort sittingshort torchshort sneakingshort chameleonshort invisibleshort waterbreathingshort waterwalkingshort hoodshort shieldshort countshort hoodsetref hoodrefshort npcspeedshort npcathleticsshort npchealthshort npcmagickashort npcfatigueshort npcacrobaticsshort npcresponsibilityshort npcaggressionshort npcdispshort dispdiff ; Defined as ( npcdisp - disposition )short setupdoonceshort npclevelshort pclevelshort levelupshort pchealthshort inventoryshort regulatorshort repairref refnpcref refboxshort joinshort menushort mjoinshort mmenuref hatfloat HatTimerBegin OnDeath set isdead to 1 if inparty == 1 Message, "Your partner is dead." endif EndBegin MenuMode 1023 set map to 1EndBegin OnLoadif inparty == 1 && map == 1 set load to 1endifif teleport == 2 set teleport to 0 RemoveScriptPackage AddScriptPackage "cmStandby" SetFactionRank NPCStand, 1 SetFactionRank NPCParty, 0 endifset partner to ( GetFactionRank Partners )set npctype to ( GetFactionRank NPCType )set inparty to ( GetFactionRank NPCParty )set standby to ( GetFactionRank NPCStand )set stay to ( GetFactionRank NPCStay )set follow to GetCurrentAiPackage == 1set npclevel to GetLevelset pclevel to Player.GetLevelset npcdisp to GetDisposition Playerset npcmagicka to ( GetBaseActorValue Magicka )set npcfatigue to ( GetBaseActorValue Fatigue )set npcspeed to ( GetBaseActorValue Speed )set npcathletics to ( GetBaseActorValue Athletics )set npcacrobatics to ( GetBaseActorValue Acrobatics ) set npcresponsibility to ( GetBaseActorValue Responsibility )set npcaggression to ( GetBaseActorValue Aggression ) set pchealth to ( Player.GetBaseActorValue Health )set refnpc to GetSelfset dead to GetDeadset hat to getequippedobject 1if npctype == 1 set npchealth to ( 0.85 * pchealth ) SetActorValue Health, npchealthelseif npctype == 2 set npchealth to ( 0.80 * pchealth ) SetActorValue Health, npchealthelseif npctype == 3 set npchealth to ( 0.75 * pchealth ) SetActorValue Health, npchealth endifif inparty == 1 && dead != 1 set control to 1endifif cmPartnersQuest.nRead == 1 set cmPartnersQuest.nRead to 0endifEndBegin OnStartCombatif hat != 0 set HatTimer to 60if getequipped hat == 0 equipitem hatendifendifEndBegin OnActivate ; Sets Quest variables when Dialogue is activated. This allows every Partner NPC to use the Quest dialogue as their own.Set cmPartnersQuest.nType to npctypeset cmPartnersQuest.nInParty to inpartyset cmPartnersQuest.npcRef to GetSelfif IsActionRef Player == 1 && Player.IsSneaking == 1 && partner >= 1 && disposition >= 50 && dead != 1 ; Activates the Quick Menu if the Player is sneaking, or works normal if the Player is not.. if partner == 1 && join == 0 MessageBox "Partner:" "Join me" "Stats" "Nevermind" set join to 1 elseif partner == 2 && inparty == 1 && menu == 0 MessageBox "Partner:" "Follow Me" "Stats" "Share" "Guard" "Standby" "Stay" "Nevermind" set menu to 1 elseif partner == 2 && inparty == 0 && menu == 0 MessageBox "Partner:" "Follow Me" "Stats" "Nevermind" set menu to 1 endifelseif IsActionRef Player == 1 && Player.IsSneaking == 1 && partner >= 1 && disposition < 50 && dead != 1 MessageBox "I'm sorry. I don't know you well enough."elseif IsActionRef Player == 1 && Player.IsSneaking == 0 Activateelse ActivateendifEndBegin GameMode ; Normal game scripting run in non-menu mode.; INITIAL SETUP - Sets all starting values for variables and adds topics and spells..if setupdoonce == 0 set partner to ( GetFactionRank Partners ) set npctype to ( GetFactionRank NPCType ) set inparty to ( GetFactionRank NPCParty ) set standby to ( GetFactionRank NPCStand ) set stay to ( GetFactionRank NPCStay ) set npclevel to GetLevel set pclevel to Player.GetLevel set pchealth to ( Player.GetBaseActorValue Health ) set npcdisp to GetDisposition Player set npcmagicka to ( GetBaseActorValue Magicka ) set npcfatigue to ( GetBaseActorValue Fatigue ) set npcspeed to ( GetBaseActorValue Speed ) set npcathletics to ( GetBaseActorValue Athletics ) set npcacrobatics to ( GetBaseActorValue Acrobatics ) set npcresponsibility to ( GetBaseActorValue Responsibility ) set npcaggression to ( GetBaseActorValue Aggression ) if npctype < 1 ; If NPCType is not set for NPC, then will set to 1, Combat. SetFactionRank NPCType, 1 endif AddTopic cmStats AddTopic cmJoinMe if npctype == 3 AddSpell "cmHealPlayer" AddSpell "cmRestoreHealth" else AddSpell "cmRestoreHealth10" endif set setupdoonce to -1endifif hat != 0if HatTimer > 0 && isincombat == 0set HatTimer to HatTimer - getsecondspassedelseif isincombat == 0 && getequipped hat == 1unequipitem hatendifendifif dead == 1 && isdead == 1 ; Terminates script after 10 minutes if NPC is dead. set timer to ( timer + GetSecondsPassed ) If timer > 600 set timepast to -1 set isdead to -1; MoveTo cmDeadMark1 SetQuestObject refnpc 0 SetFactionRank Partners, 0 SetFactionRank NPCParty, 0 SetFactionRank NPCStand, 0 SetFactionRank NPCStay, 0 RemoveScriptPackage endif elseif dead == 1 && isdead == -1 Returnendif; MENU MODE - Quick Menuif join == 1 && partner == 1 Set mjoin to GetButtonPressed if mjoin == 0 ; Join set mjoin to -1 set join to 0 ModFactionRank Partners, 1 SetFactionRank NPCParty, 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" Return elseif mjoin == 1 ; Stats set mjoin to -1 set join to 0 AddItem cmQkStatToken 1 Return elseif mjoin == 2 ; Nevermind set mjoin to -1 set join to 0 Return endifelseif menu == 1 && partner == 2 && inparty == 1 set mmenu to GetButtonPressed if mmenu == 0 ; Follow set mmenu to -1 set menu to 0 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 SetFactionRank NPCStay, 0 SetFactionRank NPCStand, 0 Return elseif mmenu == 1 ; Stats set mmenu to -1 set menu to 0 AddItem cmQkStatToken 1 Return elseif mmenu == 2 ; Share set mmenu to -1 set menu to 0 set inventory to 1 Return elseif mmenu == 3 ; Guard RemoveScriptPackage AddScriptPackage "cmStandGuard" SetFactionRank NPCParty, 0 set mmenu to -1 set menu to 0 Return elseif mmenu == 4 ; Standby set mmenu to -1 set menu to 0 RemoveScriptPackage AddScriptPackage "cmStandby" SetFactionRank NPCParty, 0 SetFactionRank NPCStand, 1 Return elseif mmenu == 5 ; Stay set mmenu to -1 set menu to 0 RemoveScriptPackage AddScriptPackage "cmWander" SetFactionRank NPCParty, 0 SetFactionRank NPCStay, 1 Return elseif mmenu == 6 ; Nevermind set mmenu to -1 set menu to 0 Return endifelseif menu == 1 && partner == 2 && inparty == 0 set mmenu to GetButtonPressed if mmenu == 0 ; Follow set mmenu to -1 set menu to 0 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 SetFactionRank NPCStay, 0 SetFactionRank NPCStand, 0 Return elseif mmenu == 1 ; Stats set mmenu to -1 set menu to 0 AddItem cmQkStatToken 1 Return elseif mmenu == 2 ; Nevermind set mmenu to -1 set menu to 0 Return endif endif; TELEPORT MODEif load >= 1 && inparty == 1 ; Modified fix from Cecelia for double face bug. if load == 3 Enable set load to 0 RemoveScriptPackage AddScriptPackage cmFollowPlayer elseif load == 2 Disable set load to 3 elseif load == 1 set map to 0 set load to 2 endif endifif teleport == 1 && command == 0 && cmPartnersQuest.nLockNPC == 0 ; Teleport script for Mark and Return set teleport to 2 RemoveScriptPackage SetFactionRank NPCParty, 0 PlaySound AMBThunder if pfacing < 90 ; northeasterly MoveTo cmPartnersMark1, -50, -50, 10 elseif pfacing < 180 ; southeasterly MoveTo cmPartnersMark1, -50, 50, 10 elseif pfacing < 270 ; southwesterly MoveTo cmPartnersMark1, 50, 50, 10 else ; northwesterly MoveTo cmPartnersMark1, 50, -50, 10 endif set teleport to 0 RemoveScriptPackage AddScriptPackage "cmStandby" SetFactionRank NPCStand, 1 SetFactionRank NPCParty, 0 elseif teleport == 1 && command == 0 && cmPartnersQuest.nLockNPC == 1 set teleport to 0 Message, "Mark and Return doesn't work here."endifif warp == 1 && cmPartnersQuest.nLockout == 0 ; Warp script for Summon and Recall set warp to 0 if pfacing < 90 ; northeasterly MoveTo Player, -50, -50, 10 elseif pfacing < 180 ; southeasterly MoveTo Player, -50, 50, 10 elseif pfacing < 270 ; southwesterly MoveTo Player, 50, 50, 10 else ; northwesterly MoveTo Player, 50, -50, 10 endifelseif warp == 1 && command == 0 && cmPartnersQuest.nLockout == 1 set warp to 0 Message, "Warp doesn't work here." endifif localwarp == 1 ; Local warp script for the Partners Ring and Movement Warp set localwarp to 0 if pfacing < 90 ; northeasterly MoveTo Player, -50, -50, 10 elseif pfacing < 180 ; southeasterly MoveTo Player, -50, 50, 10 elseif pfacing < 270 ; southwesterly MoveTo Player, 50, 50, 10 else ; northwesterly MoveTo Player, 50, -50, 10 endifendifset package to GetCurrentAiPackage ; Updates main variables.set follow to GetCurrentAiPackage == 1set partner to ( GetFactionRank Partners )set inparty to ( GetFactionRank NPCParty )set standby to ( GetFactionRank NPCStand )set stay to ( GetFactionRank NPCStay )set interior to IsInInteriorset disposition to GetDisposition Playerset dispdiff to ( npcdisp - disposition )set incombat to IsInCombatset pccombat to Player.IsInCombatset adversary to ( GetInFaction Adversaries )set bounty to GetCrimeGoldset dead to GetDeadif crime == 1 && dispdiff > 0 ; Resets disposition if Player commits a crime. ModDisposition Player, dispdiff set disposition to GetDisposition Player set crime to 0endifif npccrime == 1 || bounty > 0 SetCrimeGold 0 set npccrime to 0 set bounty to 0endifif control == 1 && inparty == 1 && incombat == 0 && dead != 1 set controltimer to ( controltimer + GetSecondsPassed ) if controltimer > 2 set control to 0 set controltimer to 0 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" endifendif; FOLLOW MODE - Sets all the follow variables to define how the NPC follows the Player.if follow == 1 && following == 0 set fspeed to ( Player.GetActorValue Speed * 1.5 ) set fathletics to ( Player.GetActorValue Athletics * 1.5 ) SetActorValue Speed, fspeed SetActorValue Athletics, fathletics SetIgnoreFriendlyHits 10 set following to 1 elseif follow != 1 && following == 1 SetActorValue Speed, npcspeed SetActorValue Athletics, npcathletics SetIgnoreFriendlyHits 5 set following to 0endifif follow == 1 && incombat == 0 set pcz to Player.GetPos z set npcz to GetPos z set pfacing to Player.GetAngle z elseif follow != 1 && incombat == 0 set npcz to GetPos zendifif follow == 1 && isridinghorse == 0 ; Scripting in this block commands the NPC to follow the Player in many different ways. (b3w4r3 Edited this line for horse support) if incombat == 0 if IsSwimming == 0 && (GetDistance Player > 1024) || (pcz > (npcz + 400)) || (pcz < (npcz - 400)) ; Warp script: get the angle player is facing, and move to player, but behind. set localwarp to 1 elseif IsSwimming == 1 && (GetDistance Player > 1600) || (pcz > (npcz + 800)) || (pcz < (npcz - 800)) ; Warp script: get the angle player is facing, and move to player, but behind. set localwarp to 1 endif endif if alert == 0 && Player.IsWeaponOut == 1 SetAlert 1 set alert to 1 elseif alert == 1 && Player.IsWeaponOut == 0 SetAlert 0 set alert to 0 endif if sneaking == 0 && Player.IsSneaking == 1 && incombat == 0 SetForceSneak 1 set sneaking to 1 SetActorValue Responsibility, 0 SetActorValue Aggression, 5 elseif sneaking == 1 && Player.IsSneaking == 0 || incombat == 1 SetForceSneak 0 set sneaking to 0 SetActorValue Responsibility, npcresponsibility SetActorValue Aggression, npcaggression endif if chameleon == 0 && Player.HasMagicEffect CHML == 1 AddSpell "cmChameleonA" set chameleon to 1 elseif chameleon == 1 && Player.HasMagicEffect CHML == 0 RemoveSpell "cmChameleonA" set chameleon to 0 endif if invisible == 0 && Player.HasMagicEffect INVI == 1 AddSpell "cmInvisibilityA" set invisible to 1 elseif invisible == 1 && Player.HasMagicEffect INVI == 0 RemoveSpell "cmInvisibilityA" set invisible to 0 endif if running == 0 && Player.IsRunning == 1 SetForceRun 1 set running to 1 elseif running == 1 && Player.IsRunning == 0 SetForceRun 0 set running to 0 endif if waterwalking == 0 && Player.HasMagicEffect WAWA == 1 AddSpell "cmWaterWalkingA" set waterwalking to 1 elseif waterwalking == 1 && Player.HasMagicEffect WAWA == 0 RemoveSpell "cmWaterWalkingA" set waterwalking to 0 endif if npctype == 3 && sparring == 0 && cmPartnersQuest.nHeal == 1 ; Cast Party Heal spell. AddSpell "cmHealParty" Cast cmHealParty Player RemoveSpell "cmHealParty" set cmPartnersQuest.nHeal to 0 endif if sitting == 0 && Player.GetSitting == 3 AddScriptPackage "cmSitScript" set sitting to 1 endif endifif sitting == 1 && Player.GetSitting == 0 ; Forces NPC to rejoin Player after sitting package is complete. RemoveScriptPackage AddScriptPackage "cmFollowPlayer" set sitting to 0endif; COMBAT MODE ; Controls combat between Partner NPCs, the Player, and other NPCs.if forcecombat == 2 && inparty == 1 && pccombat == 0 && cmPartnersQuest.nSpar == 0 set forcecombat to 0 SetFactionRank Adversaries -1 ModActorValue Aggression -30 set cmPartnersQuest.nForce to 0 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" elseif forcecombat == 1 && follow == 1 && pccombat == 1 && GetDistance Player <= 2000 && npcaggression >= 5 && cmPartnersQuest.nSpar == 0 set forcecombat to 2 SetFactionRank Adversaries 1 ModActorValue Aggression 30 set reftarget to GetCombatTarget StartCombat reftargetelseif forcecombat == 0 && follow == 1 && cmPartnersQuest.nForce == 1 && cmPartnersQuest.nSpar == 0 set forcecombat to 1elseif forcecombat == 0 && follow == 1 && IsInCombat == 1 && npcaggression >= 5 && cmPartnersQuest.nSpar == 0 && cmPartnersQuest.nForce == 0 set reftarget to GetCombatTarget SetIgnoreFriendlyHits 30; set loot to 1 ; If activated will cause Partners to automatically loot the area after combat. if reftarget == Player Yield set loot to 0 Return elseif reftarget.GetInFaction Partners > -1 Yield ModDisposition reftarget 100 set loot to 0 Return elseif reftarget.GetInFaction Minions > -1 || reftarget.GetInFaction Beasts > -1 Yield ModDisposition reftarget 100 set loot to 0 Return endifendifif loot == 1 && incombat == 0 ; Automatically starts looting after combat. if reftarget.GetDead == 1 set loot to 0 Message, "Looting" RemoveScriptPackage AddScriptPackage "cmLootWeapon" SetPackDuration 8 endifendifif sparring == 1 && forcecombat == 0 && inparty == 1 && cmPartnersQuest.nSpar == 0 set sparring to 0 set cmPartnersQuest.nHeal to 1 SetFactionRank Adversaries -1 ModActorValue Aggression -100 StopCombat RemoveScriptPackage AddScriptPackage "cmFollowPlayer"endifif sparring == 0 && forcecombat == 0 && inparty == 1 && cmPartnersQuest.nSpar == 1 set sparring to 1 SetFactionRank Adversaries 0 ModActorValue Aggression 100 StartCombat Playerendif; INVENTORY MODE - Inventory scripting which is a modified Toaster script, but uses MoveTo rather than the PlaceAtMe command. .if inventory == 1 && follow == 1 if regulator == 3 AddItem cmTorch02 1 EquipItem cmTorch02 RemoveItem cmTorch02 1 set regulator to 0 toggleActorsAI RemoveScriptPackage "cmInventory" AddScriptPackage "cmFollowPlayer" set inventory to 0 endif if regulator == 2 && MenuMode == 0 set regulator to 3 cmInvNPC.RemoveAllItems refnpc endif if regulator == 1 toggleActorsAI RemoveAllItems cmInvNPC cmInvNPC.Activate Player set regulator to 2 endif if regulator == 0 cmInvNPC.MoveTo Player 0 0 -50 set refbox to cmInvNPC refbox.setOwnership set regulator to 1 endifendif; PARTY COMMANDS - Reads Quest variable nParty and executes party commands for NPC.if command == 1 && cmPartnersQuest.nParty >= 1 set partytimer to ( partytimer + GetSecondsPassed ) If partytimer > 3 set cmPartnersQuest.nParty to 0 set command to 0 set partytimer to 0 endifelseif command == 1 && cmPartnersQuest.nParty == 0 set command to 0 set partytimer to 0endifif partner == 2 && command == 0 && cmPartnersQuest.nParty==1 && inparty == 1 ; Party Follow set command to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCStay, 0 SetFactionRank NPCStand, 0 SetFactionRank NPCParty, 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==2 && inparty == 1 ; Party Guard set command to 1 RemoveScriptPackage AddScriptPackage "cmStandGuard" SetFactionRank NPCParty, 0elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==3 && inparty == 1 ; Party Stay set command to 1 RemoveScriptPackage AddScriptPackage "cmWander" SetFactionRank NPCStay, 1 SetFactionRank NPCParty, 0elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==4 && inparty == 1 ; Party Eat RemoveScriptPackage AddScriptPackage "cmEatCommand" set command to 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==5 && inparty == 1 ; Party Drink RemoveScriptPackage AddScriptPackage "cmDrunkCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==6 && inparty == 1 ; Party Sleep RemoveScriptPackage AddScriptPackage "cmSleepCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==7 && inparty == 1 && npctype >= 2 ; Party Harvest RemoveScriptPackage AddScriptPackage "cmHarvestCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==8 && inparty == 1 ; Party Melee RemoveScriptPackage AddScriptPackage "cmMeleeCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==9 && inparty == 1 ; Party Magic RemoveScriptPackage AddScriptPackage "cmCastAnyCommand" set command to 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==10 && inparty == 1 ; Party Attack NPC RemoveScriptPackage AddScriptPackage "cmAttackNPCCommand" set command to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==11 && inparty == 1 ; Party Attack Creature RemoveScriptPackage AddScriptPackage "cmAttackMonsterCommand" set command to 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==12 && stay == 1 && dead != 1 ; Party Recall set command to 1 set warp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCStay, 0 SetFactionRank NPCParty, 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==13 && inparty == 1 && dead != 1 ; Partners Ring set command to 1 set localwarp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==14 && standby == 1 && dead != 1 ; Party Summon set command to 1 set warp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCStand, 0 SetFactionRank NPCParty, 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==15 && inparty == 1 ; Party Loot set command to 1 RemoveScriptPackage AddScriptPackage "cmLootArmor" SetPackDuration 15elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==17 && inparty == 1 && dead != 1 ; Party Return set command to 1 set teleport to 1elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==18 && inparty == 1 ; Party Standby set command to 1 RemoveScriptPackage AddScriptPackage "cmStandby" SetFactionRank NPCStand, 1 SetFactionRank NPCParty, 0endif; ITEMS - Items used by the party.if torch == 0 && IsActorUsingATorch == 0 && cmPartnersQuest.nTorch == 1 && IsSneaking == 0 AddItem cmTorch02 1 EquipItem cmTorch02 set torch to 1elseif torch == 1 && cmPartnersQuest.nTorch == 0 RemoveItem cmTorch02 1 set torch to 0elseif torch == 1 && IsSneaking == 1 RemoveItem cmTorch02 1 set torch to 0 endifif hoodset == 0 && cmPartnersQuest.nHood >= 1 ; HOODS - Adds hood to Stealth characters and a lighter hood of the same color to Magic characters outside at night or during the day when it's raining. Hoods are removed during the day when it's not raining or when you go inside. set hoodset to 1 if npctype == 2 && cmPartnersQuest.nHood == 1 ; Black Hood set hoodref to BlackHood elseif npctype == 3 && cmPartnersQuest.nHood == 1 ; Blue Hood set hoodref to ArchMageHood elseif npctype == 2 && cmPartnersQuest.nHood == 2 ; Green Hood set hoodref to LowerRobe04hood elseif npctype == 3 && cmPartnersQuest.nHood == 2 ; Aqua Silk Hood set hoodref to UpperRobe03hood elseif npctype == 2 && cmPartnersQuest.nHood == 3 ; Dark Gray Hood set hoodref to LowerRobe02hood elseif npctype == 3 && cmPartnersQuest.nHood == 3 ; Gray Hood set hoodref to LowerRobe05hood elseif npctype == 2 && cmPartnersQuest.nHood == 4 ; Red Hood set hoodref to MythicDawnRobeHood elseif npctype == 3 && cmPartnersQuest.nHood == 4 ; Red Silk Hood set hoodref to UpperRobe02hood endifelseif hoodset == 1 && cmPartnersQuest.nHood == 0 set hoodset to 0endif if hoodset == 1 && hood == 1 && interior == 1 set count to GetItemCount hoodref if count > 0 UnEquipItem hoodref RemoveItem hoodref 1 set hood to 0 endifelseif hoodset == 1 && hood == 1 && interior == 0 && Gamehour > 8 && GameHour < 19 && IsRaining == 0 set count to GetItemCount hoodref if count > 0 UnEquipItem hoodref RemoveItem hoodref 1 set hood to 0 endifelseif hoodset == 1 && hood == 0 && interior == 0 && ( GameHour > 19 || GameHour < 8 || IsRaining > 0.5 ) AddItem hoodref 1 EquipItem hoodref set hood to 1 elseif hoodset == 0 && hood == 1 UnEquipItem hoodref RemoveItem hoodref 1 set hood to 0endifif cmPartnersQuest.nShield == 1 && shield == 0 ; SHIELD & CUIRASS - Adds or removes a Kvatch Shield.& Cuirass if GetItemCount TownguardKvShield == 0 AddItem TownguardKvShield 1 EquipItem TownguardKvShield endif if GetItemCount TownguardCuirassKv == 0 AddItem TownguardCuirassKv 1 EquipItem TownguardCuirassKv endif set shield to 1elseif cmPartnersQuest.nShield == 2 && shield == 1 if GetItemCount TownguardKvShield >= 1 UnequipItem TownguardKvShield RemoveItem TownguardKvShield 1 endif if GetItemCount TownguardCuirassKv >= 1 UnequipItem TownguardCuirassKv RemoveItem TownguardCuirassKv 1 endif set shield to 0 AddItem cmTorch02 1 EquipItem cmTorch02 RemoveItem cmTorch02 1 endif; LEVELUPif cmPartnersQuest.nLevel == 0 && levelup == 1 set levelup to 0elseif cmPartnersQuest.nLevel == 0 && levelup == 0 && ( GetBaseActorValue Health < npchealth ) SetActorValue Health, npchealthelseif cmPartnersQuest.nLevel == 1 && levelup == 0 set npclevel to GetLevel set pclevel to Player.GetLevel set pchealth to ( Player.GetBaseActorValue Health ) set npcmagicka to ( GetBaseActorValue Magicka ) set npcfatigue to ( GetBaseActorValue Fatigue ) set npcspeed to ( GetBaseActorValue Speed ) set npcathletics to ( GetBaseActorValue Athletics ) set npcacrobatics to ( GetBaseActorValue Acrobatics ) set levelup to 1 if npctype == 1 set npchealth to ( 0.85 * pchealth ) SetActorValue Health, npchealth elseif npctype == 2 set npchealth to ( 0.80 * pchealth ) SetActorValue Health, npchealth elseif npctype == 3 set npchealth to ( 0.75 * pchealth ) SetActorValue Health, npchealth endif endifEnd; AI PACKAGE CONTROLSBegin OnPackageStart "cmInventory" if partner == 2 && IsInCombat != 1 set inventory to 1 endifEnd Begin OnPackageStart "cmFollowPlayer" SetFactionRank NPCParty, 1 SetFactionRank NPCStand, 0 SetFactionRank NPCStay, 0EndBegin OnPackageStart "cmStandGuard" SetFactionRank NPCParty, 0 EndBegin OnPackageStart "cmStandby" SetFactionRank NPCStand, 1 SetFactionRank NPCParty, 0 EndBegin OnPackageStart "cmWander" SetFactionRank NPCStay, 1 SetFactionRank NPCParty, 0 End Begin OnPackageStart "cmPickLockContainer" SetPackDuration 20EndBegin OnPackageDone "cmPickLockContainer" ; Commands NPC to rejoin Player after commands are executed. RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 EndBegin OnPackageDone "cmHarvestCommand" set warp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 EndBegin OnPackageStart "cmEatCommand" SetPackDuration 40 EndBegin OnPackageStart "cmDrinkCommand" SetPackDuration 40 EndBegin OnPackageStart "cmDrunkCommand" SetPackDuration 40EndBegin OnPackageDone "cmLootArmor" ; Daisy-chaining Loot AI Packages so that Partner NPC's will loot various items automatically after combat or on command, and then return to the Player when done. RemoveScriptPackage AddScriptPackage "cmLootWeapon" SetPackDuration 10EndBegin OnPackageDone "cmLootWeapon" RemoveScriptPackage AddScriptPackage "cmLootAmmo" SetPackDuration 5EndBegin OnPackageDone "cmLootAmmo" RemoveScriptPackage AddScriptPackage "cmLootIngred" SetPackDuration 5EndBegin OnPackageDone "cmLootIngred" RemoveScriptPackage AddScriptPackage "cmLootGold" SetPackDuration 5EndBegin OnPackageDone "cmLootGold" set warp to 1 RemoveScriptPackage AddScriptPackage "cmFollowPlayer" SetFactionRank NPCParty, 1 EndBegin OnAlarm 0, Player set crime to 1EndBegin OnAlarm 1, Player set crime to 1EndBegin OnAlarm 2, Player set crime to 1EndBegin OnAlarm 3, Player set crime to 1EndBegin OnAlarm 4, Player set crime to 1EndBegin OnAlarm 0 set npccrime to 1EndBegin OnAlarm 1 set npccrime to 1EndBegin OnAlarm 2 set npccrime to 1EndBegin OnAlarm 3 set npccrime to 1EndBegin OnAlarm 4 set npccrime to 1End
short activeref gearif active == 8 set gear to GetEquippedObject 0 if gear != 0 unequipitem gear equipitem gear endif set gear to GetEquippedObject 1 if gear != 0 unequipitem gear equipitem gear endif set gear to GetEquippedObject 2 if gear != 0 unequipitem gear equipitem gear endif set gear to me.GetEquippedObject 3 if gear != 0 me.unequipitem gear me.equipitem gear endif set gear to GetEquippedObject 4 if gear != 0 unequipitem gear equipitem gear endif set gear to GetEquippedObject 5 if gear != 0 unequipitem gear equipitem gear endif set gear to GetEquippedObject 6 if gear != 0 unequipitem gear equipitem gear endif set gear to GetEquippedObject 7 if gear != 0 unequipitem gear equipitem gear endif set gear to GetEquippedObject 8 if gear != 0 unequipitem gear equipitem gear endif set gear to GetEquippedObject 13 if gear != 0 unequipitem gear equipitem gear endif set gear to me.GetEquippedObject 15 if gear != 0 me.unequipitem gear me.equipitem gear endif set gear to GetEquippedObject 18 if gear != 0 unequipitem gear equipitem gear endif set gear to GetEquippedObject 19 if gear != 0 unequipitem gear equipitem gear endif set gear to GetEquippedObject 20 if gear != 0 unequipitem gear equipitem gear endif set gear to GetEquippedObject 17 if gear != 0 unequipitem gear equipitem gear endif set gear to GetEquippedObject 16 if gear != 0 unequipitem gear equipitem gear endif additem daedricboots 1 equipitem daedricboots removeitem daedricboots 1 set active to 0endif