Myst42 Posted July 23, 2018 Posted July 23, 2018 Help! I'm too much of an idiot to understand scripting but I hoped I could modify one to my desires The idea is to have a morph spell that changes a few things like hairstyle, eyes, skin texture, adds some spells and buffs and increases hump height. Then upon recast, it's all supposed to be removed The original one was simpler, but it focused on changing the race, I want it to leave the race as it is, and only change cosmetic assets My first modification of this, followed the original and had a race "property" as a defined variable, and it worked. But I'm trying to take it to the next level Spoiler Scriptname MorphScript extends activemagiceffect float Morph Quest Property CompanionsTrackingQuest Auto SPELL Property Queen Auto SPELL Property PhaseOne Auto SPELL Property PhaseTwo Auto SPELL Property PhaseTree Auto SPELL Property Buff Auto float HRANDOM Faction Property Army Auto companionshousekeepingscript Property pr auto Event OnEffectStart(Actor Target, Actor Caster) Utility.Wait(0.1) if !Caster.IsInFaction (Army) Debug.Notification("You feel strangely ill,...") Debug.Notification("..., then nothing. Maybe you should rest.") Caster.Addspell (PhaseOne, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseOne) Debug.Notification("You feel your body changing inside you...") Caster.Addspell (PhaseTwo, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTwo) Debug.Notification("You feel overflowing with strange power.") Caster.Addspell (PhaseTree, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTree) Debug.Notification("You feel inside your body metamorphosing.") Utility.Wait(2.0) endif if (Morph != 0) Utility.Wait(1.0) (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalHair = Game.GetPlayer().GetNumHeadParts() (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalEyes = Game.GetPlayer().GetNumHeadParts() (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalSkin = Game.GetPlayer().Game.GetTintMaskColor(6, 0) if !Caster.IsInFaction (Army) Utility.Wait(5.0) Caster.AddToFaction(Army) Caster.ModFactionRank(Army, 1) endif Caster.addspell(Queen) Caster.addspell(Buff) Caster.ChangeHeadPart(MorphEyes) Caster.SetTintMaskColor(MorphSkin) Caster.ChangeHeadPart(MorphHair) SetFloat(Morph, 1) else Utility.Wait(1.0) Caster.SetHair((CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalHair) Caster.SetEyes((CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalEyes) Caster.SetSkin((CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalSkin) Caster.removespell(Buff) SetFloat(Morph, 0) endIf endEvent I learned the companions quest scripts serves to track player's original race, but only the race Obviously, the way it's written now, it means it doesnt work at all and can't even get past the "compile" part of the process So the first thing I need is a correct way of storing player's hair, skin texture and eyes. Player Succubus Quest mod does that, but I can't make sense of what's in the script even though it looks fairly simple. Then how to set the new ones, and finally how to return them I thought the "Float" function was a way to set a "switch" variable and turn it on/off in the same script but the error says "SetFloat" doesnt exist Also If I even manage to make it past this, I need a way to change jump height, and add an armor that works during the morph state. I was guessing in this case Caster. additem(ItemID, 1) and Caster.equipitem(ItemID) should work but with my luck, I know it wont. And I will have the same problems as not knowing how to store the origina geat and re-equip it I understand the jump height is managed with a "Game Setting" but I have no idea how to write the script to change it and return it to normal These are the errors I get upon attempt to compile: Spoiler (49,60): PlayerOriginalHair is not a property on script companionshousekeepingscript or one of its parents (49,98): GetNumHeadParts is not a function or does not exist (50,71): PlayerOriginalEyes is not a property on script companionshousekeepingscript or one of its parents (50,109): GetNumHeadParts is not a function or does not exist (51,60): PlayerOriginalSkin is not a property on script companionshousekeepingscript or one of its parents (51,98): the type name Game cannot be used as a property (51,59): type mismatch while assigning to a none (cast missing or types unrelated) (59,34): variable MorphEyes is undefined (60,36): variable MorphSkin is undefined (60,19): SetTintMaskColor is not a function or does not exist (61,34): variable MorphHair is undefined (62,3): SetFloat is not a function or does not exist (65,80): PlayerOriginalHair is not a property on script companionshousekeepingscript or one of its parents (65,14): SetHair is not a function or does not exist (66,83): PlayerOriginalEyes is not a property on script companionshousekeepingscript or one of its parents (66,17): SetEyes is not a function or does not exist (67,83): PlayerOriginalSkin is not a property on script companionshousekeepingscript or one of its parents (67,17): SetSkin is not a function or does not exist (69,10): SetFloat is not a function or does not exist And this is the PSQ script I was trying to learn from, that still doesnt teach me anything Spoiler Scriptname SuccubusHESHINNScript Extends ActiveMagicEffect PlayerSuccubusQuestScript Property PSQ Auto Event OnEffectStart(Actor akTarget, Actor akCaster) If !PSQ.IsHenshinchu && akCaster == PSQ.PlayerRef If !PSQ.IsHenshined StorageUtil.SetIntValue(Game.GetPlayer(), "PSQ_SuccubusON", 1) Henshin(akCaster) Else StorageUtil.SetIntValue(Game.GetPlayer(), "PSQ_SuccubusON", 0) DisHenshin(akCaster) EndIf EndIf EndEvent Function Henshin(Actor Succu) PSQ.IsHenshinchu = True PSQ.IsHenshined = True ;変身時に出るエフェクト Int HenshinMoan = PSQ.SoundHenshinMoan.Play(Succu) PSQ.SuccubusTransFXS.Play(Succu, 0.5) Utility.Wait(0.5) PSQ.FireFXShader.Play(Succu, 0.5) PSQ.ShockPlayerCloakFXShader.Play(Succu, 0.5) ;胸のサイズとか変えるやつ PSQ.SetScaleSuccubus() If PSQ.EnableBreastChangeSuccubus PSQ.SetBreastScaleSuccubus() EndIf ;バフ追加 If PSQ.HenshinBuff PSQ.SuccubusHenshinBonusSpell.SetNthEffectMagnitude(0, Succu.GetBaseAV("Health") * PSQ.HenshinBuffRateHealth / 100) PSQ.SuccubusHenshinBonusSpell.SetNthEffectMagnitude(1, Succu.GetBaseAV("Magicka") * PSQ.HenshinBuffRateMagicka / 100) PSQ.SuccubusHenshinBonusSpell.SetNthEffectMagnitude(2, Succu.GetBaseAV("Stamina") * PSQ.HenshinBuffRateStamina / 100) PSQ.SuccubusHenshinBonusSpell.SetNthEffectMagnitude(3, Succu.GetBaseAV("CarryWeight") * PSQ.HenshinBuffRateCarry / 100) Succu.AddSpell(PSQ.SuccubusHenshinBonusSpell, False) EndIf If PSQ.HenshinArmorRate PSQ.SuccubusArmorSpell.SetNthEffectMagnitude(0, PSQ.SuccubusArmorMagnitude * PSQ.SuccubusRank.GetValue()) Succu.AddSpell(PSQ.SuccubusArmorSpell, False) EndIf ;水の上を歩きたい If PSQ.CanWalkOnTheWater Succu.AddSpell(PSQ.SuccubusWaterWalking, False) EndIf ;目を変えるやつ If PSQ.HenshinEyes Int Eye = Succu.GetLeveledActorBase().GetNumHeadParts() Int i = 0 While i < Eye If Succu.GetLeveledActorBase().GetNthHeadPart(i).GetType() == 2 PSQ.OrgEyes = Succu.GetLeveledActorBase().GetNthHeadPart(i) i = Eye EndIf i += 1 EndWhile Succu.ChangeHeadPart(PSQ.PSQSuccubusEyes) EndIf ;ボディを変える奴 If PSQ.HenshinBody Succu.GetLeveledActorBase().SetSkin(PSQ.PSQSuccubusSkin) Succu.ChangeHeadPart(PSQ.PSQSuccubusHead) If !PSQ.HenshinHairColor && !PSQ.HenshinSkin Succu.QueueNiNodeUpdate() EndIf EndIf ;肌色を変えるやつ ;NiOverrideのやつで変えようと思って試してみたが、体の色は変わっても頭の色が変わらないので断念した。 If PSQ.HenshinSkin PSQ.OrgSkinColor = Game.GetTintMaskColor(6, 0) Game.SetTintMaskColor(PSQ.PSQSkinColor, 6, 0) If !PSQ.HenshinHairColor Succu.QueueNiNodeUpdate() EndIf EndIf ;タトゥーが現れることもある If PSQ.HenshinTattoo Float Manpukudo = PSQ.SuccubusEnergy.GetValue() / PSQ.MaxEnergy PSQ.ChangeBodyPaint(Manpukudo) EndIf ;髪を変えるやつ If PSQ.HenshinHair Int Hair = Succu.GetLeveledActorBase().GetNumHeadParts() Int i = 0 While i < Hair If Succu.GetLeveledActorBase().GetNthHeadPart(i).GetType() == 3 PSQ.OrgHair = Succu.GetLeveledActorBase().GetNthHeadPart(i) i = Hair EndIf i += 1 EndWhile Succu.ChangeHeadPart(PSQ.PSQSuccubusHair) EndIf ;髪色を変えるやつ If PSQ.HenshinHairColor PSQ.OrgHairColor = Succu.GetLeveledActorBase().GetHairColor() PSQ.PSQSuccubusHairColor.SetColor(PSQ.PSQSuccubusHairColorInt) Succu.GetLeveledActorBase().SetHairColor(PSQ.PSQSuccubusHairColor) Succu.QueueNiNodeUpdate() EndIf ;ちんちんつけるやつ If StorageUtil.GetIntValue(Succu, "PSQ_HasPenis") == 1 StorageUtil.SetIntValue(Succu, "PSQ_StillEquipPenis", 1) Else StorageUtil.SetIntValue(Succu, "PSQ_StillEquipPenis", 0) EndIf If PSQ.HenshinPenis || StorageUtil.GetIntValue(Succu, "PSQ_HasPenis") == 1 Succu.AddItem(PSQ.PlayerSuccubusSchlong, 1, True) Succu.UnequipItem(PSQ.PlayerHumanSchlong, True, True) Succu.EquipItem(PSQ.PlayerSuccubusSchlong, True, True) If !PSQ.PlayerHumanSchlong == PSQ.PlayerSuccubusSchlong Succu.RemoveItem(PSQ.PlayerHumanSchlong, Succu.GetItemCount(PSQ.PlayerHumanSchlong), True) EndIf StorageUtil.SetIntValue(Succu, "PSQ_HasPenis", 1) If PSQ.EnableFutanariPower Succu.AddSpell(PSQ.PowerOfFutanari, False) EndIf If PSQ.AutoGenderSwitch PSQ.SexLab.TreatAsMale(Succu) EndIf EndIf ;装備をつけるやつ If PSQ.HenshinBoots PSQ.OrgBoots = Succu.GetWornForm(0x00000080) as Armor Succu.AddItem(PSQ.PSQSuccubusBoots, 1, True) Succu.EquipItem(PSQ.PSQSuccubusBoots, True, True) EndIf If PSQ.HenshinCuirass PSQ.OrgArmor = Succu.GetWornForm(0x00000004) as Armor Succu.AddItem(PSQ.PSQSuccubusCuirass, 1, True) Succu.EquipItem(PSQ.PSQSuccubusCuirass, True, True) EndIf If PSQ.HenshinGloves PSQ.OrgGloves = Succu.GetWornForm(0x00000008) as Armor Succu.AddItem(PSQ.PSQSuccubusGauntlets, 1, True) Succu.EquipItem(PSQ.PSQSuccubusGauntlets, True, True) EndIf If PSQ.HenshinHorn Succu.AddItem(PSQ.PSQSuccubusHorns, 1, True) Succu.EquipItem(PSQ.PSQSuccubusHorns, True, True) EndIf If PSQ.HenshinWings Succu.AddItem(PSQ.PSQSuccubusWings, 1, True) Succu.EquipItem(PSQ.PSQSuccubusWings, True, True) EndIf If PSQ.HenshinTail Succu.AddItem(PSQ.PSQSuccubusTail, 1, True) Succu.EquipItem(PSQ.PSQSuccubusTail, True, True) EndIf ;周囲のやつを怖がらせるやつ If PSQ.HenshinFear PSQ.SuccubusFormFearSpell.Cast(Succu) EndIf ;変身を犯罪行為にするやつ If PSQ.HenshinIsCrime Succu.AddToFaction(PSQ.SuccubusFoeFaction) Succu.SetAttackActorOnSight() EndIf ;変身中にサキュバス魔法を強化するやつ ;強化率 = 0.5 * (SuccubusEXP) ^ 0.25 ;大体250で2.0、2000で3.34になる。 Float BoosterRate = Math.Sqrt(Math.Sqrt(PSQ.SuccubusEXP.GetValue())) / 2 If BoosterRate < 1 BoosterRate = 1 EndIf Int i = 0 While i <= 6 PSQ.SuccubusSpellBoostPerk.SetNthEntryValue(i, 1, BoosterRate) i += 1 EndWhile If PSQ.EnableSuccubusSpellBooster PSQ.TransformBooster.SetValue(1) EndIf PSQ.IsHenshinchu = False EndFunction Function DisHenshin(Actor Succu) PSQ.IsHenshinchu = True PSQ.IsHenshined = False ;変身時に出るエフェクト PSQ.SuccubusTransFXS.Play(Succu, 0.5) Utility.Wait(0.5) ;バフが外れて水の上を歩けなくなる Succu.RemoveSpell(PSQ.SuccubusHenshinBonusSpell) Succu.RemoveSpell(PSQ.SuccubusWaterWalking) Succu.RemoveSpell(PSQ.SuccubusArmorSpell) ;体型を戻すやつ PSQ.SetScaleHuman() If PSQ.EnableBreastChangeSuccubus PSQ.SetBreastScaleHuman() EndIf ;目を変えるやつ If PSQ.OrgEyes != None Succu.ChangeHeadPart(PSQ.OrgEyes) EndIf ;ボデェーを変えるやつ If PSQ.HenshinBody Succu.GetLeveledActorBase().SetSkin(PSQ.PSQHumanSkin) Succu.ChangeHeadPart(PSQ.PSQHumanHead) If PSQ.OrgHairColor == None && PSQ.OrgSkinColor == 0 Succu.QueueNiNodeUpdate() EndIf EndIf ;肌色を変えるやつ If PSQ.OrgSkinColor != 0 Game.SetTintMaskColor(PSQ.OrgSkinColor, 6, 0) If PSQ.OrgHairColor == None Succu.QueueNiNodeUpdate() EndIf EndIf ;タトゥーが消えることもある If PSQ.HenshinTattoo NiOverride.AddNodeOverrideFloat(Succu, true, "Face [Ovl2]", 8, -1, 0.0, true) NiOverride.AddNodeOverrideFloat(Succu, true, "Feet [Ovl2]", 8, -1, 0.0, true) NiOverride.AddNodeOverrideFloat(Succu, true, "Hands [Ovl2]", 8, -1, 0.0, true) NiOverride.AddNodeOverrideFloat(Succu, true, "Body [Ovl5]", 8, -1, 0.0, true) EndIf ;髪型を変えるやつ If PSQ.OrgHair != None Succu.ChangeHeadPart(PSQ.OrgHair) EndIf ;髪色を変えるやつ If PSQ.OrgHairColor != None Succu.GetLeveledActorBase().SetHairColor(PSQ.OrgHairColor) Succu.QueueNiNodeUpdate() EndIf ;ちんちんを外すやつ If StorageUtil.GetIntValue(Succu, "PSQ_HasPenis") == 1 Succu.UnequipItem(PSQ.PlayerSuccubusSchlong, True, True) If StorageUtil.GetIntValue(Succu, "PSQ_StillEquipPenis") == 1 Succu.AddItem(PSQ.PlayerHumanSchlong, 1, True) Succu.EquipItem(PSQ.PlayerHumanSchlong, True, True) StorageUtil.SetIntValue(Succu, "PSQ_HasPenis", 1) If !PSQ.PlayerHumanSchlong == PSQ.PlayerSuccubusSchlong Succu.RemoveItem(PSQ.PlayerSuccubusSchlong, Succu.GetItemCount(PSQ.PlayerSuccubusSchlong), True) EndIf If PSQ.AutoGenderSwitch PSQ.SexLab.TreatAsMale(Succu) EndIf Else Succu.RemoveItem(PSQ.PlayerSuccubusSchlong, Succu.GetItemCount(PSQ.PlayerSuccubusSchlong), True) StorageUtil.SetIntValue(Succu, "PSQ_HasPenis", 0) Succu.RemoveSpell(PSQ.PowerOfFutanari) If PSQ.AutoGenderSwitch && PSQ.SexLab.GetGender(Succu) == 0 PSQ.SexLab.ClearForcedGender(Succu) EndIf EndIf EndIf ;装備を戻すやつ Succu.RemoveItem(PSQ.PSQSuccubusBoots, Succu.GetItemCount(PSQ.PSQSuccubusBoots), True) Succu.RemoveItem(PSQ.PSQSuccubusCuirass, Succu.GetItemCount(PSQ.PSQSuccubusCuirass), True) Succu.RemoveItem(PSQ.PSQSuccubusGauntlets, Succu.GetItemCount(PSQ.PSQSuccubusGauntlets), True) If PSQ.OrgArmor != None If Succu.GetItemCount(PSQ.OrgArmor) > 0 Succu.EquipItem(PSQ.OrgArmor, abSilent = True) EndIf EndIf If PSQ.OrgGloves != None If Succu.GetItemCount(PSQ.OrgGloves) > 0 Succu.EquipItem(PSQ.OrgGloves, abSilent = True) EndIf EndIf If PSQ.OrgBoots != None If Succu.GetItemCount(PSQ.OrgBoots) > 0 Succu.EquipItem(PSQ.OrgBoots, abSilent = True) EndIf EndIf Succu.RemoveItem(PSQ.PSQSuccubusHorns, Succu.GetItemCount(PSQ.PSQSuccubusHorns), True) Succu.RemoveItem(PSQ.PSQSuccubusWings, Succu.GetItemCount(PSQ.PSQSuccubusWings), True) Succu.RemoveItem(PSQ.PSQSuccubusTail, Succu.GetItemCount(PSQ.PSQSuccubusTail), True) ;ブースターを解除するやつ PSQ.TransformBooster.SetValue(0) ;これ以上住民に襲われなくするやつ Succu.RemoveFromFaction(PSQ.SuccubusFoeFaction) Succu.SetAttackActorOnSight(False) ;元のなんかをクリア PSQ.OrgArmor = None PSQ.OrgGloves = None PSQ.OrgBoots = None PSQ.OrgSkinColor = 0 PSQ.OrgEyes = None PSQ.IsHenshinchu = False EndFunction Anyone? Please?
Myst42 Posted July 24, 2018 Author Posted July 24, 2018 Anyone?? No??? I wonder how is that every single sex mod out there relies on scripting, but whenever someone needs to learn about them, there is nothing but silence and intrincated mazes of long tutorials that lead you to many places but hardly ever where you want to go. Is there like a secret papyrus coder's club or something? *sigh* I'm taking the longass road and reading all those little tutorials one by one and see if there is anything at all that works I guess my first objective is to find out why the hell can't I set a proper "Float" variable as an on/off switch for the spell. Should I use a quest and set the stages as the switch? Perhaps a Global? What's the correct syntax on any that? Does anybody even care? No? Anyone? Where do all the cool people go to get help on their scripts? ?
GenioMaestro Posted July 24, 2018 Posted July 24, 2018 The things you want to do are not easy if you do not have basic knowledge about computer programming. Papyrus is another laguage for programing computer and you need know the basic. For example, Float is a data type, as like in all other computers languajes, and is not a switch, simply store data. My knowledge in 3d modeling is too limited, but at least i know what is a mesh and a texture and how intereact, have nifscope for see it, but i can't touch any inside it. Open and see a lot of nif, but never change any and never save any. Can you explain me how can i make an armor in a mesage like that? Same problem have i. Can't explain all that you need. Maybe can be better request a favor, and someone can make an armor for me or any can make a program for you. But im on holydays now and not have access to my main computer. Can't compile any here and can't help you more until the next week.
Myst42 Posted July 24, 2018 Author Posted July 24, 2018 1 hour ago, GenioMaestro said: The things you want to do are not easy if you do not have basic knowledge about computer programming. Papyrus is another laguage for programing computer and you need know the basic. For example, Float is a data type, as like in all other computers languajes, and is not a switch, simply store data. My knowledge in 3d modeling is too limited, but at least i know what is a mesh and a texture and how intereact, have nifscope for see it, but i can't touch any inside it. Open and see a lot of nif, but never change any and never save any. Can you explain me how can i make an armor in a mesage like that? Same problem have i. Can't explain all that you need. Maybe can be better request a favor, and someone can make an armor for me or any can make a program for you. But im on holydays now and not have access to my main computer. Can't compile any here and can't help you more until the next week. Ok, thanks for answering. No worries. I can wait if you say you "could help" even if next week. After asking around I understood that it's not as simple as it should be Ideally it would be just about a variable (Now I'm told an "Int" is better) and a way to check it, and set it on/off depending on the wish Then the next problem would be finding a way to store head part data, change it to new models and recall the stored ones But it's trickier than that isn't it? Anyway, Made another attempt after asking around, this one kind of works, but only as a way to test the "toggle" capacity of the spell (adds a spell and removes it upon "transform") Spoiler criptname MorphScript extends activemagiceffect SPELL Property Queen Auto SPELL Property Buff Auto SPELL Property PhaseOne Auto SPELL Property PhaseTwo Auto SPELL Property PhaseTree Auto float HRANDOM Faction Property Army Auto Event OnEffectStart(Actor Target, Actor Caster) Utility.Wait(0.1) if !Caster.IsInFaction (Army) Debug.Notification("..., then nothing. Maybe we have to wait?") Debug.Notification("You feel all funny during the visual effect,...") Caster.Addspell (PhaseOne, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseOne) Debug.Notification("You feel funny pleasant sensations in your body.") Caster.Addspell (PhaseTwo, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTwo) Debug.Notification("You feel ligher and ligher.") Caster.Addspell (PhaseTree, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTree) Debug.Notification("You feel inside your body metamorphosing.") Utility.Wait(2.0) endif If !Caster.hasSpell(Buff) Utility.Wait(1.0) if !Caster.IsInFaction (Army) Utility.Wait(5.0) Caster.AddToFaction(Army) Caster.ModFactionRank(Army, 1) endif Caster.addspell(Queen) Caster.addspell(Buff) else Utility.Wait(1.0) Caster.removespell(Buff) endIf endEvent I learned the hard way that Floats, Ints, Bools and probably not even Globals are good to make the toggle functional For some reason, the script just refuses to change their values to my will. So now it's ussing the presence or absence of a spell instead to differentiate the outcome Finally, I learned of this Papyrus Util thing could help with some functions to store variables (and possibly head parts) for later recall. Still a long way though
GenioMaestro Posted July 25, 2018 Posted July 25, 2018 Hoo.. yes.. i can make this next week... not worry... But is evident that you want learn and you want make it yourself. I try teach you some things and help in the way i can. 10 hours ago, Myst42 said: Reveal hidden contents criptname MorphScript extends activemagiceffect SPELL Property Queen Auto SPELL Property Buff Auto SPELL Property PhaseOne Auto SPELL Property PhaseTwo Auto SPELL Property PhaseTree Auto float HRANDOM Faction Property Army Auto Event OnEffectStart(Actor Target, Actor Caster) Utility.Wait(0.1) if !Caster.IsInFaction (Army) Debug.Notification("..., then nothing. Maybe we have to wait?") Debug.Notification("You feel all funny during the visual effect,...") Caster.Addspell (PhaseOne, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseOne) Debug.Notification("You feel funny pleasant sensations in your body.") Caster.Addspell (PhaseTwo, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTwo) Debug.Notification("You feel ligher and ligher.") Caster.Addspell (PhaseTree, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTree) Debug.Notification("You feel inside your body metamorphosing.") Utility.Wait(2.0) endif If !Caster.hasSpell(Buff) Utility.Wait(1.0) if !Caster.IsInFaction (Army) Utility.Wait(5.0) Caster.AddToFaction(Army) Caster.ModFactionRank(Army, 1) endif Caster.addspell(Queen) Caster.addspell(Buff) else Utility.Wait(1.0) Caster.removespell(Buff) endIf endEvent I learned the hard way that Floats, Ints, Bools and probably not even Globals are good to make the toggle functional For some reason, the script just refuses to change their values to my will. So now it's ussing the presence or absence of a spell instead to differentiate the outcome Finally, I learned of this Papyrus Util thing could help with some functions to store variables (and possibly head parts) for later recall. Still a longway though Floats, Ints, Bools are Data Types, but Global is a Definition, are not the same. For example: Float var1 = 77.777 Int var2 = 77 Bool var3 = true These are 3 variables each of diferent data type but you can put Global before each: Global Float var1 = 77.777 Global Int var2 = 77 Global Bool var3 = true That is for make this 3 variables accesibles from any other scrip. But you not need it now. You can make a switch with any variable, for example with a bool puting it in true or false, with a int puting it in 0 or 1, with a float making the same, or with a property... but make it with a spell... is the first time i see it. Really this must work, put a bit of overcharge, but not more. Your script must compile and execute. I not see any problem at first view. Maybe you forgot put some mesages in the last part. Add it and try. Some Like this: Spoiler If !Caster.hasSpell(Buff) Debug.Notification("caster not have spell buf.") Utility.Wait(1.0) if !Caster.IsInFaction (Army) Debug.Notification("caster is not in faction army. addiding it") Utility.Wait(5.0) Caster.AddToFaction(Army) Caster.ModFactionRank(Army, 1) endif Caster.addspell(Queen) Caster.addspell(Buff) else Debug.Notification("caster HAVE spell buf. Removing") Utility.Wait(1.0) ;------------------------The first verification ---> if !Caster.IsInFaction (Army) ;------------------------If not remove from the faction only execute the fragment ONE time Caster.RemoveFromFaction(Army) ;--------------------------------------- Caster.removespell(Buff) endIf
Andy14 Posted July 25, 2018 Posted July 25, 2018 Spoiler Scriptname MorphScript extends activemagiceffect float Morph Quest Property CompanionsTrackingQuest Auto SPELL Property Queen Auto SPELL Property PhaseOne Auto SPELL Property PhaseTwo Auto SPELL Property PhaseTree Auto SPELL Property Buff Auto float HRANDOM Faction Property Army Auto companionshousekeepingscript Property pr auto Event OnEffectStart(Actor Target, Actor Caster) Utility.Wait(0.1) if !Caster.IsInFaction (Army) Debug.Notification("You feel strangely ill,...") Debug.Notification("..., then nothing. Maybe you should rest.") Caster.Addspell (PhaseOne, false) HRANDOM = Utility.RandomFloat(2, ? Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseOne) Debug.Notification("You feel your body changing inside you...") Caster.Addspell (PhaseTwo, false) HRANDOM = Utility.RandomFloat(2, ? Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTwo) Debug.Notification("You feel overflowing with strange power.") Caster.Addspell (PhaseTree, false) HRANDOM = Utility.RandomFloat(2, ? Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTree) Debug.Notification("You feel inside your body metamorphosing.") Utility.Wait(2.0) endif if (Morph != 0) Utility.Wait(1.0) (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalHair = Game.GetPlayer().GetNumHeadParts() (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalEyes = Game.GetPlayer().GetNumHeadParts() (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalSkin = Game.GetPlayer().Game.GetTintMaskColor(6, 0) if !Caster.IsInFaction (Army) Utility.Wait(5.0) Caster.AddToFaction(Army) Caster.ModFactionRank(Army, 1) endif Caster.addspell(Queen) Caster.addspell(Buff) Caster.ChangeHeadPart(MorphEyes) Caster.SetTintMaskColor(MorphSkin) Caster.ChangeHeadPart(MorphHair) SetFloat(Morph, 1) else Utility.Wait(1.0) Caster.SetHair((CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalHair) Caster.SetEyes((CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalEyes) Caster.SetSkin((CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalSkin) Caster.removespell(Buff) SetFloat(Morph, 0) endIf endEvent Basically, it should be variable properties. Unless there is only one temporary variable valid at the term. In your case, morph would be used as global Boolean. Not Int or Float, because the declaration of the data types defines the size of the reserved RAM. In CK go to Globals. Create a new Global -> Type Boolean -> Default = False (or 0) (call it globMorph for example) In your script properties -> add a new property -> type bool - click ok. (call it Morph for example) Set the value of the property to your global globMorph (use the picklist) Use in script.. Declaration: globalvariable property Morph auto To read this Global in the script: if morph.getValue () == false or if morph.getValue () == true to set this Global: morph.setValue (false) or morph.setValue (true) (0 and 1 should work too) lines like this CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalHair = Game.GetPlayer().GetNumHeadParts() and this Caster.SetHair((CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalHair) can`t work. This are NOT properties of CompanionsHousekeepingScript or the Parentquest. But honestly, I do not know exactly what you want to achieve. You add spell, wait, remove the spell. This one after another for 3 spells. What do you want to achieve? A race change with certain looks, skills, buffs etc? PS: To set normal variables, the syntax is: variable = value or variable = value as data type SetFloat etc. does not exist.
Myst42 Posted July 26, 2018 Author Posted July 26, 2018 Spoiler 11 hours ago, Andy14 said: Reveal hidden contents Scriptname MorphScript extends activemagiceffect float Morph Quest Property CompanionsTrackingQuest Auto SPELL Property Queen Auto SPELL Property PhaseOne Auto SPELL Property PhaseTwo Auto SPELL Property PhaseTree Auto SPELL Property Buff Auto float HRANDOM Faction Property Army Auto companionshousekeepingscript Property pr auto Event OnEffectStart(Actor Target, Actor Caster) Utility.Wait(0.1) if !Caster.IsInFaction (Army) Debug.Notification("You feel strangely ill,...") Debug.Notification("..., then nothing. Maybe you should rest.") Caster.Addspell (PhaseOne, false) HRANDOM = Utility.RandomFloat(2, ? Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseOne) Debug.Notification("You feel your body changing inside you...") Caster.Addspell (PhaseTwo, false) HRANDOM = Utility.RandomFloat(2, ? Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTwo) Debug.Notification("You feel overflowing with strange power.") Caster.Addspell (PhaseTree, false) HRANDOM = Utility.RandomFloat(2, ? Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTree) Debug.Notification("You feel inside your body metamorphosing.") Utility.Wait(2.0) endif if (Morph != 0) Utility.Wait(1.0) (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalHair = Game.GetPlayer().GetNumHeadParts() (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalEyes = Game.GetPlayer().GetNumHeadParts() (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalSkin = Game.GetPlayer().Game.GetTintMaskColor(6, 0) if !Caster.IsInFaction (Army) Utility.Wait(5.0) Caster.AddToFaction(Army) Caster.ModFactionRank(Army, 1) endif Caster.addspell(Queen) Caster.addspell(Buff) Caster.ChangeHeadPart(MorphEyes) Caster.SetTintMaskColor(MorphSkin) Caster.ChangeHeadPart(MorphHair) SetFloat(Morph, 1) else Utility.Wait(1.0) Caster.SetHair((CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalHair) Caster.SetEyes((CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalEyes) Caster.SetSkin((CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalSkin) Caster.removespell(Buff) SetFloat(Morph, 0) endIf endEvent Basically, it should be variable properties. Unless there is only one temporary variable valid at the term. In your case, morph would be used as global Boolean. Not Int or Float, because the declaration of the data types defines the size of the reserved RAM. In CK go to Globals. Create a new Global -> Type Boolean -> Default = False (or 0) (call it globMorph for example) In your script properties -> add a new property -> type bool - click ok. (call it Morph for example) Set the value of the property to your global globMorph (use the picklist) Use in script.. Declaration: globalvariable property Morph auto To read this Global in the script: if morph.getValue () == false or if morph.getValue () == true to set this Global: morph.setValue (false) or morph.setValue (true) (0 and 1 should work too) lines like this CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalHair = Game.GetPlayer().GetNumHeadParts() and this Caster.SetHair((CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalHair) can`t work. This are NOT properties of CompanionsHousekeepingScript or the Parentquest. But honestly, I do not know exactly what you want to achieve. You add spell, wait, remove the spell. This one after another for 3 spells. What do you want to achieve? A race change with certain looks, skills, buffs etc? PS: To set normal variables, the syntax is: variable = value or variable = value as data type SetFloat etc. does not exist. Actually, the fragment I posted earlier, kinda worked, with some minor modifications Spoiler If !Caster.hasSpell(Buff) Utility.Wait(1.0) (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalRace = Game.GetPlayer().GetRace() if !Caster.IsInFaction (Army) Utility.Wait(5.0) Caster.AddToFaction(Army) Caster.ModFactionRank(Army, 1) endif Caster.addspell(Queen) Caster.addspell(Buff) else Utility.Wait(1.0) Caster.removespell(Buff) endIf endEvent I still have no idea why I need to keep some lines about the companions quests even though it's not "using" them. Without them, the stages do not work ant I have to add the morph spell manually Anyway I tried your modifications like this: Spoiler If MorphStage.GetValue () == false Utility.Wait(1.0) (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalRace = Game.GetPlayer().GetRace() if !Caster.IsInFaction (Army) Utility.Wait(5.0) Caster.AddToFaction(Army) Caster.ModFactionRank(Army, 1) endif Caster.addspell(Queen) Caster.addspell(Buff) MorphStage.SetValue (1) Else Utility.Wait(1.0) Caster.removespell(Buff) MorphStage.SetValue (0) EndIf And it was the only way it worked, because setting "true and false" gave me errors for... some reason On the rest of what you said Yeah, I know a lot of the early the companions lines can't work. That thing was just a scrap of intent. I though the companions quest could serve as a storage, since other mods apparently store race values in it But it only works for race, and not hairstyles or eyes As to what I want -Transformation mod (like vampire lord or werewolf) -Only with less drastic effects. I'm not aiming to change the race, I'm aiming to change the aspect of the player while maintaining a humanoid physique -This means basically just changing a few colors and models (new eyes, new hairstyle color as in new texture, not just a tint, and new body skin texture) -The transformation is meant to also add buff spells, resistances, a new outfit, abilities, etc, but that's the "easy" part -I also want to alter the jump height during the transformed stage Why? Because I wanted something neat and simple as a transform, possiobly useable as a template for custom other transformations. Also because it's common that a transformation mod changes the player's race, but that's not what I wanted. Race change like that for a humanoid aspect has disadvantages such as (consider the morph race is a tweaked nord) differnet heights, in this case an imperial using the spell would be taller and I dont want that.
GenioMaestro Posted July 26, 2018 Posted July 26, 2018 Forget the companions quest, you not need it. Well.. i make some search and find a scrip that can help. Copy it to your code for test: Spoiler ActorBase PlayerBase PlayerBase = Game.GetPlayer().GetActorBase() int NumParts = PlayerBase.GetNumHeadParts() Debug.Notification("Player HeadParts Num : "+NumParts) int i = 0 while i < NumParts Debug.Notification("Player HeadPart("+i+") : "+PlayerBase.GetNthHeadPart(i).GetName()) i += 1 endwhile If this work only need store the data and make a inverse function for recover the original status. The second point is HOW you want select the new parts. In your original scripts you have: Caster.ChangeHeadPart(MorphEyes) Caster.SetTintMaskColor(MorphSkin) Caster.ChangeHeadPart(MorphHair) but MorphEyes, MorphSkin, MorphHair are not defined. You can define it in CK and insert in the scrip with properties.
Myst42 Posted July 30, 2018 Author Posted July 30, 2018 On 7/26/2018 at 5:26 AM, GenioMaestro said: Alrigh! Thanks. That also worked Added the lines after the "transform" section and the messages begin popping up as well as the buff spell I placed for testing. Counts about 7-8 head parts plus their names in game depending on the character. On the final product I only need to change eyes and hair though. Also. I want a texture change for the skin Spoiler Scriptname MorphScript extends activemagiceffect SPELL Property Queen Auto SPELL Property Buff Auto SPELL Property PhaseOne Auto SPELL Property PhaseTwo Auto SPELL Property PhaseTree Auto float HRANDOM Faction Property Army Auto GlobalVariable property MorphStage auto Event OnEffectStart(Actor Target, Actor Caster) Utility.Wait(0.1) if !Caster.IsInFaction (Army) Debug.Notification("..., then nothing. Maybe we have to wait?") Debug.Notification("You feel all funny during the visual effect,...") Caster.Addspell (PhaseOne, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseOne) Debug.Notification("You feel funny pleasant sensations in your body.") Caster.Addspell (PhaseTwo, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTwo) Debug.Notification("You feel ligher and ligher.") Caster.Addspell (PhaseTree, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTree) Debug.Notification("You feel inside your body metamorphosing.") Utility.Wait(2.0) Endif If MorphStage.GetValue () == false Utility.Wait(1.0) if !Caster.IsInFaction (Army) Utility.Wait(5.0) Caster.AddToFaction(Army) Caster.ModFactionRank(Army, 1) endif Caster.addspell(Queen) Caster.addspell(Buff) ;Getting HeadParts; ActorBase PlayerBase PlayerBase = Game.GetPlayer().GetActorBase() int NumParts = PlayerBase.GetNumHeadParts() Debug.Notification("Player HeadParts Num : "+NumParts) int i = 0 While i < NumParts Debug.Notification("Player HeadPart("+i+") : "+PlayerBase.GetNthHeadPart(i).GetName()) i += 1 EndWhile MorphStage.SetValue (1) Else Utility.Wait(1.0) Caster.removespell(Buff) MorphStage.SetValue (0) EndIf EndEvent This is what it looks now. Also removed the companions references I'm gonna try and see if I can mess with an effect that changes the jump values next, since I still have no clue how to get the headpart system running, I figured at least I can try some of the other features first. To do: Jump height, morph armor equip and recall, hair and eye + texture change Unfortunately I have yet to find a way to declare a head morph variable on the script. I mean I could use "HEADPART Property Hair Auto" but the CK drop-down menu with the head part list doesnt work. I checked and there's only a handful of things that can be picked that way. I think some other people managed to make it work though. No idea how. Oh, and lastly. There is this jump height change script from the Become a Fairy mod. But by the looks of it, it's permanent, and I'm having compilation issues, even when copying the exact same script. I'll try to find a way to include it into the "toggle" system of the morph script. Spoiler Scriptname Fairy3rdPhaseJump extends activemagiceffect GlobalVariable Property JumpHeight Auto Event onEffectStart(Actor akTarget, Actor akCaster) JumpHeight.SetValue( Game.GetGameSettingFloat("fJumpHeightMin") ) Game.SetGameSettingFloat("fJumpHeightMin", 200.0) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) Game.SetGameSettingFloat("fJumpHeightMin", JumpHeight ) EndEvent Event OnCellLoad() ;JumpHeight.SetValue( Game.GetGameSettingFloat("fJumpHeightMin") ) Game.SetGameSettingFloat("fJumpHeightMin", 200.0) EndEvent Event OnPlayerLoadGame() JumpHeight.SetValue( Game.GetGameSettingFloat("fJumpHeightMin") ) Game.SetGameSettingFloat("fJumpHeightMin", 200.0) EndEvent EDIT: Ok I think I identified the problem with the jump script lines It is possible to set the fgame setting values normally with "Game.SetGameSettingFloat("fJumpHeightMin", 250.0)" However, the original Fairy script was using a Global to store the value and re-establish it to the game setting from the Global value On my end, for some reason I can't compile the script to set the value from the declared property. In other words "Game.SetGameSettingFloat("fJumpHeightMin", JumpHeight)" is failing It only works if I write is as "Game.SetGameSettingFloat("fJumpHeightMin", 76.0)" Which brings a whole new set of questions regarding this too -Why is it failing? Why can't I use a global as storage and recall it like the Fairy script does? -Why does the original script try to change the value OnCellLoad and on PlayerLoadGame too? -Does this mean the value gets reset after loading a game and I should have a safe for cells and saved games as well? -Is it even worth it to ask these questions and wanting to store the base jump value, or should I just alter the values between 76 (vanilla) and 250 (morph buff) (because I already tried it like this and it works just fine, I'm just worried that it would be better to use a means to change it from an aquired base value instead of a generic vanilla guess)
Andy14 Posted July 30, 2018 Posted July 30, 2018 Event OnEffectFinish(Actor akTarget, Actor akCaster) Game.SetGameSettingFloat("fJumpHeightMin", JumpHeight ) EndEvent JumpHeight is a float (as global variable)? Okay then Game.SetGameSettingFloat("fJumpHeightMin", JumpHeight.GetValue() ) But, if you never change the Value of global JumpHeight then you don't need it as global variable.
GenioMaestro Posted July 30, 2018 Posted July 30, 2018 11 hours ago, Myst42 said: Alrigh! Thanks. That also worked (...) Which brings a whole new set of questions regarding this too -Why is it failing? Why can't I use a global as storage and recall it like the Fairy script does? -Why does the original script try to change the value OnCellLoad and on PlayerLoadGame too? -Does this mean the value gets reset after loading a game and I should have a safe for cells and saved games as well? -Is it even worth it to ask these questions and wanting to store the base jump value, or should I just alter the values between 76 (vanilla) and 250 (morph buff) (because I already tried it like this and it works just fine, I'm just worried that it would be better to use a means to change it from an aquired base value instead of a generic vanilla guess) Well... not worry... i travel today and tomorrow i have my main computer again. For continue making things, i recomend you read the fantastic papyrus guide made by CPU. You must learn some basic things. And not worry, the developing process is complex and slow, and sometimes, VERY FRUSTRATING. You must install Notepad++ if you not have it. Is totally free and a very good editor. One of the best features is make double click over a word in the document and automatically hitligth all the posititions of the same word. Is very usseful for see all the uses of a variable. Try it. I try answer your questions: JumpHeight is an -Auto- variable defined as -Property- of type -GlobalVariable- as it: GlobalVariable Property JumpHeight Auto And that mean some things: GlobalVariable ---> is another DataType defined in the game, as like int, float and int. Property ---> is a definition and that mean that can be linked with creation kit. JumpHeight ---> is a the name of the variable. Auto ---> as CPU say in the guide is a keyword for make automatic get() and set() Because JumpHeight is define as Property you must use the SetValue function for put a value inside it, as show in JumpHeight.SetValue( Game.GetGameSettingFloat("fJumpHeightMin") ) and must use the GetValue function for obtain the value and the problematic line must appear like: Game.SetGameSettingFloat("fJumpHeightMin", JumpHeight.GetValue() ) Why the original script complile and your script not compile??? I not know. Probably is a fail in the Papyrus Compiler, caused because the original script have the Property defined and linked in the esp and you not. Note that -defined- and -linked- are two direfent steps that must be made in Creation Kit. if the operation is made on OnCellLoad and on PlayerLoadGame i presume is because must need. The fJumpHeightMin is defined in the base game and is changed by some script, as you say by the mod Become a Fairy, and as i know by Player Sucubus Quest, and you are making a mod that change it. Then, all the 3 mod's must collaborate and must use a system that permit change and restore the values in a good way for make it compatibles betewn them. For be more clear, for example, if you have the Player Sucubus Quest, when your player is human the fJumpHeightMin is equal to the vanilla value of 76 but when you transform to sucubus the fJumpHeightMin is changed to 150 as i remember. If you run your script when your player is alrready transformed in sucubus and when your effect end put the fJumpHeightMin in the vanilla value you are breaking PSQ because the sucubus form must have a fJumpHeightMin of 150. For that, when the effect start you must store the fJumpHeightMin value and when the effect finnish you must put the fJumpHeightMin variable in the value that have originaly.
Myst42 Posted July 30, 2018 Author Posted July 30, 2018 3 hours ago, Andy14 said: Game.SetGameSettingFloat("fJumpHeightMin", JumpHeight.GetValue() ) Much appreciated! Now it works perfectly with the toggle. 3 hours ago, GenioMaestro said: Ok, I'll see about that guide Already have Notepad ++ I also get how to declare a property now... I think so. I just dont know how to declare a HeadPart property, since the CK menu doesnt list them as the rest. Declaring global or spell variables enables the drop down list on the CK, headpart, doesnt. On the jump effect, yeap. It works now, and it IS using the global stored value to reset it to normal instead o "76". (At least I think so, since the toggle spell reverts the changes) My guess is if one were to, like you said, use this morph spell on top of the Succubus mod, the stored value would be the succubus jump height and not the vanilla one. I reckon this is where stuff gets messy since more messed up stuff could happen if the succubus mod were to alter it again on top of this. One would probably need to deactivate them in order to properly return to normal, I dunno... Anyway, my intention was not to play this thing with the succubus mod or other mods that alter jump height, but instead of them. Sill some optimal compatibility would be very nice. On the "OnCellLoad" and "OnPlayerLoadGame" question, I figured a possible logical explanation to have those, would be to have them as some kind of a failsafe to apply or revert the changes when loading happens So I tried to replicate the idea but none of what I tried seems to work. The script compiles, but if I load a save that's supposed to have the active jump height effect, it just loads it with the last stored value no matter what. IE, loading for the first time, is vanilla height. Then loading any save game after I used the spell in game, loads it with increased height, even if the "morph" status is not supposed to be active. This kind of tells me the game can't keep individual save tracks of the altered variables. However, I think it's a minor nuissance since recasting to off/on again is still working. If I wanted to save on a morph state, I wouldn't get to have the jump boost unless I reverted and morphed again in game (which currently takes less than a second) Here's my attempt script at checking the status of globals on a morphed state, hoping it would work from saved games. It doesnt seem to do anything really. I added it to one of the buff spells added when the morph is on, so it would get removed when the spell is not present. Spoiler Scriptname MorphJumpScript extends activemagiceffect GlobalVariable Property JumpHeight Auto GlobalVariable Property JumpFall Auto GlobalVariable Property MorphStage auto ;Jumpyness loading failsafe?; Event OnEffectStart(Actor akTarget, Actor akCaster) MorphStage.SetValue (1) Game.SetGameSettingFloat("fJumpHeightMin", 250.0) Game.SetGameSettingFloat("fJumpFallHeightMin", 2000.0) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) MorphStage.SetValue (0) Game.SetGameSettingFloat("fJumpHeightMin", JumpHeight.GetValue() ) Game.SetGameSettingFloat("fJumpFallMin", JumpFall.GetValue() ) EndEvent Event OnCellLoad() MorphStage.SetValue (1) Game.SetGameSettingFloat("fJumpHeightMin", 250.0) Game.SetGameSettingFloat("fJumpFallHeightMin", 2000.0) EndEvent Event OnPlayerLoadGame() MorphStage.SetValue (1) Game.SetGameSettingFloat("fJumpHeightMin", 250.0) Game.SetGameSettingFloat("fJumpFallHeightMin", 2000.0) EndEvent
Myst42 Posted July 30, 2018 Author Posted July 30, 2018 Well, no luck today on the failsafe scripting I read a few things saying I should make a quest with "start game enabled" and that that was the way to have a condition that cheded up on every save Then some stuff about a reference alias that's supposed to be the player. According to the CK wiki, I should have 2 more scripts, one for the quest, that would handle the actual effects, and one for the "player alias" whatever the hell that means Effect quest script compiles just fine, but the alias one refuses to. On the wiki page it appears to summon the "Maintenance" function from the quest script, but on the CK it simply refuses to compile because it says "Maintenance" doesnt exist, even when the other script was already created. I tried several ways of getting or "declaring" the function from the quest script but none of them worked. Also, I don't even know if I was going somewhere with this. For all I know, it could be just another dead end. I'm starting to find the wiki has a suspiciously large number of functions and scripts that just don't work IE PlayerRef could be a way to target the player, but nope. Doesn't compile. Game.GetPlayer() works instead.
novaarr Posted July 30, 2018 Posted July 30, 2018 Maybe you should try and do some basics first, maybe go through the tutorials on the CK Wiki, there is a lot of information (for example how to setup editors for syntax highlighting, some even have plugins to build the scripts directly out of your editor). Get a feel on how everything works. The problems you have with scripts not working are mostly because of your inexperience, and not because the code is faulty. PlayerRef is a variable/property you have to set up yourself. The differences between variables and properties are also explained in the CK wiki. Game.GetPlayer() might work, true, but it's not recommandable as it's just way slower than assigning a reference to a property. Aliases are references to ingame-locations, objects, actors, etc. and allow you to receive events those would get, and other stuff, without having to alter the base records. I think there is also a tutorial on the wiki, working with aliases.
Myst42 Posted July 31, 2018 Author Posted July 31, 2018 8 hours ago, novaarr said: Maybe you should try and do some basics first, maybe go through the tutorials on the CK Wiki, there is a lot of information (for example how to setup editors for syntax highlighting, some even have plugins to build the scripts directly out of your editor). Get a feel on how everything works. The problems you have with scripts not working are mostly because of your inexperience, and not because the code is faulty. PlayerRef is a variable/property you have to set up yourself. The differences between variables and properties are also explained in the CK wiki. Game.GetPlayer() might work, true, but it's not recommandable as it's just way slower than assigning a reference to a property. Aliases are references to ingame-locations, objects, actors, etc. and allow you to receive events those would get, and other stuff, without having to alter the base records. I think there is also a tutorial on the wiki, working with aliases. I have been looking on the CK tutorials But it's not that simple to navigate through the maze of links in it getting where you want to be when you dont have a clear guide. At least for me is not. I have seen some very simple stuff explaining how to declare a variable, when apparently I already know that, then the next link leads me to some code that barely makes any sense to me. At some times it's way too easy and the next moment I need a tutorial to understand the tutorial itself. I think most of the problems I'm having relate to the correct words to say something. IE I knew before I needed to get a value from a global and apply it as a change to something, but the exact syntax eluded me. Anyway. This is how I left it for tonight. It compiled perfectly, and the parts that should work, are already working. Spoiler Scriptname MorphScript extends activemagiceffect SPELL Property Queen Auto SPELL Property Buff Auto SPELL Property PhaseOne Auto SPELL Property PhaseTwo Auto SPELL Property PhaseTree Auto float HRANDOM Faction Property Army Auto GlobalVariable Property MorphStage auto GlobalVariable Property JumpHeight Auto GlobalVariable Property JumpFall Auto HeadPart Property MorphHair Auto HeadPart Property MorphEyes Auto Armor Property MorphOutfit Auto Event OnEffectStart(Actor Target, Actor Caster) Utility.Wait(0.1) if !Caster.IsInFaction (Army) Debug.Notification("..., then nothing. Maybe we have to wait?") Debug.Notification("You feel all funny during the visual effect,...") Caster.Addspell (PhaseOne, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseOne) Debug.Notification("You feel funny pleasant sensations in your body.") Caster.Addspell (PhaseTwo, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTwo) Debug.Notification("You feel ligher and ligher.") Caster.Addspell (PhaseTree, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTree) Debug.Notification("You feel inside your body metamorphosing.") Utility.Wait(2.0) Endif ;The actual morphing spell; If MorphStage.GetValue () == false Utility.Wait(1.0) If !Caster.IsInFaction (Army) Utility.Wait(5.0) Caster.AddToFaction(Army) Caster.ModFactionRank(Army, 1) EndIf ;Add Bonuses; Caster.addspell(Queen) Caster.addspell(Buff) ;Add Morph Outfit; ;Caster.OrgArmor = Game.GetPlayer().GetWornForm(0x00000004) as Armor; How to store original armor?; Caster.AddItem(MorphOutfit, 1, True) Caster.EquipItem(MorphOutfit, True, True) ;Jumpyness Set; JumpHeight.SetValue( Game.GetGameSettingFloat("fJumpHeightMin") ) JumpFall.SetValue( Game.GetGameSettingFloat("fJumpFallHeightMin") ) Game.SetGameSettingFloat("fJumpHeightMin", 250.0) Game.SetGameSettingFloat("fJumpFallHeightMin", 2000.0) ;Getting HeadParts - Future Alter Cosmetics; ActorBase PlayerBase PlayerBase = Game.GetPlayer().GetActorBase() int NumParts = PlayerBase.GetNumHeadParts() Debug.Notification("Player HeadParts Num : "+NumParts) int i = 0 While i < NumParts Debug.Notification("Player HeadPart("+i+") : "+PlayerBase.GetNthHeadPart(i).GetName()) i += 1 EndWhile Game.GetPlayer().ChangeHeadPart(MorphHair) Game.GetPlayer().ChangeHeadPart(MorphEyes) ;Switch On; MorphStage.SetValue (1) Else Utility.Wait(1.0) ;Remove bonuses; Caster.removespell(Buff) ;Remove Morph Outfit; Caster.RemoveItem(MorphOutfit, Caster.GetItemCount(MorphOutfit), True) ;If Caster.GetItemCount(OriginalGear) > 0; ;Caster.EquipItem(OriginalGear, abSilent = True); ;EndIf; ;Jumpyness Reset" Game.SetGameSettingFloat("fJumpHeightMin", JumpHeight.GetValue() ) Game.SetGameSettingFloat("fJumpFallMin", JumpFall.GetValue() ) ;Restore Cosmetics; ;Switch Off; MorphStage.SetValue (0) EndIf EndEvent Stuff to do: -Maintenance scripts. Do I really need a quest and a player alias to make the game check the jump height and morph variables on every load? -How to declare a head part property in terms the CK can understand so it gives me the list -How to store player head parts and equipped armor -How to recall and restore head parts and previously equipped armor I almost forgot. The last thing I need to change is skin texture. There is a Texture Set declarable property with a proper list on the CK, but I was wondering if maybe for that is the best way or perhaps a body mesh swap function would be better More to read tomorrow...
GenioMaestro Posted July 31, 2018 Posted July 31, 2018 Sorry, i'm traveling and can't answer you in the correct time. But i'm at home and now i have my computer, my mod's and all my utils, then go for it. Spoiler 22 hours ago, Myst42 said: (...) On the "OnCellLoad" and "OnPlayerLoadGame" question, I figured a possible logical explanation to have those, would be to have them as some kind of a failsafe to apply or revert the changes when loading happens So I tried to replicate the idea but none of what I tried seems to work. The script compiles, but if I load a save that's supposed to have the active jump height effect, it just loads it with the last stored value no matter what. IE, loading for the first time, is vanilla height. Then loading any save game after I used the spell in game, loads it with increased height, even if the "morph" status is not supposed to be active. This kind of tells me the game can't keep individual save tracks of the altered variables. However, I think it's a minor nuissance since recasting to off/on again is still working. If I wanted to save on a morph state, I wouldn't get to have the jump boost unless I reverted and morphed again in game (which currently takes less than a second) Here's my attempt script at checking the status of globals on a morphed state, hoping it would work from saved games. It doesnt seem to do anything really. I added it to one of the buff spells added when the morph is on, so it would get removed when the spell is not present. Reveal hidden contents Scriptname MorphJumpScript extends activemagiceffect GlobalVariable Property JumpHeight Auto GlobalVariable Property JumpFall Auto GlobalVariable Property MorphStage auto ;Jumpyness loading failsafe?; Event OnEffectStart(Actor akTarget, Actor akCaster) MorphStage.SetValue (1) Game.SetGameSettingFloat("fJumpHeightMin", 250.0) Game.SetGameSettingFloat("fJumpFallHeightMin", 2000.0) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) MorphStage.SetValue (0) Game.SetGameSettingFloat("fJumpHeightMin", JumpHeight.GetValue() ) Game.SetGameSettingFloat("fJumpFallMin", JumpFall.GetValue() ) EndEvent Event OnCellLoad() MorphStage.SetValue (1) Game.SetGameSettingFloat("fJumpHeightMin", 250.0) Game.SetGameSettingFloat("fJumpFallHeightMin", 2000.0) EndEvent Event OnPlayerLoadGame() MorphStage.SetValue (1) Game.SetGameSettingFloat("fJumpHeightMin", 250.0) Game.SetGameSettingFloat("fJumpFallHeightMin", 2000.0) EndEvent First of all, scuse me. I make a BIG error in one of my answers, basically for not reading everything with the corresponding care. When i say: On 7/30/2018 at 12:20 PM, GenioMaestro said: if the operation is made on OnCellLoad and on PlayerLoadGame i presume is because must need. This is not TRUE. When I wrote it, I was thinking that you paste COMPLETE code that works from other authors, and that is why my ERROR. It seems that you have paste "code that works from other authors" inside your script, waiting for the code to work, but sometimes things are not so easy. You are making an activemagiceffect and the event's that the game can process inside an activemagiceffect are detailled in the CK wiki and if you see it NOT HAVE the event's OnCellLoad or OnPlayerLoadGame. That mean that the game not call the functions and the game not process the code inside that functions when they are declared inside a script of the IN-CORRECT TYPE. In a good compiler that must show an error or at least one warning, but the papyrus compiler say NONE and you, of course, think all is correct and expect good result. But the principal ERROR IS MINE, for not alert you of that when i write my message yesterday. Excuse me. Spoiler 18 hours ago, Myst42 said: Well, no luck today on the failsafe scripting I read a few things saying I should make a quest with "start game enabled" and that that was the way to have a condition that cheded up on every save Then some stuff about a reference alias that's supposed to be the player. According to the CK wiki, I should have 2 more scripts, one for the quest, that would handle the actual effects, and one for the "player alias" whatever the hell that means Effect quest script compiles just fine, but the alias one refuses to. On the wiki page it appears to summon the "Maintenance" function from the quest script, but on the CK it simply refuses to compile because it says "Maintenance" doesnt exist, even when the other script was already created. I tried several ways of getting or "declaring" the function from the quest script but none of them worked. Also, I don't even know if I was going somewhere with this. For all I know, it could be just another dead end. I'm starting to find the wiki has a suspiciously large number of functions and scripts that just don't work IE PlayerRef could be a way to target the player, but nope. Doesn't compile. Game.GetPlayer() works instead. Sorry again, you're fighting with code that does not work, for my mistake, of course, and trying to do things out of your knowledge without any explanation of what you should do and why. I think you not need the event OnPlayerLoadGame, but if you REALLY need it, must be made as the wiki say. For correctly use the event OnPlayerLoadGame you need two scripts and if you want a magic effect you need another script. Of course, this is a bit complex for understand at first view, and appear excesive and innecesary, but is the way of the game is made and we must follow it, like it or not. Your problem with "Maintenance" sure is caused because you try paste the wiki code inside your script, like you make yesterday, and of course that is not the way. When you see the OnPlayerLoadGame in the wiki you see some code, open the spoiler for see it, i write a lot of thing inside it for try help you understand it: Spoiler NOT TRY COMPILE THIS.... YOU CAN GET A LOT OF ERRORS. ----------------------------------------------------- ---------- START FIRST SCRIPT----------- ScriptName YourQuestScript extends Quest ---> extends -Quest- mean that this script is linked to the main quest processor Float Property fYourModVersion Auto ---> a simple variable Event OnInit() ---> this OnInit event is called only ONCE when the game start the quest for the first time Maintenance() ---> this Maintenance() is a function declared some lines down EndEvent Function Maintenance() ---> this is the Maintenance function for make some things If fYourModVersion < 1.23 ; Current version If fYourModVersion Debug.Trace("Updating from version " + fYourModVersion) Else Debug.Trace("Initializing for the first time.") EndIf fYourModVersion = 1.23 EndIf EndFunction ---------- END FIRST SCRIPT----------- ---------- START SECOND SCRIPT----------- ScriptName YourPlayerAliasScript extends ReferenceAlias ---> extends -ReferenceAlias- mean that this script is linked to the alias processor YourQuestScript Property QuestScript Auto ---> This line link to the first script and permit call function of the first script from the second script Event OnPlayerLoadGame() ---> This event is proccesed ONLY when is declared in a scrip of TYPE -ReferenceAlias- QuestScript.Maintenance() ---> -QuestScript- is the name used for the link and Maintenance is defined in the first script. EndEvent ---------- END SECOND SCRIPT----------- I expect you understand now some things, but if you have dudes, not worry, ask again. Maybe i not explain good, or maybe you need know more things. Spoiler 9 hours ago, Myst42 said: I have been looking on the CK tutorials But it's not that simple to navigate through the maze of links in it getting where you want to be when you dont have a clear guide. At least for me is not. I have seen some very simple stuff explaining how to declare a variable, when apparently I already know that, then the next link leads me to some code that barely makes any sense to me. At some times it's way too easy and the next moment I need a tutorial to understand the tutorial itself. I think most of the problems I'm having relate to the correct words to say something. IE I knew before I needed to get a value from a global and apply it as a change to something, but the exact syntax eluded me. Anyway. This is how I left it for tonight. It compiled perfectly, and the parts that should work, are already working. Reveal hidden contents Scriptname MorphScript extends activemagiceffect SPELL Property Queen Auto SPELL Property Buff Auto SPELL Property PhaseOne Auto SPELL Property PhaseTwo Auto SPELL Property PhaseTree Auto float HRANDOM Faction Property Army Auto GlobalVariable Property MorphStage auto GlobalVariable Property JumpHeight Auto GlobalVariable Property JumpFall Auto HeadPart Property MorphHair Auto HeadPart Property MorphEyes Auto Armor Property MorphOutfit Auto Event OnEffectStart(Actor Target, Actor Caster) Utility.Wait(0.1) if !Caster.IsInFaction (Army) Debug.Notification("..., then nothing. Maybe we have to wait?") Debug.Notification("You feel all funny during the visual effect,...") Caster.Addspell (PhaseOne, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseOne) Debug.Notification("You feel funny pleasant sensations in your body.") Caster.Addspell (PhaseTwo, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTwo) Debug.Notification("You feel ligher and ligher.") Caster.Addspell (PhaseTree, false) HRANDOM = Utility.RandomFloat(2, 8) Utility.WaitGameTime(HRANDOM) Caster.Removespell (PhaseTree) Debug.Notification("You feel inside your body metamorphosing.") Utility.Wait(2.0) Endif ;The actual morphing spell; If MorphStage.GetValue () == false Utility.Wait(1.0) If !Caster.IsInFaction (Army) Utility.Wait(5.0) Caster.AddToFaction(Army) Caster.ModFactionRank(Army, 1) EndIf ;Add Bonuses; Caster.addspell(Queen) Caster.addspell(Buff) ;Add Morph Outfit; ;Caster.OrgArmor = Game.GetPlayer().GetWornForm(0x00000004) as Armor; How to store original armor?; Caster.AddItem(MorphOutfit, 1, True) Caster.EquipItem(MorphOutfit, True, True) ;Jumpyness Set; JumpHeight.SetValue( Game.GetGameSettingFloat("fJumpHeightMin") ) JumpFall.SetValue( Game.GetGameSettingFloat("fJumpFallHeightMin") ) Game.SetGameSettingFloat("fJumpHeightMin", 250.0) Game.SetGameSettingFloat("fJumpFallHeightMin", 2000.0) ;Getting HeadParts - Future Alter Cosmetics; ActorBase PlayerBase PlayerBase = Game.GetPlayer().GetActorBase() int NumParts = PlayerBase.GetNumHeadParts() Debug.Notification("Player HeadParts Num : "+NumParts) int i = 0 While i < NumParts Debug.Notification("Player HeadPart("+i+") : "+PlayerBase.GetNthHeadPart(i).GetName()) i += 1 EndWhile Game.GetPlayer().ChangeHeadPart(MorphHair) Game.GetPlayer().ChangeHeadPart(MorphEyes) ;Switch On; MorphStage.SetValue (1) Else Utility.Wait(1.0) ;Remove bonuses; Caster.removespell(Buff) ;Remove Morph Outfit; Caster.RemoveItem(MorphOutfit, Caster.GetItemCount(MorphOutfit), True) ;If Caster.GetItemCount(OriginalGear) > 0; ;Caster.EquipItem(OriginalGear, abSilent = True); ;EndIf; ;Jumpyness Reset" Game.SetGameSettingFloat("fJumpHeightMin", JumpHeight.GetValue() ) Game.SetGameSettingFloat("fJumpFallMin", JumpFall.GetValue() ) ;Restore Cosmetics; ;Switch Off; MorphStage.SetValue (0) EndIf EndEvent Stuff to do: -Maintenance scripts. Do I really need a quest and a player alias to make the game check the jump height and morph variables on every load? -How to declare a head part property in terms the CK can understand so it gives me the list -How to store player head parts and equipped armor -How to recall and restore head parts and previously equipped armor I almost forgot. The last thing I need to change is skin texture. There is a Texture Set declarable property with a proper list on the CK, but I was wondering if maybe for that is the best way or perhaps a body mesh swap function would be better More to read tomorrow... For that i not refer you to the CK tutorials. Some times are too easy and simply and say really none and others times are too complex and hard for understand it. Is the way as normally the big companies made this things. One good guide is made by CPU and i give you a link to it. Try read and ask any that you not understand. "I need a tutorial to understand the tutorial itself." Not worry, i can be your personal tutorial, and of course, any other user of the site, i not claim exclusivity in any way. This is a plublic post. "Stuff to do:" I'm working on a fully functional script for make all this, but need some time. Maybe today, but sure tomorrow.
GenioMaestro Posted August 2, 2018 Posted August 2, 2018 On 7/31/2018 at 4:25 AM, Myst42 said: ... I have the script working but need ask some things to you because i make a lot of changes. I not want give you a piece of code that you can't understand and can't touch. Have you understand how work the two scrips for OnPlayerLoadGame? Do you know how the game store the data? How you launch the spell that make the transformation?
Myst42 Posted August 2, 2018 Author Posted August 2, 2018 On 7/31/2018 at 7:51 AM, GenioMaestro said: I think you not need the event OnPlayerLoadGame, but if you REALLY need it, must be made as the wiki say. For correctly use the event OnPlayerLoadGame you need two scripts and if you want a magic effect you need another script. Of course, this is a bit complex for understand at first view, and appear excesive and innecesary, but is the way of the game is made and we must follow it, like it or not. Your problem with "Maintenance" sure is caused because you try paste the wiki code inside your script, like you make yesterday, and of course that is not the way. When you see the OnPlayerLoadGame in the wiki you see some code, open the spoiler for see it, i write a lot of thing inside it for try help you understand it: Reveal hidden contents NOT TRY COMPILE THIS.... YOU CAN GET A LOT OF ERRORS. ----------------------------------------------------- ---------- START FIRST SCRIPT----------- ScriptName YourQuestScript extends Quest ---> extends -Quest- mean that this script is linked to the main quest processor Float Property fYourModVersion Auto ---> a simple variable Event OnInit() ---> this OnInit event is called only ONCE when the game start the quest for the first time Maintenance() ---> this Maintenance() is a function declared some lines down EndEvent Function Maintenance() ---> this is the Maintenance function for make some things If fYourModVersion < 1.23 ; Current version If fYourModVersion Debug.Trace("Updating from version " + fYourModVersion) Else Debug.Trace("Initializing for the first time.") EndIf fYourModVersion = 1.23 EndIf EndFunction ---------- END FIRST SCRIPT----------- ---------- START SECOND SCRIPT----------- ScriptName YourPlayerAliasScript extends ReferenceAlias ---> extends -ReferenceAlias- mean that this script is linked to the alias processor YourQuestScript Property QuestScript Auto ---> This line link to the first script and permit call function of the first script from the second script Event OnPlayerLoadGame() ---> This event is proccesed ONLY when is declared in a scrip of TYPE -ReferenceAlias- QuestScript.Maintenance() ---> -QuestScript- is the name used for the link and Maintenance is defined in the first script. EndEvent ---------- END SECOND SCRIPT----------- Ok regarding that I understand I need 2 scripts IF I'm getting this right, these 2 should be used for "maintenance" function. Every time the lame loads, a check should be made to see how are the variables, and correct them if needed. Again, if I understood the wiki correctly, one is placed and linked as a quest script, in the quest window, and the other as a reference alias script on that big reference alias window that pops up when you try to add one to the quest as the wiki says So quest is "start game enabled", which would mean on every load, the quest is active right? Quest references player as an alias. for some reason Whatever that reason is, the script calls upon another script, which would be the quest script containing the maintenance function Problem is, I never could find a way to call upon the quest script from the reference script In other words " QuestScript.Maintenance()" on the second script, didn't work. And yes, I declared the QuestScript Property Auto thing as a variable first. It still tells me there is no such function as Maintenance, even though the other script had it. BTW, my maintenance wished effect is something like this, which would be the quest script to check for the altered globals and game settings Spoiler SPELL Property Buff Auto GlobalVariable Property JumpHeight Auto GlobalVariable Property JumpFall Auto GlobalVariable Property MorphStage auto Event OnInit() Maintenance() EndEvent Function Maintenance() If Game.GetPlayer().hasSpell(Buff) MorphStage.SetValue (1) Game.SetGameSettingFloat("fJumpHeightMin", 250.0) Game.SetGameSettingFloat("fJumpFallHeightMin", 2000.0) Else MorphStage.SetValue (0) Game.SetGameSettingFloat("fJumpHeightMin", JumpHeight.GetValue() ) Game.SetGameSettingFloat("fJumpFallMin", JumpFall.GetValue() ) EndIf EndFunction Ok and to your questions 1.- Not quite. What I understand is what I said above. I still don't know how to make the other script properly call the Maintenance function. 2.- How the game stores data? No, I dont think so. I have a vague understanding that globals and game settings are not exactly stored in the save, but as something running while one is playing/loading/on game menus. At least I think so since if the changes were actually stored in the save, I wouldnt need all this maintenance "OnLoad" stuff. Which kinda worries me for the future since I think maybe a complex thing will be needed to store head parts beyond single saved games or playing sessions as well 3.- Spell is alredy made and working. A lot of the changes are already playable. I also tweaked the system from the fairy mod, so you drink a potion, some time happens, and then the spell is added. I has the script in the magic effect window and id calls it upon cast. Having the spell (as a lesser power) allows voice key casting, script runs perfectly so far. Toggle on-off, add, remove spell, outfit etc... Dunno what else you might want to know about it.
GenioMaestro Posted August 2, 2018 Posted August 2, 2018 Well... then i think must explain some things more. Skyrim is designed having the quest as primary objective and for that the quest are the more complex screen in CK and have 14 tab and 8 of them are for dialog, because dialog is the second objective. The quest are designed as main data holder of the game and for that, near every mod need a quest. Normally the quest are marked as "Star Game Enabled" but some not have this tick. When you make a savegame all the data of all the quest is stored in the savegame and of course is restored when load it. This data include ALL the data refered by each quest, including the data from the script. For that, when you upgrade a mod a lot of times you need a "clean save" because the game store ALL in the savegame. When a mod change some specific data in the update the saved data in the savegame take preference from the new data that come from the update, and a a "clean save" is the only solution. The quest window is big and complex and you can write a lot of conditions in diferent screens for make diferent things on each moment, but this is not enougth and sometimes you need write framents of code for make specifics thing. This framents of code are papyrus code that are managed by CK but sometimes need more and here start the developement of complete scripts. When you start making scripts for skyrim must know some important things. The first line of the script is VERY important and look like this(i put some for explain the diference): Scriptname MorphScript extends activemagiceffect Scriptname MorphScript extends ReferenceAlias Scriptname MorphScript extends quest The word that put after -extends- define the TYPE of the script, really the class, and determine a lot of things about what you can make inside that script and what things can make THE GAME. One of the most important is the Event system of the game and that mean the, for example, the following: An event like OnInit() is called by the game ONLY when is defined in scrip of type quest An event like OnplayerLoadGame() is called ONLY when is defined in scrip of type ReferenceAlias An event like OnEffectStart() is called ONLY when is defined in scrip of type activemagiceffect The seconf important thing about the TYPE of the script is called PERSISTANCE and can be diferent for each type of script and can be diferent in diferent situations. The PERSISTANCE is refered about how many time the system, the game, or the engine, retain the data that have asociated to the script. For example, a script of type quest have a PERSISTANCE that come from start quest to stop quest. For example, a script of type ReferenceAlias have a PERSISTANCE that come from the initializacion of the reference to the elimination or change of the reference. A special case is an alias for the Player characte, because the Player character NEVER change, and in this case and ONLY in this case, can have the same persistance that the quest. For example, a script of type activemagiceffect have a PERSISTANCE that come from start the magic efect to stop magic efect. In this way, when you have a quest with the tick "Star Game Enabled" the data from the quest are initialized when you click "start game" in the main menu and this data are stored in the savegame and restored in load. The data from the quest is DISCARDED only when stop the quest. In other way, when you define data in a script of type activemagiceffect the data from the script are initialized when start the magic efect and PERSIST only while the magic efect is running and are DISCARDED when the magic efect expire. I publish now because i not want lost all that i wrote. I continue in the next message.
GenioMaestro Posted August 2, 2018 Posted August 2, 2018 Another important thing that you must know is the diferent DATA TYPES that you can have in a script. You can declare a variable of the basic Data Types, like in other languajes, int, float, bool, string... But you can declare a variable of each type of object that you have in CK like spell, armor, weapon, actor... One importan diference that you must know is that not ALL data type are clearely defined in CK and some are a bit obscured. The most complex is ACTOR and sometimes in some scripts and in some functions of the script you must use the diferent definitions for requeriments of the script or for requeriments of the function. A lot of functions of the game use the simple Actor, but other times you must use the BaseActor, and others times the ReferenceAlias or the LeveledActor. All of this are diferent definitions of the same thing, an actor, but in diferent stages, and this can give you a lot of problem. Have it in mind. Another important thing is the declaration of PROPERTY that give you the direct conection between CK and the script. When you declare a PROPERTY you are creating and EMPTY link. This link must be filled in CK and permit the use of specific object in the script. For example, you make a spell in CK and for use and access the spell from the script you must declare a property like that "SPELL Property Queen Auto" and FILL the value of the property in CK. One of the most strange points is that you can create a property of type script and link it with CK but the property type that you must use is the name of the script. Look the diference: SPELL Property Queen Auto MorphScript Property MS Auto In the first line you are creating a property of type SPELL called Queen. In the second line you are creating a property of type MorphScript called MS. This two properties MUST BE FILLED in CK for work. I close here and make another message.
GenioMaestro Posted August 2, 2018 Posted August 2, 2018 All of this things that is explain is for understand WHAT i make with your script and for WHAT, because you must repeat my steps for make work the script. I create a quest and put your script in a main module and create another script that call the main script. I must create a quest, and mark the tick "Start Game Enabled", for store, in permanent way, the data about the armor, eyes and hair that have the player before launch the script. In the quest i create and Alias for Player and attach the main script to the alias. This main script have the function and store the data. In the effect of the spell i create a property of type script for join the two script and the result is this: MUST HAVE TWO scripts because the event OnEffectStart only is called inside a script of type ActiveMagicEfect and because have limited PERSISTANCE i need store the data in other script. Main Script: Spoiler Scriptname MorphScriptMain extends ReferenceAlias SPELL Property Queen Auto SPELL Property Buff Auto SPELL Property PhaseOne Auto SPELL Property PhaseTwo Auto SPELL Property PhaseTree Auto float HRANDOM Faction Property Army Auto GlobalVariable Property MorphStage auto GlobalVariable Property MorphJumpHeight Auto GlobalVariable Property MorphJumpFall Auto HeadPart Property MorphHair Auto HeadPart Property MorphEyes Auto Armor Property MorphSkin Auto Armor Property MorphGloves Auto Armor Property MorphOutfit Auto Armor Property MorphBoots Auto ;--------------------------------------------------------------------------- ;From https://www.creationkit.com/index.php?title=GetType_-_HeadPart ;Number Type ;0 Mouth ;1 Head ;2 Eyes ;3 Hair ;4 Beard ;5 Scar ;6 Brows ;Data definition for store original head parts and armors HeadPart Property OriginalEyes Auto HeadPart Property OriginalHair Auto Int OriginalEyes_Pos Int OriginalHair_Pos Armor Property OriginalSkin Auto Armor Property OriginalBoots Auto Armor Property OriginalArmor Auto Armor Property OriginalGloves Auto ;--------------------------------------------------------------------------- Function Morph() Actor Player = Game.GetPlayer() ActorBase PlayerBase = Player.GetLeveledActorBase() Utility.Wait(0.1) if !Player.IsInFaction (Army) Debug.Notification("..., then nothing. Maybe we have to wait?") Debug.Notification("You feel all funny during the visual effect,...") Player.Addspell (PhaseOne, false) HRANDOM = Utility.RandomFloat(2, ? Utility.WaitGameTime(HRANDOM) Player.Removespell (PhaseOne) Debug.Notification("You feel funny pleasant sensations in your body.") Player.Addspell (PhaseTwo, false) HRANDOM = Utility.RandomFloat(2, ? Utility.WaitGameTime(HRANDOM) Player.Removespell (PhaseTwo) Debug.Notification("You feel ligher and ligher.") Player.Addspell (PhaseTree, false) HRANDOM = Utility.RandomFloat(2, ? Utility.WaitGameTime(HRANDOM) Player.Removespell (PhaseTree) Debug.Notification("You feel inside your body metamorphosing.") Utility.Wait(2.0) Endif ;The actual morphing spell; ;------------------------ Debug.Trace("MorphStage:" + MorphStage.GetValue() ) If MorphStage.GetValue() == 0 MiscUtil.PrintConsole("MorphStage == 0 changing the player") ;--------------------------------------------------------------------------- ;STORING ORIGINALS Int NumHeadParts = Player.GetLeveledActorBase().GetNumHeadParts() Int i = 0 While i < NumHeadParts If Player.GetLeveledActorBase().GetNthHeadPart(i).GetType() == 2 OriginalEyes = Player.GetLeveledActorBase().GetNthHeadPart(i) OriginalEyes_Pos = i EndIf If Player.GetLeveledActorBase().GetNthHeadPart(i).GetType() == 3 OriginalHair = Player.GetLeveledActorBase().GetNthHeadPart(i) OriginalHair_Pos = i EndIf i += 1 EndWhile OriginalSkin = PlayerBase.GetSkin() OriginalBoots = Player.GetWornForm(0x00000080) as Armor OriginalArmor = Player.GetWornForm(0x00000004) as Armor OriginalGloves = Player.GetWornForm(0x00000008) as Armor MiscUtil.PrintConsole("OriginalEyes:" + OriginalEyes) MiscUtil.PrintConsole("OriginalHair:" + OriginalHair) MiscUtil.PrintConsole("OriginalSkin:" + OriginalSkin) MiscUtil.PrintConsole("OriginalBoots:" + OriginalBoots) MiscUtil.PrintConsole("OriginalArmor:" + OriginalArmor) MiscUtil.PrintConsole("OriginalGloves:" + OriginalGloves) ;--------------------------------------------------------------------------- Utility.Wait(1.0) If !Player.IsInFaction (Army) Utility.Wait(5.0) Player.AddToFaction(Army) Player.ModFactionRank(Army, 1) EndIf ;Add Bonuses; Player.addspell(Queen) Player.addspell(Buff) ;Jumpyness Set; MorphJumpHeight.SetValue( Game.GetGameSettingFloat("fJumpHeightMin") ) MorphJumpFall.SetValue( Game.GetGameSettingFloat("fJumpFallHeightMin") ) Game.SetGameSettingFloat("fJumpHeightMin", 250.0) Game.SetGameSettingFloat("fJumpFallHeightMin", 2000.0) ;--------------------------------------------------------------------------- ;changing the player Player.ChangeHeadPart(MorphEyes) Player.ChangeHeadPart(MorphHair) PlayerBase.SetSkin(MorphSkin) Player.QueueNiNodeUpdate() Player.AddItem(MorphGloves, 1, True) Player.AddItem(MorphOutfit, 1, True) Player.AddItem(MorphBoots, 1, True) Player.EquipItem(MorphGloves, True, True) Player.EquipItem(MorphOutfit, True, True) Player.EquipItem(MorphBoots, True, True) ;Switch On; MorphStage.SetValue(1) Else MiscUtil.PrintConsole("restoring the player") MiscUtil.PrintConsole("OriginalEyes:" + OriginalEyes) MiscUtil.PrintConsole("OriginalHair:" + OriginalHair) MiscUtil.PrintConsole("OriginalSkin:" + OriginalSkin) MiscUtil.PrintConsole("OriginalBoots:" + OriginalBoots) MiscUtil.PrintConsole("OriginalArmor:" + OriginalArmor) MiscUtil.PrintConsole("OriginalGloves:" + OriginalGloves) Utility.Wait(1.0) ;Remove bonuses; Player.removespell(Buff) ;Jumpyness Reset" Game.SetGameSettingFloat("fJumpHeightMin", MorphJumpHeight.GetValue() ) Game.SetGameSettingFloat("fJumpFallMin", MorphJumpFall.GetValue() ) ;Restore Cosmetics; ;--------------------------------------------------------------------------- PlayerBase.SetNthHeadPart(OriginalEyes, OriginalEyes_Pos) PlayerBase.SetNthHeadPart(OriginalHair, OriginalHair_Pos) PlayerBase.SetSkin(OriginalSkin) Player.QueueNiNodeUpdate() Player.UnEquipItem(MorphGloves) Player.UnEquipItem(MorphOutfit) Player.UnEquipItem(MorphBoots) Player.RemoveItem(MorphGloves, 1, True) Player.RemoveItem(MorphOutfit, 1, True) Player.RemoveItem(MorphBoots, 1, True) if OriginalBoots != None Player.EquipItem(OriginalBoots, True, True) endif if OriginalArmor != None Player.EquipItem(OriginalArmor, True, True) endif if OriginalGloves != None Player.EquipItem(OriginalGloves, True, True) endif ;--------------------------------------------------------------------------- ;Switch Off; MorphStage.SetValue(0) EndIf EndFunction Effect Script: Spoiler Scriptname MorphScript extends activemagiceffect MorphScriptMain Property MSM Auto Event OnEffectStart(Actor Target, Actor Caster) MSM.Morph() EndEvent This scripts have some properties that MUST BE FILLED in CK for make the script work. I make screenshots of this: Spoiler All the properties can be filled normally except the HeadPart because i have the same problem that you. I cant select it in the list, as you can see in the screenshoot. I not know WHY happend and can't solve it. The properties that i use for store Original data can be empy, not fill it. The only solution that i find for CORRECTLY fill the HeadPart property is use Tes5Edit. You must assign the value of NONE to the property in CK. If the property have <default> Tes5Edit not show it. Save the esp and close the CK. Open the esp with Tes5Edit. Go to the property and fill it as i make in the screenshot: Spoiler
Myst42 Posted August 3, 2018 Author Posted August 3, 2018 On 8/2/2018 at 2:12 PM, GenioMaestro said: First of all, THANKS AGAIN for all the time and trouble to write all those things. For the first time I feel like I'm reading this and it actually makes sense to me. Some of it I had already understood butit's nice to gain deeper understanding of it. So basically, quests are used to store data since magic effects are not persistent enough to make it through multiple saves/loads right? That part about declaring properties I think I got it covered already, been messing with it a lot during this ride, and yes, declaring a head part through TES5Edit worked too ? Calling the morph script from the effect script using "TheOtherScript'sName Property PropertyName Auto" syntax structure also worked. The long, main morph script compiled perfectly as well, though I had to install Papyrus Util directly in the game folder since my Mod Organizer doesnt much like the CK for scripting work, so I guess it's a requirement now. Spell now calls the effect script, which in time calls morph function from the Reference Alias script contained within the PlayerRef I created within the quest (feww... that's quite a follow up structure) Now, I'm facing a new set of issues though... Spell works at first. Potion is drank, time passes, effects are added, morph spell is added (First morph to changed) Transformation sets new eyes, armor and hairstyle since I haven't gotten to the skin texture part yet HOWEVER Spell again to de-morph (to normal) and stuff begins to go sideways -First it forgets the character had eyebrows and removes them, even though I dont remember seeing or writing any lines related to eyebrows -Second, the original non-morphed armor becomes permanent, so it can't be changed or unequipped (it can be dropped though) -Original armor pieces are also duplicate now Morph (to changed) again -On the second morph, the desired armor is not equipped at all. I'm guessing it has something to do with the "permantently equipped" status of the original gear Morph (to normal) -This time, something worse can happen like forgetting the original human eyes, and now my character is stuck on the changed eyes, or hair or both More attempts -Eventually, it becomes so broken that even the head mesh may dissapear entirely giving that creepy mouth model and eyes only look, plus one time it created a duplicate set of eyes that became visible hanging lower from the other set. So, I have no clue why it's failing when the structure is completely rational. It is in fact storing, changing and restoring as it should, at least a few times. I thought it might be the sctipt needs time, but I tested waiting like a minute before re-morphing and the issues still happened Figured an idea would be to divide the load between the scripts again Giving more stuff to do to the effect script, and have it check the morph script only for stuff that needs storage instead. Perhaps using the spell check line as the original maintenance idea was. I mean ecause a lot of the effects seemed to be working better from the effect script But I'm too tired to try that now. I'll come back later and try that to see what happens.
GenioMaestro Posted August 3, 2018 Posted August 3, 2018 Well... not worry... near all your problems are, again, MY FAIL.. SORRY... I not make the necesary test. First, the armor problem is in the lines that equip the original armor because i put "Player.EquipItem(OriginalBoots, True, True)" and must be "Player.EquipItem(OriginalBoots, FALSE, True)" Change the section to: Spoiler if OriginalBoots != None Player.EquipItem(OriginalBoots, FALSE, True) endif if OriginalArmor != None Player.EquipItem(OriginalArmor, FALSE, True) endif if OriginalGloves != None Player.EquipItem(OriginalGloves, FALSE, True) endif If the second parameter is True the armor CAN'T BE REMOVED, then must be FALSE The eye problem can be for the type of functions that i use for make it. Try this: Spoiler ;Restore Cosmetics; ;--------------------------------------------------------------------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PlayerBase.SetNthHeadPart(OriginalEyes, OriginalEyes_Pos) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PlayerBase.SetNthHeadPart(OriginalHair, OriginalHair_Pos) Player.ChangeHeadPart(OriginalEyes) Player.ChangeHeadPart(OriginalHair) PlayerBase.SetSkin(OriginalSkin) Player.QueueNiNodeUpdate() Player.UnEquipItem(MorphGloves) Player.UnEquipItem(MorphOutfit) Player.UnEquipItem(MorphBoots) Other problem can be, as you say, because the script need a lot of time and need a controler condition. If you call the script two fast times the script is still executing and can cause problems. For solve it create a bool variable, like MorphRunning and put it in true or false on each fase of the script in this way. Spoiler Armor Property OriginalSkin Auto Armor Property OriginalBoots Auto Armor Property OriginalArmor Auto Armor Property OriginalGloves Auto Bool MorphRunning = False ;--------------------------------------------------------------------------- Function Morph() if MorphRunning == False MorphRunning = True else Debug.Notification("Morph is in way... wait for see the effects...") Return endif Actor Player = Game.GetPlayer() ActorBase PlayerBase = Player.GetLeveledActorBase() Utility.Wait(0.1) When the morph fase end put MorphRunning in false and when the de-morph fase start we test the variable again: Spoiler Player.EquipItem(MorphGloves, True, True) Player.EquipItem(MorphOutfit, True, True) Player.EquipItem(MorphBoots, True, True) MorphRunning = False ;Switch On; MorphStage.SetValue(1) Else if MorphRunning == False MorphRunning = True else Debug.Notification("Morph is in way... wait for see the effects...") Return endif MiscUtil.PrintConsole("restoring the player") MiscUtil.PrintConsole("OriginalEyes:" + OriginalEyes) MiscUtil.PrintConsole("OriginalHair:" + OriginalHair) MiscUtil.PrintConsole("OriginalSkin:" + OriginalSkin) MiscUtil.PrintConsole("OriginalBoots:" + OriginalBoots) MiscUtil.PrintConsole("OriginalArmor:" + OriginalArmor) MiscUtil.PrintConsole("OriginalGloves:" + OriginalGloves) Utility.Wait(1.0) When the de-morph fase end put MorphRunning in false again: Spoiler if OriginalBoots != None Player.EquipItem(OriginalBoots, FALSE, True) endif if OriginalArmor != None Player.EquipItem(OriginalArmor, FALSE, True) endif if OriginalGloves != None Player.EquipItem(OriginalGloves, FALSE, True) endif MorphRunning = False ;--------------------------------------------------------------------------- ;Switch Off; MorphStage.SetValue(0) EndIfEndFunction For see better, my original script with the corrections is this: Spoiler Scriptname MorphScriptMain extends ReferenceAlias SPELL Property Queen Auto SPELL Property Buff Auto SPELL Property PhaseOne Auto SPELL Property PhaseTwo Auto SPELL Property PhaseTree Auto float HRANDOM Faction Property Army Auto GlobalVariable Property MorphStage auto GlobalVariable Property MorphJumpHeight Auto GlobalVariable Property MorphJumpFall Auto HeadPart Property MorphHair Auto HeadPart Property MorphEyes Auto Armor Property MorphSkin Auto Armor Property MorphGloves Auto Armor Property MorphOutfit Auto Armor Property MorphBoots Auto ;--------------------------------------------------------------------------- ;From https://www.creationkit.com/index.php?title=GetType_-_HeadPart ;Number Type ;0 Mouth ;1 Head ;2 Eyes ;3 Hair ;4 Beard ;5 Scar ;6 Brows ;Data definition for store original head parts and armors HeadPart Property OriginalEyes Auto HeadPart Property OriginalHair Auto Int OriginalEyes_Pos Int OriginalHair_Pos Armor Property OriginalSkin Auto Armor Property OriginalBoots Auto Armor Property OriginalArmor Auto Armor Property OriginalGloves Auto Bool MorphRunning = False ;--------------------------------------------------------------------------- Function Morph() if MorphRunning == False MorphRunning = True else Debug.Notification("Morph is in way... wait for see the effects...") Return endif Actor Player = Game.GetPlayer() ActorBase PlayerBase = Player.GetLeveledActorBase() Utility.Wait(0.1) if !Player.IsInFaction (Army) Debug.Notification("..., then nothing. Maybe we have to wait?") Debug.Notification("You feel all funny during the visual effect,...") Player.Addspell (PhaseOne, false) HRANDOM = Utility.RandomFloat(2,8) Utility.WaitGameTime(HRANDOM) Player.Removespell (PhaseOne) Debug.Notification("You feel funny pleasant sensations in your body.") Player.Addspell (PhaseTwo, false) HRANDOM = Utility.RandomFloat(2,8) Utility.WaitGameTime(HRANDOM) Player.Removespell (PhaseTwo) Debug.Notification("You feel ligher and ligher.") Player.Addspell (PhaseTree, false) HRANDOM = Utility.RandomFloat(2,8) Utility.WaitGameTime(HRANDOM) Player.Removespell (PhaseTree) Debug.Notification("You feel inside your body metamorphosing.") Utility.Wait(2.0) Endif ;The actual morphing spell; ;------------------------ Debug.Trace("MorphStage:" + MorphStage.GetValue() ) If MorphStage.GetValue() == 0 MiscUtil.PrintConsole("MorphStage == 0 changing the player") ;--------------------------------------------------------------------------- ;STORING ORIGINALS Int NumHeadParts = Player.GetLeveledActorBase().GetNumHeadParts() Int i = 0 While i < NumHeadParts If Player.GetLeveledActorBase().GetNthHeadPart(i).GetType() == 2 OriginalEyes = Player.GetLeveledActorBase().GetNthHeadPart(i) OriginalEyes_Pos = i EndIf If Player.GetLeveledActorBase().GetNthHeadPart(i).GetType() == 3 OriginalHair = Player.GetLeveledActorBase().GetNthHeadPart(i) OriginalHair_Pos = i EndIf i += 1 EndWhile OriginalSkin = PlayerBase.GetSkin() OriginalBoots = Player.GetWornForm(0x00000080) as Armor OriginalArmor = Player.GetWornForm(0x00000004) as Armor OriginalGloves = Player.GetWornForm(0x00000008) as Armor MiscUtil.PrintConsole("OriginalEyes:" + OriginalEyes) MiscUtil.PrintConsole("OriginalHair:" + OriginalHair) MiscUtil.PrintConsole("OriginalSkin:" + OriginalSkin) MiscUtil.PrintConsole("OriginalBoots:" + OriginalBoots) MiscUtil.PrintConsole("OriginalArmor:" + OriginalArmor) MiscUtil.PrintConsole("OriginalGloves:" + OriginalGloves) ;--------------------------------------------------------------------------- Utility.Wait(1.0) If !Player.IsInFaction (Army) Utility.Wait(5.0) Player.AddToFaction(Army) Player.ModFactionRank(Army, 1) EndIf ;Add Bonuses; Player.addspell(Queen) Player.addspell(Buff) ;Jumpyness Set; MorphJumpHeight.SetValue( Game.GetGameSettingFloat("fJumpHeightMin") ) MorphJumpFall.SetValue( Game.GetGameSettingFloat("fJumpFallHeightMin") ) Game.SetGameSettingFloat("fJumpHeightMin", 250.0) Game.SetGameSettingFloat("fJumpFallHeightMin", 2000.0) ;--------------------------------------------------------------------------- ;changing the player Player.ChangeHeadPart(MorphEyes) Player.ChangeHeadPart(MorphHair) PlayerBase.SetSkin(MorphSkin) Player.QueueNiNodeUpdate() Player.AddItem(MorphGloves, 1, True) Player.AddItem(MorphOutfit, 1, True) Player.AddItem(MorphBoots, 1, True) Player.EquipItem(MorphGloves, True, True) Player.EquipItem(MorphOutfit, True, True) Player.EquipItem(MorphBoots, True, True) MorphRunning = False ;Switch On; MorphStage.SetValue(1) Else if MorphRunning == False MorphRunning = True else Debug.Notification("Morph is in way... wait for see the effects...") Return endif MiscUtil.PrintConsole("restoring the player") MiscUtil.PrintConsole("OriginalEyes:" + OriginalEyes) MiscUtil.PrintConsole("OriginalHair:" + OriginalHair) MiscUtil.PrintConsole("OriginalSkin:" + OriginalSkin) MiscUtil.PrintConsole("OriginalBoots:" + OriginalBoots) MiscUtil.PrintConsole("OriginalArmor:" + OriginalArmor) MiscUtil.PrintConsole("OriginalGloves:" + OriginalGloves) Utility.Wait(1.0) ;Remove bonuses; Player.removespell(Buff) ;Jumpyness Reset" Game.SetGameSettingFloat("fJumpHeightMin", MorphJumpHeight.GetValue() ) Game.SetGameSettingFloat("fJumpFallMin", MorphJumpFall.GetValue() ) ;Restore Cosmetics; ;--------------------------------------------------------------------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PlayerBase.SetNthHeadPart(OriginalEyes, OriginalEyes_Pos) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PlayerBase.SetNthHeadPart(OriginalHair, OriginalHair_Pos) Player.ChangeHeadPart(OriginalEyes) Player.ChangeHeadPart(OriginalHair) PlayerBase.SetSkin(OriginalSkin) Player.QueueNiNodeUpdate() Player.UnEquipItem(MorphGloves) Player.UnEquipItem(MorphOutfit) Player.UnEquipItem(MorphBoots) Player.RemoveItem(MorphGloves, 1, True) Player.RemoveItem(MorphOutfit, 1, True) Player.RemoveItem(MorphBoots, 1, True) if OriginalBoots != None Player.EquipItem(OriginalBoots, FALSE, True) endif if OriginalArmor != None Player.EquipItem(OriginalArmor, FALSE, True) endif if OriginalGloves != None Player.EquipItem(OriginalGloves, FALSE, True) endif MorphRunning = False ;--------------------------------------------------------------------------- ;Switch Off; MorphStage.SetValue(0) EndIf EndFunction Test the changes and tell me if work as intended. The armors problem must dissapear and the script is protected about running again while the morph process is already running. If the problems with eyebrows and the duplicate eyes persist, can be a a problem of type of eyes. Maybe you make a NEW eyes ussing a incorrect race on origin, orc for example, and when put the eyes in other race, a imperial for example, the game have problems. Verify it. EDIT1: I have problems for recompile the new script and appear is for color format. Sorry. EDIT2: I remove the colors in the last spoiler. Get the code from it if you have problems.
GenioMaestro Posted August 4, 2018 Posted August 4, 2018 Make some test more and locate a problem. The MorphRunning switch must not be checked in each step of the transformation. If made, lock the second step and the de-morph process is not made. The firts step is good when start the function as is un-modified as: Spoiler Armor Property OriginalSkin Auto Armor Property OriginalBoots Auto Armor Property OriginalArmor Auto Armor Property OriginalGloves Auto Bool MorphRunning = False ;--------------------------------------------------------------------------- Function Morph() if MorphRunning == False MorphRunning = True else Debug.Notification("Morph is in way... wait for see the effects...") Return endif Actor Player = Game.GetPlayer() ActorBase PlayerBase = Player.GetLeveledActorBase() Utility.Wait(0.1) But not must be chequed when make the de-morh: Spoiler Player.EquipItem(MorphGloves, True, True) Player.EquipItem(MorphOutfit, True, True) Player.EquipItem(MorphBoots, True, True) ;BAD MorphRunning = False ;Switch On; MorphStage.SetValue(1) Else ;BAD if MorphRunning == False ;BAD MorphRunning = True;BAD else ;BAD Debug.Notification("Morph is in way... wait for see the effects...") ;BAD Return ;BAD endif MiscUtil.PrintConsole("restoring the player") MiscUtil.PrintConsole("OriginalEyes:" + OriginalEyes) MiscUtil.PrintConsole("OriginalHair:" + OriginalHair) MiscUtil.PrintConsole("OriginalSkin:" + OriginalSkin) MiscUtil.PrintConsole("OriginalBoots:" + OriginalBoots) MiscUtil.PrintConsole("OriginalArmor:" + OriginalArmor) MiscUtil.PrintConsole("OriginalGloves:" + OriginalGloves) Utility.Wait(1.0) Only need reset the MorphRunning switch at the end of the function as: Spoiler if OriginalBoots != None Player.EquipItem(OriginalBoots, FALSE, True) endif if OriginalArmor != None Player.EquipItem(OriginalArmor, FALSE, True) endif if OriginalGloves != None Player.EquipItem(OriginalGloves, FALSE, True) endif ;BAD MorphRunning = False ;--------------------------------------------------------------------------- ;Switch Off; MorphStage.SetValue(0) EndIf MorphRunning = False EndFunction Sorry again, but for want give a fast answer i give a BAD answer. Really SORRY.
Myst42 Posted August 4, 2018 Author Posted August 4, 2018 17 hours ago, GenioMaestro said: (...) Lol, I was just about to write since I tested these last changes The absolutely EXCELLENT part is that apparently it finally works in a stable way now. (I have no words to express how good this feels) Game is not broken anymore, eyebrows and head dont dissapear and the outfit swap is handled correctly I used all the extra lines about Morph Running, and as you already knew, it failed completely since the de-morph no longer worked. After retiring them, tested again and that was the first time it worked near perfection. Added the corrections from your last post and now, I'm not sure if they do anything since I saw no messages (Maybe I didn't hit the spell button fast enough to catch the spell on script still running though - Which in theory would be better than good because it wouldn't be a heavy scripting delay issue, I guess) Minor Bugs: -The eyes sometimes still may disappear, either on morp or de-morph stage. Switching back and forth 1 or 2 times seems to fix them though. Not sure if this is even fixable, since even the Succubus mod had some anomalies like that when I tested it. (Saw character switch to potato face model a few times when that option was enabled, switching back and forth also fixed it) -Jumping variables (game settings) are still stubborn and refuse to be reversed or changed between saves. I have an idea for that, but not much faith in it though. EDIT1: HELL YEAH!! Jumping variables storage works now. Added the original "failsafe" code lines for it, and now the changes seem to be working, and be preserved through loading. These, Btw Spoiler Event OnPlayerLoadGame() If Game.GetPlayer().HasSpell(BuffSpells) MorphStage.SetValue (1) Game.SetGameSettingFloat("fJumpHeightMin", 250.0) Game.SetGameSettingFloat("fJumpFallHeightMin", 2000.0) Else MorphStage.SetValue (0) Game.SetGameSettingFloat("fJumpHeightMin", MorphJumpHeight.GetValue() ) Game.SetGameSettingFloat("fJumpFallMin", MorphJumpFall.GetValue() ) EndIf EndEvent Concerns: -My last concern is about the skin property. On the original long script you gave me, skin is declared as an Armor property, but I wanted to switch the entire skinset of the player, meaning face, body and hands as a Texture Set ID. (So that it looks like another race, but really isn't). I'm gonna give it a go and see what I can do... EDIT2: Skin change is also working now. But I'm still not sure how to change the head texture. A "naked skin" can be used by a race but I dont remember those working with head parts such as a head. I was hoping to avoid changing the head model for it, I only want the skin texture change. But i've seen it before. On Dynamic Vampire Appearance mod in example. I'll se what else I can find about it... EDIT3: And now I got a perfect example of why the CK Wiki cconfuses me. I know I'm being a total noob here, but I searched, and the function is listed among SKSE stuff, and for some reason, it's a lie. I though it could be because that function list is for the ActorBase Script, but it's still the same list that contains other functions that are already working in the script, such as "PlayerBase.SetSkin(OriginalSkin)" which looks similar to " SetSkin(Armor skin)" Spoiler ---------------------- I think that's it for now. Oh and btw, I feel compelled to mention if you wanted to speak Spanish to explain something better, I can understand. Using English cause English spoken forum...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.