Jump to content

Scripting Issue


OldBrunny

Recommended Posts

While I've done a lot of scripting in Oblivion, I've managed to avoid it for Skyrim so far. But I wanted to create a simple activator to charge any soul gems in the players inventory. After a lot of reading of the tutorials I came up with the following script. Which as a newby to Papyrus looks OK to me, but it will not compile.
Can somebody please point out what I've done wrong...

 

ScriptName SJBChargeSoulGems Extends ObjectReference

 

Formlist Property EmptySG Auto

Formlist Property FilledSG Auto

Form e

Form f

 

Event OnActivate(ObjectReference akActionRef)

Int n

Int i = 6

While (i)

i -= 1

e = EmptySG.GetAt(i)

n = Game.GetPlayer().GetItemCount(e)

If (n)

f = FilledSG.GetAt(i)

Game.GetPlayer().RemoveItem(e, n, true)

Game.GetPlayer().AddItem(f, n, true)

EndIf

EndWhile

EndEvent

 

 

I've attached the compiler failure output for info:

 

Thanks

OldBrunny

 

Link to comment
Share on other sites

First off, since the latest patch to the Creation Kit the source files (PSC) are inside of a scripts.rar file in your Data folder. The CK needs access to these files in order to compile scripts. Simply extract the scripts.rar folder right where it is.

 

Beyond that, I see some issues with your script.

 

  Reveal hidden contents

 

Link to comment
Share on other sites

Thank you.

I did have the check in for player being the activator but kept getting an error that I could not cast an Object Ref as an Actor, so took it out...
Anyway the issue was the lack of the full source scripts. Extracted as you suggested, and then extracted the SKSE scripts again...
It compiled....

Link to comment
Share on other sites

  • Recently Browsing   0 members

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