Jump to content

[LE] Need Scripting help.


Recommended Posts

Ok. It's working. Ok. New Problem, every time I try to copy and past the Store Size Script, then compile it, the Creation Kit crashes. (I had to delete the script, now I'm trying to recreate it.) Also the script is in the quote below. I've added the the part at the top for your convience. If anyone comes up with a revised version of the script, please let me know. All I did was take Absorb Size and remove a few lines.

 

Store Size is designed to drain the targets size and "store" it into you. it increases your infamy only. It still makse the target shrink.

 

vmmStoreSize extends Active Magic Effect

 

int Casting = 0

float Change = 0.0
Spell Property NPCEffect Auto
Event OnEffectStart(Actor Target, Actor Caster)
If Target.GetAv("Infamy") == 0.00
Target.SetAV("Infamy", 1)
EndIf
If Target.GetAv("Fame") == 0.00
Target.SetAV("Fame", 1)
EndIf
If Caster.GetAv("Infamy") == 0.00
Caster.SetAV("Infamy", 1)
EndIf
If Caster.GetAv("Fame") == 0.00
Caster.SetAV("Fame", 1)
EndIf
While Casting == 0
If Target.IsDead() == 0
Change = Caster.GetAV("Alteration") * 0.001 / ((Target.GetAV("MagicResist")/10) + 1)
Target.AddSpell(NPCEffect)
Target.ModAV("Fame", -Change)
Target.ModAV("Infamy", -Change)
If Target.GetAV("Fame") < 0.25
Target.Kill(Caster)
Caster.SetAV("Health", Caster.GetBaseAV("Health") + ((Target.GetBaseAV("Health") / (Target.GetAV("MagicResist") + 1)) / 100))
Caster.SetAV("Magicka", Caster.GetBaseAV("Magicka") + ((Target.GetBaseAV("Health") / (Target.GetAV("MagicResist") + 1)) / 100))
Caster.SetAV("Stamina", Caster.GetBaseAV("Stamina") + ((Target.GetBaseAV("Health") / (Target.GetAV("MagicResist") + 1)) / 100))
Caster.SetAV("CarryWeight", Caster.GetBaseAV("CarryWeight") + ((Target.GetBaseAV("Health") / (Target.GetAV("MagicResist") + 1)) / 100))
Caster.SetAV("UnarmedDamage", Caster.GetBaseAV("UnarmedDamage") + ((Target.GetBaseAV("Health") / (Target.GetAV("MagicResist") + 1)) / 100))
Caster.SetAV("MeleeDamage", Caster.GetBaseAV("MeleeDamage") + ((Target.GetBaseAV("Health") / (Target.GetAV("MagicResist") + 1)) / 100))
Target.ForceAV("Fame", 0.25)
Target.ForceAV("Infamy", 0.25)
EndIf
NetImmerse.SetNodeScale(Target, "NPC", Target.GetAV("Fame"), false)
NetImmerse.SetNodeScale(Target, "NPC", Target.GetAV("Fame"), true)
Caster.ModAV("Fame", Change)
Caster.ModAV("Infamy", Change)
NetImmerse.SetNodeScale(Caster, "NPC", Caster.GetAV("Fame"), false)
NetImmerse.SetNodeScale(Caster, "NPC", Caster.GetAV("Fame"), true)
EndIf
Utility.Wait(0.4)
EndWhile
EndEvent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
Casting = 1

 

The script is loosely based off absorb size, but it Isn't supposed to make the player grow. Also It didn't work before because I had compiling errors. Which I still do. What do I need to fix the compile error?

Edited by Spasticon1
Link to comment
Share on other sites

Scriptname is missing.

 

You have an event that is not fully declared.

 

And I feel like your loop can potentially loop forever, this is not good.

 

This is also a pretty slow script, considering the constant calling of actorvalues inside a long running loop.

 

So at the top of the OnEffectStart Event, do this:

 

Float casterBaseHealth = Caster.GetBaseActorValue("health")
Float casterBaseMagicka = Caster.GetBaseActorValue("Magicka")
Float casterBaseStamina = Caster.GetBaseActorValue("Stamina")
Float casterBaseCarryWt = Caster.GetBaseActorValue("CarryWeight")
Float casterBaseUnarmed = Caster.GetBaseActorValue("UnarmedDamage")
Float casterBaseMeleeDmg = Caster.GetBaseActorValue("MeleeDamage")
Float targetBaseHealth = Target.GetBaseActorValue("health")
Float targetBaseMagicResist = Target.GetBaseActorValue("MagicResist")
Float targetMagicResist = Target.GetActorValue("MagicResist")
replace this:

Caster.SetAV("Health", Caster.GetBaseAV("Health") + ((Target.GetBaseAV("Health") / (Target.GetAV("MagicResist") + 1)) / 100))
Caster.SetAV("Magicka", Caster.GetBaseAV("Magicka") + ((Target.GetBaseAV("Health") / (Target.GetAV("MagicResist") + 1)) / 100))
Caster.SetAV("Stamina", Caster.GetBaseAV("Stamina") + ((Target.GetBaseAV("Health") / (Target.GetAV("MagicResist") + 1)) / 100))
Caster.SetAV("CarryWeight", Caster.GetBaseAV("CarryWeight") + ((Target.GetBaseAV("Health") / (Target.GetAV("MagicResist") + 1)) / 100))
Caster.SetAV("UnarmedDamage", Caster.GetBaseAV("UnarmedDamage") + ((Target.GetBaseAV("Health") / (Target.GetAV("MagicResist") + 1)) / 100))
Caster.SetAV("MeleeDamage", Caster.GetBaseAV("MeleeDamage") + ((Target.GetBaseAV("Health") / (Target.GetAV("MagicResist") + 1)) / 100))
with this:

Caster.SetAV("Health", casterBaseHealth + ((targetBaseHealth / (targetMagicResist + 1)) / 100))
Caster.SetAV("Magicka", casterBaseMagicka + ((targetBaseHealth / (targetMagicResist + 1)) / 100))
Caster.SetAV("Stamina", casterBaseStamina + ((targetBaseHealth / (targetMagicResist + 1)) / 100))
Caster.SetAV("CarryWeight", casterBaseCarryWt + ((targetBaseHealth / (targetMagicResist + 1)) / 100))
Caster.SetAV("UnarmedDamage", casterBaseUnarmed + ((targetBaseHealth / (targetMagicResist + 1)) / 100))
Caster.SetAV("MeleeDamage", casterBaseMeleeDmg + ((targetBaseHealth / (targetMagicResist + 1)) / 100))
I fixed a few things I saw(made a generic scriptname and removed the oneffectfinish bit that wasn't finished) and ran your script through the compiler and got no errors :o. Edited by Rasikko
Link to comment
Share on other sites

Ok I did the changes. (I have the script on a txt file) I'm going to try compiling it again. I also removed the end reference to the casters fame and setnodescale. Did I do it right? I ask because all I want is for the casters Infamy to increase.

 

 

int Casting = 0

float Change = 0.0
Spell Property NPCEffect Auto
Event OnEffectStart(Actor Target, Actor Caster)
Float casterBaseHealth = Caster.GetBaseActorValue("health")
Float casterBaseMagicka = Caster.GetBaseActorValue("Magicka")
Float casterBaseStamina = Caster.GetBaseActorValue("Stamina")
Float casterBaseCarryWt = Caster.GetBaseActorValue("CarryWeight")
Float casterBaseUnarmed = Caster.GetBaseActorValue("UnarmedDamage")
Float casterBaseMeleeDmg = Caster.GetBaseActorValue("MeleeDamage")
Float targetBaseHealth = Target.GetBaseActorValue("health")
Float targetBaseMagicResist = Target.GetBaseActorValue("MagicResist")
Float targetMagicResist = Target.GetActorValue("MagicResist")
If Target.GetAv("Infamy") == 0.00
Target.SetAV("Infamy", 1)
EndIf
If Target.GetAv("Fame") == 0.00
Target.SetAV("Fame", 1)
EndIf
If Caster.GetAv("Infamy") == 0.00
Caster.SetAV("Infamy", 1)
EndIf
If Caster.GetAv("Fame") == 0.00
Caster.SetAV("Fame", 1)
EndIf
While Casting == 0
If Target.IsDead() == 0
Change = Caster.GetAV("Alteration") * 0.001 / ((Target.GetAV("MagicResist")/10) + 1)
Target.AddSpell(NPCEffect)
Target.ModAV("Fame", -Change)
Target.ModAV("Infamy", -Change)
If Target.GetAV("Fame") < 0.25
Target.Kill(Caster)
Caster.SetAV("Health", casterBaseHealth + ((targetBaseHealth / (targetMagicResist + 1)) / 100))
Caster.SetAV("Magicka", casterBaseMagicka + ((targetBaseHealth / (targetMagicResist + 1)) / 100))
Caster.SetAV("Stamina", casterBaseStamina + ((targetBaseHealth / (targetMagicResist + 1)) / 100))
Caster.SetAV("CarryWeight", casterBaseCarryWt + ((targetBaseHealth / (targetMagicResist + 1)) / 100))
Caster.SetAV("UnarmedDamage", casterBaseUnarmed + ((targetBaseHealth / (targetMagicResist + 1)) / 100))
Caster.SetAV("MeleeDamage", casterBaseMeleeDmg + ((targetBaseHealth / (targetMagicResist + 1)) / 100))
Target.ForceAV("Fame", 0.25)
Target.ForceAV("Infamy", 0.25)
EndIf
NetImmerse.SetNodeScale(Target, "NPC", Target.GetAV("Fame"), false)
NetImmerse.SetNodeScale(Target, "NPC", Target.GetAV("Fame"), true)
Caster.ModAV("Infamy", Change)
EndIf
Utility.Wait(0.4)
EndWhile
EndEvent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
Casting = 1

 

It's probably a redundant question because I probably find out anyway. I'm just checking.

Link to comment
Share on other sites

Okay. Here's a script for a spell. It's part of a new form of Macromancy spells called "Dark Macromancy." (Dark Macromancy is a Restoration based form of size altering magic.) I was hoping for a bit of advice.

 

 

 

Scriptname vmmEnlargement extends ActiveMagicEffect

{int Casting = 0Event OnEffectStart(Actor Target, Actor Caster)        If Target.GetAV("Infamy") == 0.00        Target.SetAV("Infamy", 1)    EndIf    If Caster.GetAV("Fame") == 0.00        Target.SetAV("Fame", 1)    EndIf        While Casting == 0          If Target.GetAV("Fame") < Caster.GetAV("Infamy")            Target.Modav("Infamy", 0.05)            Target.ModAV("Fame", 0.05)            If Target.GetAV("Fame") > Target.GetAV("Infamy")                Target.SetAV("Fame", Target.GetAV("Infamy"))            EndIf            NetImmerse.SetNodeScale(Caster, "NPC", Caster.GetAV("Fame"), false)            NetImmerse.SetNodeScale(Caster, "NPC", Caster.GetAV("Fame"), true)            EndIf            If Target.GetAV("Fame") > 4.56                Target.Kill(Caster)        EndIf    Utility.Wait(0.4)    EndWhileEndEventEvent OnEffectFinish(Actor akTarget, Actor akCaster)    Casting = 1EndEvent}

 

Okay. My goal for Dark Macromancy spells is to make them use SetScale, and I want them to just alter size. I don't want Dark Macromancy to use the standard Fame and Infamy that the rest of the spells do. The idea is to sort of reincorporate the functionality of the original Macromancy's spells, but with a twist. The twist is that if you get to big or to small while using Dark Macromancy spells, you die. Why? Well, it's to balance out the fact that these spells are easier to use, and unlike standard Macromancy which alters your size, Dark Macromancy changes your size.

 

Any advice?

Edited by Spasticon1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...