How to get Script run?

Post » Tue Jun 19, 2012 5:53 am

hi there,

i am abolute new to modding in skyrim but not to programming so i tried to modify some scripts ;)

now what do i have to do to get them run into scyrim?
I already read some pages about papyrus in the creation kit wiki but
I cant find a "How to" or something like that :(
User avatar
Jordan Fletcher
 
Posts: 3355
Joined: Tue Oct 16, 2007 5:27 am

Post » Tue Jun 19, 2012 6:42 pm

You can run the script across quest or dialogue
User avatar
~Amy~
 
Posts: 3478
Joined: Sat Aug 12, 2006 5:38 am

Post » Tue Jun 19, 2012 8:22 pm

The question was how to get it run, do i have to put it anywhere or something like that?
User avatar
Leonie Connor
 
Posts: 3434
Joined: Mon Mar 12, 2007 4:18 pm

Post » Tue Jun 19, 2012 6:15 pm

Here's an alternative "hello world" (to the one explained in the Wiki) from scratch.

Note, however, that this is specific to "Scripting" mods.
For other types (new weapons, new lands, etc...), others can help.
  • Open the CK.
  • Immediately save your mod to a new ESP.
  • Create a Quest:
    Spoiler
    • Expand the Quest category in the Objects window
    • Right-click on the blank rows on the right and select New.
    • Fill in Id with "marguthHelloWorld"
    • Ensure Start game enabled is tick
  • Ok that window and save the mod. (Save often)
  • Open that Quest window again and attach a script to it:
    Spoiler
    • Double-click on your quest "marguthHelloWorld"
    • Click on the Scripts tab on the far-right of the window
    • Add a new Script and name it "marguthHelloWorldScript"
    • Edit it's Source by right-clicking on it and selecting Edit source
    • Copy this code into the script. Ensure that you leave the "ScriptName" line alone.
      Event OnInit ()     Debug.MessageBox ("Hello world")EndEvent
    • File > Save then Build > Compile the Script.
    • Close the Script window. Ok the Quest. Save the mod.
  • Try it out in game. Ensure that marguthHelloWorld.esp is ticked in your launcher.

Note that OnInit () only runs the first time for each Script.
So if save your game after the OnInit () executes (i.e. you see Hello World) in the game, you won't see it again.
(Until you save your game without the mod and reactivat the mod.)

Next steps...go through that Quest tutorial in the Wiki.
You'll learn how to tie the Quest script with objects (i.e. actors, items, dialogue, etc...) in the game.
User avatar
ZANEY82
 
Posts: 3314
Joined: Mon Dec 18, 2006 3:10 am

Post » Tue Jun 19, 2012 11:02 am

wow just save it and then compile it... sounds very easy...
it worked fine :)

ok now i tried the steps at a sharpening wheel.
i added following script:
Scriptname Sharpening extends ObjectReference  Event onActivate ( objectReference triggerRef )Debug.Messagebox("the script runs")endEvent

if i now activate a wheel nothing happend :(
is it the wrong event?
User avatar
luke trodden
 
Posts: 3445
Joined: Sun Jun 24, 2007 12:48 am

Post » Tue Jun 19, 2012 5:01 pm

wow just save it and then compile it... sounds very easy...
it worked fine :smile:

ok now i tried the steps at a sharpening wheel.
i added following script:
Scriptname Sharpening extends ObjectReference  Event onActivate ( objectReference triggerRef )Debug.Messagebox("the script runs")endEvent

if i now activate a wheel nothing happend :(
is it the wrong event?

You would have to attach your script to the sharpening stone object that is instanced in the game.

(CraftingBlacksmithSharpeningWheel in the object window) - click "add" in the object's script area, and attach your script there...that's a start...I haven't gotten into actual activation scripts yet, but that is probably where you start.
User avatar
El Khatiri
 
Posts: 3568
Joined: Sat Sep 01, 2007 2:43 am

Post » Tue Jun 19, 2012 4:42 am

of course i attached the script to the wheel^^ sry that i didnt say that.
User avatar
Myles
 
Posts: 3341
Joined: Sun Oct 21, 2007 12:52 pm

Post » Tue Jun 19, 2012 6:25 pm

maybe it's DefaultProcessingOnly flag is set to true in whatever calls up the sharpening dialog? that would prevent the OnActivate event from being called, according to the information in the http://www.creationkit.com/ObjectReference.Activate_%28Papyrus%29 page...
User avatar
no_excuse
 
Posts: 3380
Joined: Sun Jul 16, 2006 3:56 am


Return to V - Skyrim