Guest WildWyrd Posted January 2, 2013 Posted January 2, 2013 The idea is the player does a continual cast spell that causes lost souls to be ripped from the world and placed into soulgems in the inventory of the caster. When I try to add this script to the spell effect ck crashes. Ive tried multiple edits but the fact remains is Im not a scripter I get the basic idea of it, but mostly I copy and paste parts of scripts and hope for the best, I have to say this method worked better in oblivion. ScriptName SOULREAPER EVENT OnEffectStart(Actor akTarget, Actor akCaster) objectReference caster = akCaster if caster.GetItemCount(SoulGemPetty) >= 1) caster.AddItem(SoulGemPettyFilled, 1) caster.RemoveItem(SoulGemPetty, 1) Debug.Trace ("You have reaped a soul") ElseIf caster.GetItemCount(SoulGemLesser) >= 1) caster.AddItem.AddItem(SoulGemLesserFilled, 1) caster.RemoveItem(SoulGemLesser, 1) Debug.Trace("You have reaped a soul") ElseIf caster.GetItemCount(SoulGemCommon) >= 1) caster.AddItem (SoulGemCommonFilled, 1) caster.RemoveItem(SoulGemCommon, 1) Debug.Trace("You have reaped a soul") ElseIf caster.GetItemCount(SoulGemGreater) >= 1) caster.AddItem(SoulGemGreaterFilled, 1) caster.RemoveItem(SoulGemGreater, 1) Debug.Trace("You have reaped a soul") ElseIf caster.GetItemCount(SoulGemGrand) >= 1) caster.AddItem(SoulGemGrandFilled, 1) caster.RemoveItem(SoulGemGrand, 1) Debug.Trace("You have reaped a soul") else Debug.Trace("You cannot reap any more souls") Endif endEVENT Any help would be greatly appreciated thanks
ChancellorKremlin Posted January 2, 2013 Posted January 2, 2013 Yes? Did someone call my name? I don't know Wildwyrd, I don't know what you're doing wrong
gerra6 Posted January 3, 2013 Posted January 3, 2013 Well, I know nothing about Skyrim scripting, unfortunately. However, crashes on compile could result from attempting to use SKSE functions with a construction set that wasn't loaded using the SKSE loader (however that works in Skyrim). If that's not the problem, then I would recommend trying the painful agony of stepwise debugging. First, remove everything from your script except the bare minimum required to get it to save. Save it and ensure that you can save and reopen the esp. Next, add a minimal function, say ScriptName SOULREAPER EVENT OnEffectStart(Actor akTarget, Actor akCaster) objectReference caster = akCaster print caster endEVENT or something like that. And then just build from there in tiny pieces until you figure out which function call/statement is causing the crash. I recommend adding lots of print debug messages to report the state of any variables as you go, just so that you can be certain that the script is doing what you think it should be doing. Just remember to disable the debug console spam in your release version. Oblivion/Fallout (and I assume Skyrim) coding can be so unpredictably buggy that this sort of boring iterative coding is sometimes the only way to track down these sorts of nasty crashes...assuming that the code itself is clean (which I can't tell...I just don't know Skyrim coding at all, sorry).
DoctaSax Posted January 3, 2013 Posted January 3, 2013 Haven't looked into Skyrim scripting at all, so no promises, but you do seem to have more closing parentheses than you're opening in your if-statements. Unless that's normal in skyrim maybe that should be cleaned up? Could be that, or not. Otherwise, gerra's advice to break it up is solid.
astymma Posted January 3, 2013 Posted January 3, 2013 Haven't looked into Skyrim scripting at all' date=' so no promises, but you do seem to have more closing parentheses than you're opening in your if-statements. Unless that's normal in skyrim maybe that should be cleaned up? Could be that, or not. Otherwise, gerra's advice to break it up is solid. [/quote'] That's definitely the problem... all your if/endif statements have an additional closing parenthesis: if caster.GetItemCount(SoulGemPetty) >= 1) should be if caster.GetItemCount(SoulGemPetty) >= 1 or if (caster.GetItemCount(SoulGemPetty) >= 1)
Guest WildWyrd Posted January 3, 2013 Posted January 3, 2013 Haven't looked into Skyrim scripting at all' date=' so no promises, but you do seem to have more closing parentheses than you're opening in your if-statements. Unless that's normal in skyrim maybe that should be cleaned up? Could be that, or not. Otherwise, gerra's advice to break it up is solid. [/quote'] That's definitely the problem... all your if/endif statements have an additional closing parenthesis: if caster.GetItemCount(SoulGemPetty) >= 1) should be if caster.GetItemCount(SoulGemPetty) >= 1 or if (caster.GetItemCount(SoulGemPetty) >= 1) Ah I see, thank-you, I will definitely fix that tomorrow and post the results, for now its bed time lol. still crashes, heres the revised script ScriptName SOULREAPER EVENT OnEffectStart(Actor akTarget, Actor akCaster) objectReference caster = akCaster if caster.GetItemCount(SoulGemPetty) >= 1 caster.AddItem(SoulGemPettyFilled, 1) caster.RemoveItem(SoulGemPetty, 1) Debug.Trace("You have reaped a soul") ElseIf caster.GetItemCount(SoulGemLesser) >= 1 caster.AddItem.AddItem(SoulGemLesserFilled, 1) caster.RemoveItem(SoulGemLesser, 1) Debug.Trace("You have reaped a soul") ElseIf caster.GetItemCount(SoulGemCommon) >= 1 caster.AddItem (SoulGemCommonFilled, 1) caster.RemoveItem(SoulGemCommon, 1) Debug.Trace("You have reaped a soul") ElseIf caster.GetItemCount(SoulGemGreater) >= 1 caster.AddItem(SoulGemGreaterFilled, 1) caster.RemoveItem(SoulGemGreater, 1) Debug.Trace("You have reaped a soul") ElseIf caster.GetItemCount(SoulGemGrand) >= 1 caster.AddItem(SoulGemGrandFilled, 1) caster.RemoveItem(SoulGemGrand, 1) Debug.Trace("You have reaped a soul") else Debug.Trace("You cannot reap any more souls") Endif endEVENT
astymma Posted January 7, 2013 Posted January 7, 2013 I wouldn't downcast an Actor to an ObjectReference in that script... just leave caster as an Actor instead. I doubt it would cause problems but it's more work for the script engine to do that isn't necessary. Actor extends ObjectReference and contains all it's member functions and properties. TBH, I don't know why you're copying an existing Actor to begin with as you don't seem to be using "caster" anywhere but in this event. You could simply use akCaster and not force a copy of memory unnecessarily. Other than that, I don't see anything syntactically wrong with your script.
Guest WildWyrd Posted January 8, 2013 Posted January 8, 2013 I wouldn't downcast an Actor to an ObjectReference in that script... just leave caster as an Actor instead. I doubt it would cause problems but it's more work for the script engine to do that isn't necessary. Actor extends ObjectReference and contains all it's member functions and properties. TBH' date=' I don't know why you're copying an existing Actor to begin with as you don't seem to be using "caster" anywhere but in this event. You could simply use akCaster and not force a copy of memory unnecessarily. Other than that, I don't see anything syntactically wrong with your script. [/quote'] thanks for your help do you mean like this, still crashes btw ScriptName SOULREAPER EVENT OnEffectStart if akcaster.GetItemCount(SoulGemPetty) >= 1 akcaster.AddItem(SoulGemPettyFilled, 1, false) akcaster.RemoveItem(SoulGemPetty, 1, true) Debug.Trace("You have reaped a soul") ElseIf akcaster.GetItemCount(SoulGemLesser) >= 1 akcaster.AddItem.AddItem(SoulGemLesserFilled, 1, false) akcaster.RemoveItem(SoulGemLesser, 1, true) Debug.Trace("You have reaped a soul") ElseIf akcaster.GetItemCount(SoulGemCommon) >= 1 akcaster.AddItem (SoulGemCommonFilled, 1, false) akcaster.RemoveItem(SoulGemCommon, 1, true) Debug.Trace("You have reaped a soul") ElseIf akcaster.GetItemCount(SoulGemGreater) >= 1 akcaster.AddItem(SoulGemGreaterFilled, 1, false) akcaster.RemoveItem(SoulGemGreater, 1, true) Debug.Trace("You have reaped a soul") ElseIf akcaster.GetItemCount(SoulGemGrand) >= 1 akcaster.AddItem(SoulGemGrandFilled, 1, false) akcaster.RemoveItem(SoulGemGrand, 1, true) Debug.Trace("You have reaped a soul") else Debug.Trace("You cannot reap any more souls") Endif endEVENT
astymma Posted January 8, 2013 Posted January 8, 2013 Yes, with the original event line as: EVENT OnEffectStart(Actor akTarget, Actor akCaster) and using akCaster and not akcaster ... but I'm assuming you meant that.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.