[RELz] Companion Master

Post » Sat Feb 19, 2011 7:01 am

Is present an option for teach magic spells to companions ?
(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)
User avatar
Marine x
 
Posts: 3327
Joined: Thu Mar 29, 2007 4:54 am

Post » Fri Feb 18, 2011 11:33 pm

Is present an option for teach magic spells to companions ?
(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)

Nope, but I can probably add something that lets you view the companions current spells, and teach them spells you already know.
User avatar
Nicole Elocin
 
Posts: 3390
Joined: Sun Apr 15, 2007 9:12 am

Post » Sat Feb 19, 2011 12:16 am

Ok, so I'm playing with being able to view each companions spells, and even select spells to remove from them. Don't know how useful it will be but seems to have some value.

Also working on teaching them spells the player knows. I'm guessing you just want to be able to teach them spells from the "Spells" section of the players spell list, and not powers and abilities? Can't say for sure if NPCs can even use powers, or if the same once a day will be applied to them if they can.
User avatar
An Lor
 
Posts: 3439
Joined: Sun Feb 18, 2007 8:46 pm

Post » Fri Feb 18, 2011 10:12 pm

Don't know how useful it will be but seems to have some value.


Will be very useful. I have also been using a Teach Spells mod and while it works well it has no way of keeping track of what spells each companion has already (I have been keeping track in a notebook).

I have never needed it to do Powers, only Spells. Powers would be unbalancing I think, as these are the kind of things that shouldn't just be learned.

On a slightly different note (my latest attempt to derail the thread, lol!) is there a mod around that will further randomise a companion's spell selection in combat? I find that no matter the varied selection of spells I teach my companions, each companion tends to use just one or two of their highest-power spells. And conjurors in particular will use their most powerful summon spell only. Its a bit odd seeing Saerileth summon a Skeleton Lord to fight a mudcrab!
User avatar
The Time Car
 
Posts: 3435
Joined: Sat Oct 27, 2007 7:13 pm

Post » Sat Feb 19, 2011 7:26 am

Don't know of any mods that try to alter the NPC default spell selection sorry. It's much like them selecting which gear to wear it seems. They pick the highest lvl spell they can cast. They do tend to be smart about using destruction spells on targets with resistances.

More options I'm working on is the ability to view each companions stats. I'm also planning to allow the player to train their companion, something like the way the player can be trained by trainers in the game. The basic idea is if your lvl is higher than your companions in a certain skill, then you can train that skill on them +10, but not higher than your current lvl. To keep some kind of balance I think I will limit it to once a week for each companion.
User avatar
Captian Caveman
 
Posts: 3410
Joined: Thu Sep 20, 2007 5:36 am

Post » Sat Feb 19, 2011 12:22 am

You're really making this into something big. Really, with this all we will need is the simplest companion and will be able to get them to do just about anything.
User avatar
Brittany Abner
 
Posts: 3401
Joined: Wed Oct 24, 2007 10:48 pm

Post » Sat Feb 19, 2011 7:42 am

Hi b4w4r3,

I added the code for no helmets out of combat to the Companion Horse Support FIX esp file, specifically to the script 11000ED6 (which is in CMPartners.esm but the horse support fix esp overrides it according to TES4Edit). I added it all fine but it doesn't work, and it doesn't generate an error either. I am including the full edited script below, hoping you can spot my mistake:

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


As you can see I added the hat ref to the bottom of the refs list and the gamemode code to the existing gamemode code (same for the menumode code), is this correct?

Thank you for the help once again!
User avatar
STEVI INQUE
 
Posts: 3441
Joined: Thu Nov 02, 2006 8:19 pm

Post » Sat Feb 19, 2011 1:52 am

You know looking at this now I made a mistake by putting "set hat to getequippedobject 1" in menumode. I tried it myself in the onload block, and that should work. When the NPC loads they will equip their helmet, and it will get set to hat, then the combat bit in the gamemode should take care of the rest. After you add the code use fast travel or move into a new cell so the onload block runs. After that if you still have problems let me know. Are you using a vanilla helmet btw? If the helmet you are using uses a slot other than hair, and hair only this will need to be adjusted.
User avatar
clelia vega
 
Posts: 3433
Joined: Wed Mar 21, 2007 6:04 pm

Post » Sat Feb 19, 2011 1:35 pm

Hi B3w4r3,

Thanks for the update, I will add it to the On Load block instead. As far as I know the helmet uses whatever default helmet slot most helmets use (head? hair?). Yes I do have other non-helmet headgear such as the KD Circlets (as part of FCOM) and miscellaneous other mod-added headgears. I would think the circlets use the hair slot, so this code would not affect them, right? I would not want it to, because a circlet ought to stay on outside of combat. As for the other items I'll just take my chances with whatever slot they are fitted in.

Tell me, how would I add some kind of timer, to make the NPC wait, say 1 minute, before removing the helmet? Just to make sure there are no other enemies lurking around :shifty:

Thanks!
User avatar
Donald Richards
 
Posts: 3378
Joined: Sat Jun 30, 2007 3:59 am

Post » Fri Feb 18, 2011 10:34 pm

This should accomplish what you are looking for. Put the float HatTimer up with the rest of the variables. I added the OnStartCombat block to reset the timer incase you are in the minute cool down and come across another foe. It can be placed between the MenuMode and GameMode blocks.The code below that should replace what you used in the gamemode block. Hat in this example uses the hair slot, which most helmets use. If you can still see your hair when using the circlets then it probably uses a different slot like tail or amulet, so it would remain equipped.
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


These are the changes that will be included in my next update. I may get it uploaded today as everything seems to be working well.

New in Version3:

Teach Spell - You can now teach your companions spells from your spell list providing they have the correct skill level to cast it. Only spells that meet the skill requirements will be displayed in a menu box format.

View/Remove companion spells - You can view a list of your companions spells, and remove them by clicking the desired spell to be removed.

Train Companions Skills - You can train your companion's skills +10 (to a maximun of your current skill level) as long as you have a higher level in that skill. Currently you can train one skill on one companion every two days.

Fix Double Face Bug - The companion Master spell has an option to correct the double face issue some users experience with companions. After using this fix you will need to re-issue commands as typically scriptpackages will be removed. Initially the companion will be disabled. After about 5 seconds a message box will remind you to reset follow orders on your companion, they will be enabled.

View Companions Stats - Lets you view your companions stats.

Fixes:

Changed the way items in the inventory are displayed when using the Select Companion Armor and Weapons option. Now only Weapons, Armor, Clothing, and Ammo will be displayed.

Changed the order of most commands in the menus to make selections easier to find.

Removed the Add Companion to the Companion List from the inventory item menus as it didn't seem necessary. If you need to change a slot an actor currently uses then use the spell on them.

Edit: I got the new version3 uploaded to TesNexus. I also uploaded two optional files one that changes the Daedric helm to only use the hair slot, and the other removes the You can not equip this item messages from the game. Both of these files are not necessary but can improve the experience I think. They can both be merged into pretty much any mod you use to cut down on the number of loaded plugins.
User avatar
Baylea Isaacs
 
Posts: 3436
Joined: Mon Dec 25, 2006 11:58 am

Post » Sat Feb 19, 2011 4:13 am

The extras you are putting in are awesome! They eliminate a couple more ESPs as well, thanks so much :)

I have tried your code again but still nothing seems to happen. Here is the script again below. I walked into an interior and back out again, even though I wasn't in combat, the script should have realised that and unequipped my companions' helmets. Or am I wrong?

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

User avatar
Sandeep Khatkar
 
Posts: 3364
Joined: Wed Jul 18, 2007 11:02 am

Post » Sat Feb 19, 2011 2:56 am

There's a typo in there, I'm the king of typos. The second if in the gamemode section I typed it. Just fix that and it should work unless the hat your companion is using doesn't use the hair slot. If you have the new version of Companion Master, once you fix the code, use the spell on your companion and select fix double face bug. That will disable them, then 5 seconds later enable them, and that should force the onload code to run.
User avatar
Judy Lynch
 
Posts: 3504
Joined: Fri Oct 20, 2006 8:31 am

Post » Sat Feb 19, 2011 8:47 am

Ah thanks I found it. Will change it and retry with the new Companion Master.

Bit confused now though, do vanilla helmets all use the hair slot, or the head slot, or both?
User avatar
Ells
 
Posts: 3430
Joined: Thu Aug 10, 2006 9:03 pm

Post » Sat Feb 19, 2011 10:50 am

All of the vanilla helms use the hair slot other than the Daedric, Dwarven, and the Masque of Clavicus Vile which use hair and head.
User avatar
Catharine Krupinski
 
Posts: 3377
Joined: Sun Aug 12, 2007 3:39 pm

Post » Sat Feb 19, 2011 6:27 am

All of the vanilla helms use the hair slot other than the Daedric, Dwarven, and the Masque of Clavicus Vile which use hair and head.

What is the benefit of using only the hair slot? I'm thinking possibly so we don't lose stuff like horns, etc that are added via the face slot. Or is it another purpose?
User avatar
Chris Ellis
 
Posts: 3447
Joined: Thu Jul 26, 2007 10:00 am

Post » Sat Feb 19, 2011 1:24 am

What is the benefit of using only the hair slot? I'm thinking possibly so we don't lose stuff like horns, etc that are added via the face slot. Or is it another purpose?


Well when an object uses a slot it hides that slot on the actor mesh so you don't get stuff clipping through. You will notice that no helm lets you see your hair because that hair is replaced with the helm. If you can't see any part of the face with the helm on, like with the daedric helm, then it will use the head and hair slots so that people with big heads don't have that head clipping through. That's vanilla though, what modders use is entirely up to them.
User avatar
Jodie Bardgett
 
Posts: 3491
Joined: Sat Jul 29, 2006 9:38 pm

Post » Sat Feb 19, 2011 9:43 am

I understand. But your additional esp changes daedric to use only the hair slot? Won't that make big heads and beast races look funny?
User avatar
Lindsay Dunn
 
Posts: 3247
Joined: Sun Sep 10, 2006 9:34 am

Post » Sat Feb 19, 2011 3:49 am

I understand. But your additional esp changes daedric to use only the hair slot? Won't that make big heads and beast races look funny?


If you notice any clipping just don't use that esp. The OBSE guys never made support for helms that use both head and hair slots. I mentioned it in their thread so who knows. The Dwarven helm uses those slots too and I didn't include it because I just found it. Anyway maybe the OBSE guys will make the new slot or have an idea I can use.
User avatar
Daniel Brown
 
Posts: 3463
Joined: Fri May 04, 2007 11:21 am

Post » Fri Feb 18, 2011 9:45 pm

Oh, OK! I'm a little slow today. Thanks for explaining it. :)
User avatar
Amanda savory
 
Posts: 3332
Joined: Mon Nov 27, 2006 10:37 am

Post » Fri Feb 18, 2011 9:15 pm

Hi b3w4r3,

I fixed the spelling error on the script (it->if) but still no joy on unequipping helms. The fix double face bug spell causes my game to crash, so I walked into and out of a building to test it that way instead, but no luck. However one of my companions has now taken to appearing naked on some transitions!

Also a question re forcing companions to equip items: will the items stay equipped (or locked, should I use the lock gear option?) if I remove the companion from my companions list? I would really like to be able to lock their items then remove them from the list since I have more companions than slots on your list. I did some fiddling around with equipping items and it seemed that my game crashed more, although I'm not sure that was the cause of it.

Thanks :)
User avatar
Ashley Hill
 
Posts: 3516
Joined: Tue Jul 04, 2006 5:27 am

Post » Fri Feb 18, 2011 11:43 pm

Hi b3w4r3,

I fixed the spelling error on the script (it->if) but still no joy on unequipping helms. The fix double face bug spell causes my game to crash, so I walked into and out of a building to test it that way instead, but no luck. However one of my companions has now taken to appearing naked on some transitions!


That's strange, I added the same code to one of my companions and it works perfectly. I'll try one of the CM later and see if there are problems. The double face fix only disables the companion, then enables them. Don't see why that would cause any crash. If you use the console to disable/enable your companion does it still crash? Not sure what to say about your exhibitionist companion.

Also a question re forcing companions to equip items: will the items stay equipped (or locked, should I use the lock gear option?) if I remove the companion from my companions list? I would really like to be able to lock their items then remove them from the list since I have more companions than slots on your list. I did some fiddling around with equipping items and it seemed that my game crashed more, although I'm not sure that was the cause of it.

Thanks :)



If you only select their gear they will change next time they are loaded if they like something better. Using the Lock will prevent them from changing as long as something in their script doesn't call remove item on one of the locked items.

You can lock their gear then remove them and it will stay locked. However when an NPC has items locked using the no un-equip flag, like I have used, calling removeallitems, which is typically called when you share items with your companion, will cause a crash. That's why I suggest unlocking locked items before using the share feature that came with your companion, or using the share feature in this mod, as it removes the locked flag before calling removeallitems.

Edit: I checked the helm code by adding it to the PartnerScript in CM and it works fine. Using the Fix Double face bug did crash with the CM though. I remember someone saying that when they disable a CM their game crashes. Shouldn't be an issue as CMs have code in their script to prevent the bug, but I'm going to see what causes it.

Some things that could cause the helm thing not to work for you. Make sure the companion you are using actually uses the PartnerScript, and not one of the other ones. He included a few different scripts, but all the followers in the basic mod use that one script. Make sure any plugins loaded after the horsefix that you edited with the hat code, do not make changes to CM Partnerscript.
User avatar
Greg Cavaliere
 
Posts: 3514
Joined: Thu Nov 01, 2007 6:31 am

Post » Sat Feb 19, 2011 10:53 am

That's strange, I added the same code to one of my companions and it works perfectly. I'll try one of the CM later and see if there are problems. The double face fix only disables the companion, then enables them. Don't see why that would cause any crash. If you use the console to disable/enable your companion does it still crash? Not sure what to say about your exhibitionist companion.


Yep, it still crashes if I use the console to disable. Here is the code as I have added it to your CompanionHorseSupportFix esp. Its script 01000ED6 and it overwrites same code in CMPartners.esm:

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


Edit: I checked the helm code by adding it to the PartnerScript in CM and it works fine. Using the Fix Double face bug did crash with the CM though. I remember someone saying that when they disable a CM their game crashes. Shouldn't be an issue as CMs have code in their script to prevent the bug, but I'm going to see what causes it.

Some things that could cause the helm thing not to work for you. Make sure the companion you are using actually uses the PartnerScript, and not one of the other ones. He included a few different scripts, but all the followers in the basic mod use that one script. Make sure any plugins loaded after the horsefix that you edited with the hat code, do not make changes to CM Partnerscript.


The above code's EditorID is PartnerScript so I think its correct, and I have checked and only CMPartners.esm and the horse fix edit the script (according to a full-loadout run of TES4Edit).

You can lock their gear then remove them and it will stay locked. However when an NPC has items locked using the no un-equip flag, like I have used, calling removeallitems, which is typically called when you share items with your companion, will cause a crash. That's why I suggest unlocking locked items before using the share feature that came with your companion, or using the share feature in this mod, as it removes the locked flag before calling removeallitems.


Not sure exactly what you are saying. If I use the Share option that came with the companion, on a companion with locked items, will it cause a crash? That may have been the cause for me but I will have to play around a bit more.

Thanks again for all the help :)
User avatar
Steph
 
Posts: 3469
Joined: Sun Nov 19, 2006 7:44 am

Post » Sat Feb 19, 2011 11:27 am

The code in the Partnerscript looks ok. If it doesn't work then the helmet the companion is using does not use the typical hair only slot, or that script is not attached to him.

Disable on CMs do crash the game, probably because the script keeps setting things on the reference even if it's disabled. Not really an issue though as CMs should never get the double face bug.

On the share you have it right. Using your companions share feature will cause crashes if you have locked items. Using the share feature from this mod will not because I remove every item one by one, then re-equip them without setting the flag to 1, before moving them all to the share container. The same bit of code could be added to the share in your companions script to prevent crashing, but you need to make sure which script your companion is using since the code you added to the partnerscript seems not to work.

Here is an example of the code that removes the force equip flags. This would need modifying to work in your companions script as this is just pulled from my mod, but you can see what I'm doing before I share. Items equipped using "Equipitem SomeItem 1" Can only be removed by calling "removeitem SomeItem". If you instead call removeallitems the game crashes if any of the items to be removed were equipped using the "1" after. Hope that makes sense.
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

User avatar
Gwen
 
Posts: 3367
Joined: Sun Apr 01, 2007 3:34 am

Post » Sat Feb 19, 2011 7:11 am

Very cool idea - thanks for doing this :)
User avatar
Eve Booker
 
Posts: 3300
Joined: Thu Jul 20, 2006 7:53 pm

Post » Sat Feb 19, 2011 12:07 pm

found a bug your unable to access th e "more companion options" and other such th ings for a companion unless the companion is standing up. if they are lying or sitting down it does not work
User avatar
Kellymarie Heppell
 
Posts: 3456
Joined: Mon Jul 24, 2006 4:37 am

PreviousNext

Return to IV - Oblivion