Difference between revisions of "User:Sickleyield"
Jump to navigation
Jump to search
no edit summary
imported>Sickleyield |
imported>Sickleyield |
||
Line 1: | Line 1: | ||
This is the CM Partners PartnerMagic script. Their readme gives permission for any and all uses of it, but if anyone from the Cutthroat Mods team should wish me to take it down please contact me and I'll do so at once. | |||
I'd like to adapt this as a creature follow script while keeping some of the great "levelup with PC" and "attack that NPC over there" sorts of options. When I apply it directly to my spider companion critter, however, the critter remains unactivatable by the player. I tried deleting some of the nonapplicable parts, like the things about torch equippage, but it made no difference. | |||
If we could turn this into a functional critter companion script, I'm sure you can all see far more interesting uses for it than just my Arachnalia mod. ;) Any creature companion could be quickly and easily integrated with the CM Partners mod. Imagine the possibilities. | |||
Scriptname PartnerMagic | |||
short package | |||
short follow | |||
short following | |||
short partner | |||
short command | |||
short inparty | |||
short interior | |||
short doonce | |||
short start | |||
short currentday | |||
short dayspast | |||
short daysdone | |||
float timer | |||
short timepast | |||
short state | |||
short fspeed | |||
short fathletics | |||
short weaponUse | |||
short incombat | |||
short isdead | |||
short alert | |||
ref target | |||
short pcz | |||
short npcz | |||
short running | |||
short sitting | |||
short torch | |||
short sneaking | |||
short Chameleon | |||
short invisible | |||
short WaterWalking | |||
short npcspeed | |||
short npcathletics | |||
short npcstrength | |||
short npcwillpower | |||
short npcintelligence | |||
short npcagility | |||
short npcendurance | |||
short npcpersonality | |||
short npcluck | |||
short npchealth | |||
short npcmagicka | |||
short npcfatigue | |||
short npcblade | |||
short npcblunt | |||
short npchandtohand | |||
short npcmarksman | |||
short npcheavyarmor | |||
short npclightarmor | |||
short npcblock | |||
short npcsneak | |||
short npcacrobatics | |||
short npcsecurity | |||
short npcmysticism | |||
short npcconjuration | |||
short npcillusion | |||
short npcalteration | |||
short npcdestruction | |||
short npcrestoration | |||
short setupdoonce | |||
short npctype | |||
short nlevel | |||
short npclevel | |||
short pclevel | |||
short leveldiff ; Defined as ( pclevel - npclevel ) | |||
short levelup | |||
short levelreport | |||
short npcweapon | |||
short pcweapon | |||
short npcarmor | |||
short pcarmor | |||
short train | |||
short trainday | |||
short trainhour | |||
short traindayspast | |||
short traindone | |||
short inventory | |||
short regulator | |||
ref refnpc | |||
ref refbox | |||
Begin OnLoad | |||
Set partner to GetFactionRank Partners | |||
Set npclevel to GetLevel | |||
Set pclevel to Player.GetLevel | |||
End | |||
Begin OnDeath ; | |||
if GetActorValue Health <= 0 && isdead == 0 | |||
Set isdead to 1 | |||
Set timepast to 1 | |||
if inparty == 1 | |||
Message, "Your partner is dead." | |||
endif | |||
endif | |||
End | |||
Begin 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 npctype | |||
Set cmPartnersQuest.nLevelup to levelreport | |||
Set cmPartnersQuest.nInParty to inparty | |||
Set cmPartnersQuest.nLeveldiff to leveldiff | |||
if Player.IsSneaking == 1 && partner == 2 ; Only activates Dialogue if Player is not sneaking. | |||
Return | |||
else | |||
Activate | |||
endif | |||
End | |||
Begin 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 | |||
; NPC type denotes the NPC's specialized class, is used for levelup, and has the following values: | |||
; 1 -> Combat specialized class | |||
; 2 -> Stealth specialized class | |||
; 3 -> Magic specialized class | |||
Set npctype to 3 | |||
Set partner to GetFactionRank Partners | |||
Set npclevel to GetLevel | |||
Set pclevel to Player.GetLevel | |||
Set leveldiff to ( pclevel - npclevel ) | |||
Set npchealth to ( GetBaseActorValue Health ) | |||
Set npcmagicka to ( GetBaseActorValue Magicka ) | |||
Set npcfatigue to ( GetBaseActorValue Fatigue ) | |||
Set npcstrength to ( GetBaseActorValue Strength ) | |||
Set npcintelligence to ( GetBaseActorValue Intelligence ) | |||
Set npcwillpower to ( GetBaseActorValue Willpower ) | |||
Set npcagility to ( GetBaseActorValue Agility ) | |||
Set npcendurance to ( GetBaseActorValue Endurance ) | |||
Set npcpersonality to ( GetBaseActorValue Personality ) | |||
Set npcluck to ( GetBaseActorValue Luck ) | |||
Set npcspeed to ( GetBaseActorValue Speed ) | |||
Set npcathletics to ( GetBaseActorValue Athletics ) | |||
Set npcblade to ( GetBaseActorValue Blade ) | |||
Set npcmarksman to ( GetBaseActorValue Marksman ) | |||
Set npcblunt to ( GetBaseActorValue Blunt ) | |||
Set npchandtohand to ( GetBaseActorValue HandtoHand ) | |||
Set npclightarmor to ( GetBaseActorValue LightArmor ) | |||
Set npcheavyarmor to ( GetBaseActorValue HeavyArmor ) | |||
Set npcacrobatics to ( GetBaseActorValue Acrobatics ) | |||
Set npcsneak to ( GetBaseActorValue Sneak ) | |||
Set npcsecurity to ( GetBaseActorValue Security ) | |||
Set npcblock to ( GetBaseActorValue Block ) | |||
Set npcmysticism to ( GetBaseActorValue Mysticism ) | |||
Set npcconjuration to ( GetBaseActorValue Conjuration ) | |||
Set npcillusion to ( GetBaseActorValue Illusion) | |||
Set npcalteration to ( GetBaseActorValue Alteration ) | |||
Set npcdestruction to ( GetBaseActorValue Destruction ) | |||
Set npcrestoration to ( GetBaseActorValue Restoration ) | |||
AddSpell "cmWaterBreathingA" | |||
SetActorValue Acrobatics, 100 | |||
AddTopic cmxAbilities | |||
AddTopic cmJoinMe | |||
if npctype == 3 | |||
AddSpell "cmHealPlayer" | |||
AddSpell "cmRestoreHealth" | |||
endif | |||
Set setupdoonce to 1 | |||
endif | |||
if timepast == 1 ; Removes the body after 90 seconds if the Partner NPC dies. | |||
Set timer to ( timer + GetSecondsPassed ) | |||
If timer > 90 | |||
Set timepast to 2 | |||
Set isdead to 2 | |||
Disable | |||
endif | |||
endif | |||
if isdead == 2 ; Terminates script if Partner NPC dies. | |||
Return | |||
endif | |||
Set package to GetCurrentAIPackage ; Sets main variables to use as conditions for the rest of the scripting | |||
Set follow to GetCurrentAIPackage == 1 | |||
Set partner to GetFactionRank "Partners" | |||
if inparty == 1 && package == 13 | |||
Set inparty to 0 | |||
elseif inparty == 0 && follow == 1 | |||
Set inparty to 1 | |||
endif | |||
; FOLLOW MODE - Sets all the follow variables to define how the NPC follows the Player. | |||
if follow == 1 && following == 0 | |||
Set inparty to 1 | |||
Set fspeed to ( Player.GetActorValue Speed * 2.25 ) | |||
Set fathletics to ( Player.GetActorValue Athletics * 2.25 ) | |||
SetActorValue Speed, fspeed | |||
SetActorValue Athletics, fathletics | |||
SetIgnoreFriendlyHits 7 | |||
Set following to 1 | |||
elseif follow != 1 && following == 1 | |||
SetActorValue Speed, npcspeed | |||
SetActorValue Athletics, npcathletics | |||
SetIgnoreFriendlyHits 3 | |||
Set following to 0 | |||
endif | |||
if follow == 1 && incombat == 0 | |||
Set pcz to Player.GetPos z | |||
Set npcz to GetPos z | |||
elseif follow != 1 && incombat == 0 | |||
Set npcz to GetPos z | |||
endif | |||
if follow == 1 ; Scripting in this block commands the NPC to follow the Player in many different ways. | |||
if pcz > ( npcz + 400 ) | |||
MoveTo Player | |||
elseif pcz < ( npcz - 400 ) | |||
MoveTo Player | |||
endif | |||
if GetDistance Player > 1024 && incombat == 0 | |||
MoveTo Player | |||
endif | |||
if IsInCombat == 1 | |||
Set incombat to 1 | |||
else | |||
Set incombat to 0 | |||
endif | |||
if incombat == 1 ; Prevents combat between Partner NPC's.. | |||
Set target to GetCombatTarget | |||
if target == Player | |||
Yield | |||
Return | |||
elseif target.GetInFaction Partners | |||
Yield | |||
Return | |||
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 | |||
SetForceSneak 1 | |||
Set sneaking to 1 | |||
elseif sneaking == 1 && Player.IsSneaking == 0 | |||
SetForceSneak 0 | |||
Set sneaking to 0 | |||
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 && 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 | |||
endif | |||
if sitting == 1 && Player.GetSitting == 0 ; Forces NPC to rejoin Player after sitting package is complete. | |||
RemoveScriptPackage | |||
AddScriptPackage "cmFollowPlayer" | |||
Set sitting to 0 | |||
endif | |||
; INVENTORY MODE - Inventory scripting which is a modified Toaster script. | |||
if inventory == 1 && follow == 1 | |||
if regulator == 3 | |||
AddItem cmTorch02 1 | |||
EquipItem cmTorch02 | |||
RemoveItem cmTorch02 1 | |||
Set regulator to 4 | |||
RemoveScriptPackage "cmInventory" | |||
AddScriptPackage "cmFollowPlayer" | |||
Set inventory to 0 | |||
endif | |||
if regulator == 2 && MenuMode == 0 | |||
Set regulator to 3 | |||
refbox.RemoveAllItems refnpc | |||
refbox.Disable | |||
endif | |||
if regulator == 1 | |||
RemoveAllItems refbox | |||
refbox.Activate Player | |||
Set regulator to 2 | |||
endif | |||
endif | |||
; PARTY COMMANDS - Reads Quest variable nParty and executes party commands for NPC. | |||
if partner == 2 && command == 0 && cmPartnersQuest.nParty==1 && inparty == 1 | |||
Set command to 1 | |||
RemoveScriptPackage | |||
AddScriptPackage "cmFollowPlayer" | |||
elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==2 | |||
Set inparty to 0 | |||
Set command to 1 | |||
RemoveScriptPackage | |||
AddScriptPackage "cmStandGuard" | |||
elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==3 | |||
Set inparty to 0 | |||
Set command to 1 | |||
RemoveScriptPackage | |||
AddScriptPackage "cmWander" | |||
elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==4 | |||
RemoveScriptPackage | |||
AddScriptPackage "cmEatCommand" | |||
Set command to 1 | |||
elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==5 | |||
RemoveScriptPackage | |||
AddScriptPackage "cmDrunk" | |||
Set command to 1 | |||
elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==6 | |||
RemoveScriptPackage | |||
AddScriptPackage "cmSleepCommand" | |||
Set command to 1 | |||
elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==7 && npctype >= 2 | |||
RemoveScriptPackage | |||
AddScriptPackage "cmHarvestCommand" | |||
Set command to 1 | |||
elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==8 | |||
RemoveScriptPackage | |||
AddScriptPackage "cmMeleeCommand" | |||
Set command to 1 | |||
elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==9 | |||
RemoveScriptPackage | |||
AddScriptPackage "cmCastAnyCommand" | |||
Set command to 1 | |||
elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==10 | |||
RemoveScriptPackage | |||
AddScriptPackage "cmAttackNPCCommand" | |||
Set command to 1 | |||
elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==11 | |||
RemoveScriptPackage | |||
AddScriptPackage "cmAttackMonsterCommand" | |||
Set command to 1 | |||
elseif partner == 2 && command == 0 && cmPartnersQuest.nParty==12 | |||
RemoveScriptPackage | |||
AddScriptPackage "cmFollowPlayer" | |||
Set command to 1 | |||
elseif partner == 2 && command == 1 && cmPartnersQuest.nParty==0 | |||
Set command to 0 | |||
elseif partner == 1 | |||
Set inparty to 0 | |||
endif | |||
if torch == 0 && IsActorUsingATorch == 0 && cmPartnersQuest.nTorch == 1 && IsSneaking == 0 | |||
AddItem cmTorch02 1 | |||
EquipItem cmTorch02 | |||
Set torch to 1 | |||
elseif torch == 1 && cmPartnersQuest.nTorch == 0 | |||
RemoveItem cmTorch02 1 | |||
Set torch to 0 | |||
elseif torch == 1 && IsSneaking == 1 | |||
RemoveItem cmTorch02 1 | |||
Set torch to 0 | |||
endif | |||
; TRAINING - Time-delayed levelup scripting | |||
Set npclevel to GetLevel | |||
Set pclevel to Player.GetLevel | |||
Set leveldiff to ( pclevel - npclevel ) | |||
if follow == 1 && train == 0 && leveldiff >= 2 | |||
Set train to 1 | |||
endif | |||
if follow == 1 && train == 1 | |||
Set trainday to GameDay ; Sets up a Day Counter. | |||
Set trainhour to GameHour | |||
if trainhour > 23.5 | |||
Set trainhour to 0 | |||
endif | |||
Set traindayspast to 0 | |||
Set traindone to leveldiff | |||
Set train to 2 | |||
endif | |||
if follow == 1 && train == 2 | |||
if trainday != GameDay | |||
if trainhour < GameHour | |||
Set trainday to GameDay | |||
Set traindayspast to ( traindayspast + 1 ) ; Day Counter counts the number of days. When the number of days equal to the number of training days required, variables are reset to zero and the task can be performed again. | |||
if traindayspast != traindone ; If training has not been completed, conduct training. | |||
Set levelup to 1 | |||
endif | |||
endif | |||
endif | |||
endif | |||
if follow == 1 && train == 2 | |||
if levelup == 1 | |||
Set npclevel to ( npclevel + 1 ) | |||
Set nlevel to npclevel | |||
if nlevel == 2 | |||
SetLevel, 2 | |||
elseif nlevel == 3 | |||
SetLevel, 3 | |||
elseif nlevel == 4 | |||
SetLevel, 4 | |||
elseif nlevel == 5 | |||
SetLevel, 5 | |||
elseif nlevel == 6 | |||
SetLevel, 6 | |||
elseif nlevel == 7 | |||
SetLevel, 7 | |||
elseif nlevel == 8 | |||
SetLevel, 8 | |||
elseif nlevel == 9 | |||
SetLevel, 9 | |||
elseif nlevel == 10 | |||
SetLevel, 10 | |||
elseif nlevel == 11 | |||
SetLevel, 11 | |||
elseif nlevel == 12 | |||
SetLevel, 12 | |||
elseif nlevel == 13 | |||
SetLevel, 13 | |||
elseif nlevel == 14 | |||
SetLevel, 14 | |||
elseif nlevel == 15 | |||
SetLevel, 15 | |||
elseif nlevel == 16 | |||
SetLevel, 16 | |||
elseif nlevel == 17 | |||
SetLevel, 17 | |||
elseif nlevel == 18 | |||
SetLevel, 18 | |||
elseif nlevel == 19 | |||
SetLevel, 19 | |||
elseif nlevel == 20 | |||
SetLevel, 20 | |||
elseif nlevel == 21 | |||
SetLevel, 21 | |||
elseif nlevel == 22 | |||
SetLevel, 22 | |||
elseif nlevel == 23 | |||
SetLevel, 23 | |||
elseif nlevel == 24 | |||
SetLevel, 24 | |||
elseif nlevel == 25 | |||
SetLevel, 25 | |||
elseif nlevel == 26 | |||
SetLevel, 26 | |||
elseif nlevel == 27 | |||
SetLevel, 27 | |||
elseif nlevel == 28 | |||
SetLevel, 28 | |||
elseif nlevel == 29 | |||
SetLevel, 29 | |||
elseif nlevel == 30 | |||
SetLevel, 30 | |||
elseif nlevel == 31 | |||
SetLevel, 31 | |||
elseif nlevel == 32 | |||
SetLevel, 32 | |||
elseif nlevel == 33 | |||
SetLevel, 33 | |||
elseif nlevel == 34 | |||
SetLevel, 34 | |||
elseif nlevel == 35 | |||
SetLevel, 35 | |||
elseif nlevel == 36 | |||
SetLevel, 36 | |||
elseif nlevel == 37 | |||
SetLevel, 37 | |||
elseif nlevel == 38 | |||
SetLevel, 38 | |||
elseif nlevel == 39 | |||
SetLevel, 39 | |||
elseif nlevel == 40 | |||
SetLevel, 40 | |||
elseif nlevel == 41 | |||
SetLevel, 41 | |||
elseif nlevel == 42 | |||
SetLevel, 42 | |||
elseif nlevel == 43 | |||
SetLevel, 43 | |||
elseif nlevel == 44 | |||
SetLevel, 44 | |||
elseif nlevel == 45 | |||
SetLevel, 45 | |||
elseif nlevel == 46 | |||
SetLevel, 46 | |||
elseif nlevel == 47 | |||
SetLevel, 47 | |||
elseif nlevel == 48 | |||
SetLevel, 48 | |||
elseif nlevel == 49 | |||
SetLevel, 49 | |||
elseif nlevel == 50 | |||
SetLevel, 50 | |||
endif | |||
; NPC Skill Increases | |||
; Weapons | |||
Set npcweapon to GetWeaponSkillType | |||
Set pcweapon to Player.GetWeaponSkillType | |||
if npcweapon == 0 | |||
Set npchandtohand to ( npchandtohand + 1 ) | |||
elseif npcweapon == 1 | |||
Set npcblade to ( npcblade + 1 ) | |||
elseif npcweapon == 2 | |||
Set npcblunt to ( npcblunt + 1 ) | |||
elseif npcweapon == 3 | |||
Set npcmarksman to ( npcmarksman + 1 ) | |||
endif | |||
if pcweapon == 0 | |||
Set npchandtohand to ( npchandtohand + 1 ) | |||
elseif pcweapon == 1 | |||
Set npcblade to ( npcblade + 1 ) | |||
elseif pcweapon == 2 | |||
Set npcblunt to ( npcblunt + 1 ) | |||
elseif pcweapon == 3 | |||
Set npcmarksman to ( npcmarksman + 1 ) | |||
endif | |||
; Armor | |||
Set npcarmor to GetArmorRatingUpperBody | |||
Set pcarmor to Player.GetArmorRatingUpperBody | |||
if npcarmor == 1 | |||
Set npclightarmor to ( npclightarmor + 1 ) | |||
elseif npcarmor == 2 | |||
Set npcheavyarmor to ( npcheavyarmor + 1 ) | |||
endif | |||
if pcarmor == 1 | |||
Set npclightarmor to ( npclightarmor + 1 ) | |||
elseif pcarmor == 2 | |||
Set npcheavyarmor to ( npcheavyarmor + 1 ) | |||
endif | |||
; Magic | |||
if npcdestruction >= npcalteration | |||
if npcdestruction >= npcillusion | |||
if npcdestruction >= npcconjuration | |||
if npcdestruction >= npcmysticism | |||
if npcdestruction >= npcrestoration | |||
Set npcdestruction to ( npcdestruction + 1 ) | |||
endif | |||
endif | |||
endif | |||
endif | |||
endif | |||
if npcalteration >= npcdestruction | |||
if npcalteration >= npcillusion | |||
if npcalteration >= npcconjuration | |||
if npcalteration >= npcmysticism | |||
if npcalteration >= npcrestoration | |||
Set npcalteration to ( npcalteration + 1 ) | |||
endif | |||
endif | |||
endif | |||
endif | |||
endif | |||
if npcillusion >= npcalteration | |||
if npcillusion >= npcdestruction | |||
if npcillusion >= npcconjuration | |||
if npcillusion >= npcmysticism | |||
if npcillusion >= npcrestoration | |||
Set npcillusion to ( npcillusion + 1 ) | |||
endif | |||
endif | |||
endif | |||
endif | |||
endif | |||
if npcconjuration >= npcalteration | |||
if npcconjuration >= npcillusion | |||
if npcconjuration >= npcdestruction | |||
if npcconjuration >= npcmysticism | |||
if npcconjuration > npcrestoration | |||
Set npcconjuration to ( npcconjuration + 1 ) | |||
endif | |||
endif | |||
endif | |||
endif | |||
endif | |||
if npcmysticism >= npcalteration | |||
if npcmysticism >= npcillusion | |||
if npcmysticism >= npcconjuration | |||
if npcmysticism >= npcdestruction | |||
if npcmysticism >= npcrestoration | |||
Set npcmysticism to ( npcmysticism + 1 ) | |||
endif | |||
endif | |||
endif | |||
endif | |||
endif | |||
if npcrestoration >= npcalteration | |||
if npcrestoration >= npcillusion | |||
if npcrestoration >= npcconjuration | |||
if npcrestoration >= npcmysticism | |||
if npcrestoration >= npcdestruction | |||
Set npcrestoration to ( npcrestoration + 1 ) | |||
endif | |||
endif | |||
endif | |||
endif | |||
endif | |||
; Stealth | |||
if npcsneak >= npcacrobatics | |||
if npcsneak >= npcsecurity | |||
if npcsneak >= npcblock | |||
Set npcsneak to ( npcsneak + 1 ) | |||
endif | |||
endif | |||
endif | |||
if npcsecurity >= npcacrobatics | |||
if npcsecurity >= npcsneak | |||
if npcsecurity >= npcblock | |||
Set npcsecurity to ( npcsecurity + 1 ) | |||
endif | |||
endif | |||
endif | |||
if npcacrobatics >= npcsneak | |||
if npcacrobatics >= npcsecurity | |||
if npcacrobatics >= npcblock | |||
Set npcacrobatics to ( npcacrobatics + 1 ) | |||
endif | |||
endif | |||
endif | |||
if npcblock >= npcacrobatics | |||
if npcblock >= npcsneak | |||
if npcblock >= npcsecurity | |||
Set npcblock to ( npcblock + 1 ) | |||
endif | |||
endif | |||
endif | |||
; Attributes | |||
if npctype == 1 ; For Combat NPC's | |||
Set npchealth to ( npchealth + 6 ) | |||
Set npcmagicka to ( npcmagicka + 1 ) | |||
Set npcendurance to ( npcendurance + 2 ) | |||
Set npcstrength to ( npcstrength + 2 ) | |||
Set npcathletics to ( npcathletics + 1 ) | |||
Set npcagility to ( npcagility + 1 ) | |||
Set npcspeed to ( npcspeed + 1 ) | |||
elseif npctype == 2 ; For Stealth NPC's | |||
Set npchealth to ( npchealth + 4 ) | |||
Set npcmagicka to ( npcmagicka + 2 ) | |||
Set npcluck to ( npcluck + 1 ) | |||
Set npcspeed to ( npcspeed + 2 ) | |||
Set npcagility to ( npcagility + 2 ) | |||
Set npcstrength to ( npcstrength + 1 ) | |||
Set npcendurance to ( npcendurance + 1 ) | |||
elseif npctype == 3 ; For Magic NPC's | |||
Set npchealth to ( npchealth + 4 ) | |||
Set npcmagicka to ( npcmagicka + 3 ) | |||
Set npcpersonality to ( npcpersonality + 1 ) | |||
Set npcwillpower to ( npcwillpower + 2 ) | |||
Set npcintelligence to ( npcintelligence + 2 ) | |||
Set npcspeed to ( npcspeed + 1 ) | |||
Set npcstrength to ( npcstrength + 1 ) | |||
endif | |||
SetActorValue Strength, npcstrength | |||
SetActorValue Willpower, npcwillpower | |||
SetActorValue Intelligence, npcintelligence | |||
SetActorValue Agility, npcagility | |||
SetActorValue Endurance, npcendurance | |||
SetActorValue Personality, npcpersonality | |||
SetActorValue Luck, npcluck | |||
SetActorValue Speed, npcspeed | |||
SetActorValue Athletics, npcathletics | |||
SetActorValue Health, npchealth | |||
SetActorValue Magicka, npcmagicka | |||
SetActorValue Fatigue, npcfatigue | |||
SetActorValue HandtoHand, npchandtohand | |||
SetActorValue Blade, npcblade | |||
SetActorValue Blunt, npcblunt | |||
SetActorValue Marksman, npcmarksman | |||
SetActorValue LightArmor, npclightarmor | |||
SetActorValue HeavyArmor, npcheavyarmor | |||
SetActorValue Destruction, npcdestruction | |||
SetActorValue Alteration, npcalteration | |||
SetActorValue Illusion, npcillusion | |||
SetActorValue Conjuration, npcconjuration | |||
SetActorValue Mysticism, npcmysticism | |||
SetActorValue Restoration, npcrestoration | |||
SetActorValue Sneak, npcsneak | |||
SetActorValue Security, npcsecurity | |||
SetActorValue Acrobatics, 100 | |||
SetActorValue Block, npcblock | |||
Set pclevel to Player.GetLevel | |||
Set leveldiff to ( pclevel - npclevel ) | |||
Set levelreport to 1 | |||
Message "Your partner has gained a new level." 10 | |||
if nlevel >= 50 ; Check to see if NPC has reached highest level. | |||
Set trainday to 0 | |||
Set traindayspast to 0 | |||
Set trainhour to 0 | |||
Set traindone to 0 | |||
Set train to 4 | |||
Set levelup to 2 | |||
Set levelreport to 2 | |||
Message "Your partner has become a master and no longer needs training," 10 | |||
elseif leveldiff < 2 ; Check to see if we need to continue training. | |||
Set trainday to 0 | |||
Set traindayspast to 0 | |||
Set trainhour to 0 | |||
Set traindone to 0 | |||
Set train to 0 | |||
Set levelup to 0 | |||
elseif leveldiff >= 2 | |||
Set levelup to 0 | |||
endif | |||
endif | |||
endif | |||
End | |||
; AI PACKAGE CONTROLS | |||
Begin OnPackageStart "cmInventory" | |||
if partner == 2 && IsInCombat != 1 | |||
Set refnpc to GetSelf | |||
Set regulator to 1 | |||
Set refbox to PlaceAtMe cmPartnersBox 1 0 0 | |||
refbox.SetOwnership | |||
Set inventory to 1 | |||
endif | |||
End | |||
Begin OnPackageStart "cmPickLockContainer" | |||
SetPackDuration 2 | |||
End | |||
Begin OnPackageDone "cmPickLockContainer" ; Commands NPC to rejoin Player after lockpicking' | |||
AddScriptPackage "cmFollowPlayer" | |||
End | |||
; MENU MODE | |||
Begin MenuMode 1009 ; Dialogue Menu - Reset quest and local variables | |||
Set cmPartnersQuest.nParty to 0 | |||
Set command to 0 | |||
Set levelreport to 0 | |||
End | |||
Begin MenuMode 1012 ; SleepWait Menu - Restores health, fatigue, and magicka to NPC when the player waits or sleeps. | |||
if follow == 1 | |||
if GetActorValue Health < npchealth | |||
SetActorValue Health, npchealth | |||
elseif GetActorValue Fatigue < npcfatigue | |||
SetActorValue Magicka, npcfatigue | |||
elseif GetActorValue Magicka < npcmagicka | |||
SetActorValue Magicka, npcmagicka | |||
endif | |||
endif | |||
End | |||
Begin OnReset ; Resets stats if 72 hour automatic cell refresh resets to default values while player is away. Not sure if this is necessary. Never tested it. | |||
if GetActorValue Acrobatics < 100 | |||
SetLevel, npclevel | |||
SetActorValue Strength, npcstrength | |||
SetActorValue Willpower, npcwillpower | |||
SetActorValue Intelligence, npcintelligence | |||
SetActorValue Agility, npcagility | |||
SetActorValue Endurance, npcendurance | |||
SetActorValue Personality, npcpersonality | |||
SetActorValue Luck, npcluck | |||
SetActorValue Speed, npcspeed | |||
SetActorValue Athletics, npcathletics | |||
SetActorValue Health, npchealth | |||
SetActorValue Magicka, npcmagicka | |||
SetActorValue Fatigue, npcfatigue | |||
SetActorValue Blade, npcblade | |||
SetActorValue Blunt, npcblunt | |||
SetActorValue Marksman, npcmarksman | |||
SetActorValue HandtoHand, npchandtohand | |||
SetActorValue HeavyArmor, npcheavyarmor | |||
SetActorValue LightArmor, npclightarmor | |||
SetActorValue Destruction, npcdestruction | |||
SetActorValue Alteration, npcalteration | |||
SetActorValue Illusion, npcillusion | |||
SetActorValue Conjuration, npcconjuration | |||
SetActorValue Mysticism, npcmysticism | |||
SetActorValue Restoration, npcrestoration | |||
SetActorValue Sneak, npcsneak | |||
SetActorValue Security, npcsecurity | |||
SetActorValue Acrobatics, 150 | |||
SetActorValue Block, npcblock | |||
endif | |||
End |