Jump to content

Scripting Troubles in Creation Kit


AmplSi

Recommended Posts

So I've been having some troubles getting a script to work right. The script I am trying to get working is one that adds a perk to the player when a weapon is equipped, and then removed when unequipped. Here is the code and the compiling output:

 

Script:

 

Event OnEquipped(Actor akActor)
if akActor == Game.GetPlayer()
akActor.AddPerk(EmeraldPerk)
debug.notification("Emerald Ward added")
endIf
endEvent

Event OnUnequipped(Actor akActor)
if akActor == Game.GetPlayer()
akActor.RemovePerk(EmeraldPerk)
debug.notification("Emerald Ward removed")
endIf
endEvent

Perk Property EmeraldPerk = 04000d6a

 

 

Output:

 

<unknown>(0,0): Unable to find flags file: TESV_Papyrus_Flags.flg
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\emeraldperkscript.psc(17,33): extraneous input 'd6a' expecting AUTO

 

04000d6a is the perk id. I do not know why this is giving me an error. If anyone has any experience with this, please let me know what I might be doing wrong. Thanks

 

 

 

 

Link to comment
Share on other sites

So I've been having some troubles getting a script to work right. The script I am trying to get working is one that adds a perk to the player when a weapon is equipped, and then removed when unequipped. Here is the code and the compiling output:

 

Script:

 

Event OnEquipped(Actor akActor)

if akActor == Game.GetPlayer()

akActor.AddPerk(EmeraldPerk)

debug.notification("Emerald Ward added")

endIf

endEvent

 

Event OnUnequipped(Actor akActor)

if akActor == Game.GetPlayer()

akActor.RemovePerk(EmeraldPerk)

debug.notification("Emerald Ward removed")

endIf

endEvent

 

Perk Property EmeraldPerk = 04000d6a

 

 

Output:

 

<unknown>(0,0): Unable to find flags file: TESV_Papyrus_Flags.flg

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\emeraldperkscript.psc(17,33): extraneous input 'd6a' expecting AUTO

 

04000d6a is the perk id. I do not know why this is giving me an error. If anyone has any experience with this, please let me know what I might be doing wrong. Thanks

Not sure about the script itself but your compiling error is most likely the fact that when the CK was updated the vanilla scripts and Papyrus Flags were delivered in an archive file scripts.rar. Look for that file in your Skyrim Data folder. Extract the files and drop them into your Data/Scripts folder. You should then be able to compile the scripts.

Link to comment
Share on other sites

Greetings Aragorn,

 

I think you're partially right regarding the Scripts.rar file. Just in case, that is the case, I am also going to list the other place that I found works just as a back up plan if the place you suggested happens to not work and the Script.rar thing is the issue...

 

Skyrim \ Data \ Scripts.rar

 

Extract to

 

Skyrim => Data => Scripts => Source Folder

Link to comment
Share on other sites

Greetings Aragorn,

 

I think you're partially right regarding the Scripts.rar file. Just in case, that is the case, I am also going to list the other place that I found works just as a back up plan if the place you suggested happens to not work and the Script.rar thing is the issue...

 

Skyrim \ Data \ Scripts.rar

 

Extract to

 

Skyrim => Data => Scripts => Source Folder

You are correct also. It all depends on how far you go into the archive to find the individual folders. Either method reaches the same ends.

Edited by Aragorn58
Link to comment
Share on other sites

I have copied the script assets from the .rar to the folder, just merging the two "scripts" folders. This seems to have fixed the error with the "unable to find flag," but the other, which regards the "d6a" at the end of the perk ID, still persists.

Link to comment
Share on other sites

When you assign your Perk property use:

Scriptname EmeraldPerkScript Extends ObjectReference

;Fill the property in CK after you attach the script to your object.
Perk Property EmeraldPerk Auto

Event OnEquipped(Actor akActor)
    if akActor == Game.GetPlayer()
        akActor.AddPerk(EmeraldPerk)
        debug.notification("Emerald Ward added")
    endIf
endEvent

Event OnUnequipped(Actor akActor)
    if akActor == Game.GetPlayer()
        akActor.RemovePerk(EmeraldPerk)
        debug.notification("Emerald Ward removed")
    endIf
endEvent

After you have compiled your script and and attached it to your object then you can set the property by clicking the property button and select the perk that you want the property to use.
You can't assign the property with 04XXXXXX the way your doing it.

 

If the EmeraldPerk is in a different mod to your mod and you would don't want to include the other mod in your mod, but would like to access the perk if the other mod is loaded then you could use something like this:

(have not tested this myself though)

Scriptname EmeraldPerkScript Extends ObjectReference

Perk EmeraldPerk

Event OnInt()
    ;"EmeraldPerkkModName.esp" would be the whatever name the esp that contains the perk.
    If Game.GetModByName("EmeraldPerkkModName.esp") != 255
        ;Since your getting the perk form directly from the esp then you don't need the 0x04
        EmeraldPerk = Game.GetFormFromFile(0x00000D6A, "EmeraldPerkkModName.esp") As Perk
    Else
        EmeraldPerk = none
    EndIf
EndEvent

Event OnEquipped(Actor akActor)
    if (akActor == Game.GetPlayer()) && EmeraldPerk
        akActor.AddPerk(EmeraldPerk)
        debug.notification("Emerald Ward added")
    endIf
endEvent

Event OnUnequipped(Actor akActor)
    if (akActor == Game.GetPlayer()) && EmeraldPerk
        akActor.RemovePerk(EmeraldPerk)
        debug.notification("Emerald Ward removed")
    endIf
endEvent
Link to comment
Share on other sites

When I moved at line to the top, changed it to AUTO from the perk ID, and set it in the properties, it seemed to get rid of the rest of the errors! I will try it out in-game shortly. Thank you for your help, everyone!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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