Jump to content

Advanced Scripting


FakeUser21345

Recommended Posts

Hey,

 

I recently uploaded a mod that allows you to play as a Time Lord from Doctor Who, and hasn't been a huge success. Some people suggested I add a script that plays a cool dragon soul absorption animation, and then toggles the race menu to redesign your face (regeneration). There's only one problem: I don't know the first thing about scripting. And something like this goes way over my head. Any help would me much appreciated.

Link to comment
Share on other sites

The first thing you'll have to do is decide how you want this thing to be "activated." Do you want this to be triggered from casting a spell or using a power? Or from activating an object? For now, I'l just assume you want to make a power (like the Orc's Berserker Rage power).

 

The first thing you should do is set up your scripting environment. Most people use Notepad++. There's a guide to setting it up here: http://www.creationkit.com/Notepad%2B%2B_Setup

 

If you wanted to just jump into something first, you can create and compile scripts right in the Creation Kit, but it's not as useful (so I'd set up Notepad++ eventually if you were serious about scripting).

 

To make a spell, power, or ability that isn't merely just a variation of something that already exists, first you need to make a MagicEffect. Go to the CK and look for Magic > Magic Effect. Right click in the window and select "New."

 

ID: DrWhoRegenEffect (or whatever you want)

Name: Regeneration (similarly, whatever you want)

Effect Archetype: Script

Casting Type: Fire and Forget

Delivery: Self

 

Click "OK"

 

Open the MagicEffect you just created and go to "Papyrus Scipts" in the bottom right. Click Add > New Script. Give it a name like "DrWhoRegenScript." Right click on the newly created script and click "Edit." Paste the following into the window

ScriptName DrWhoRegenScript extends ActiveMagicEffect
 
VisualEffect Property DragonAbsorbEffect Auto
 
Event OnEffectStart(Actor akTarget, Actor akCaster)
DragonAbsorbEffect.Play(akCaster, -1.0)
Game.ShowRaceMenu()
EndEvent
 
Event OnEffectEnd(Actor akTarget, Actor akCaster)
DragonAbsorbEffect.Stop()
EndEvent

Hit ctrl+s to save. Click on "Properties" and select the DragonAbsorbEffect property and click "Edit Value." I'm not sure what the specific effect you're looking for is called, but it should be one of those in the list (this will probably require some trial and error).

 

Once you have your MagicEffect created, go to Magic > Spell. Right click and select "New"

 

ID: DrWhoRegenPower

Name: Regeneration

Type: Power (or Lesser Power, if you don't want it to have a day-long cooldown)

Casting: Fire and Forget

Delivery: Self

Equip Type: Voice

 

In the "Effects" window right click and select "New." In the window that pops up, select the MagicEffect you created from earlier and click "Ok."

 

Once your power is created, check its Form ID. Note down what this is, it should be something like 0200XXXX. Start up your game and open the console. Type:

 

player.addspell <Form ID>. You'll get an error, because that's not actually the spell's ID. You need to change that 02 to 03, or 04, or 15, or whatever order your mod is loaded in compared to your other mods. Just keep trying until you find the number. Go equip the power and try it out.

 

 

Link to comment
Share on other sites

Is that all it says? Usually it comes with better error description.

 

Right away I notice I mistakenly wrote "OnEffectEnd" instead of "OnEffectFinish," but I don't think that would have caused a compilation error (still fix it anyway, though). I can't see anything else that would cause an error. I'll have to look at it more when I get home later.

Link to comment
Share on other sites

I've changed it to OnEffectFinish, but as predicted, the error stays the same. Actually, here is the entire output:

 

Starting 1 compile threads for 1 files...

Compiling "DrWhoRegenScript"...

C:\Program Files\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\DrWhoRegenScript.psc(11,19): argument akobject is not sprcified and has no default value

No output generated for DrWhoRegenScript, compilation failed.

 

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on DrWhoRegenScript

 

Hope that helped

Link to comment
Share on other sites

Oh, I forgot to add the argument to the Stop() function. The code in the OnEffectFinish event should be:

DragonAbsorbEffect.Stop(akCaster)

I found that out by going to http://www.creationkit.com/ and searching for "VisualEffect script." I knew I was dealing with a VisualEffect, so I needed to see what that thing can do, and that's where you go to find out. If you look on the page (http://www.creationkit.com/VisualEffect_Script), it has two member functions, Play and Stop.

 

If you look for "Actor script," for instance, you can see all sorts of things you can do to those two Actors in the events (akTarget and akCaster).

Edited by Maverick827
Link to comment
Share on other sites

  • Recently Browsing   0 members

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