Jump to content

Extremely basic scripting question


Recommended Posts

I did some Oblivion modding years ago, and I've decided to try my hand at Skyrim modding and I think there's something I am fundamentally not getting about papyrus's syntax.

This is a quest script.

Scriptname vtes_q_main_script extends Quest  

Potion Property testpotion Auto

Game.GetPlayer().AddItem(testpotion)

I get the following errors when I compile:

Starting 1 compile threads for 1 files...
Compiling "vtes_q_main_script"...
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\vtes_q_main_script.psc(5,4): no viable alternative at input '.'
No output generated for vtes_q_main_script, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on vtes_q_main_script

I've checked the creation kit wiki and tried googling the error and I just can't see what I"m doing wrong.

Link to comment
Share on other sites

Script language Papyrus is using standard events depends on script type, that means events will trigger automatically. You can build your own functions and call that inside such events.

Maybe next code is helpful to understand papyrus a bit more.

Scriptname vtes_q_main_script extends Quest 

  Potion Property testpotion Auto  ; fill this with any potion you like by CreationKit

; -- EVENTs --

EVENT OnInit()
    myF_Add()
ENDEVENT

; -- FUNCTIONs -- 

;-----------------
FUNCTION myF_Add()
;-----------------
    Game.GetPlayer().AddItem(testpotion)
ENDFUNCTION

Keep in mind: All scripts share the same folder (source for psc-files and scripts for pex-files) within the standard data folder.

That means your script name has to be unique enough so that he doesn't clash with other vanilla or mod added scripts.

Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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