Jump to content

Tutorials WITHOUT "youtoob"


Allannaa

Recommended Posts

  • Replies 618
  • Created
  • Last Reply

Top Posters In This Topic

Things I never found tutorials for

<snip>

Making a Race (standalone that CAN wear armors)

Can you be more specific on that? All the custom races I've ever tried have been fully able to wear armor both stock and custom.

 

I believe you have to set the Morph data to the race you copied etc

 

My point is there doesn't seem to be a step by step for this for those wgo don't know where to start

Most tutorials seem to tell you what can be done not how to do it very few are for those that have never done such things before

 

Same with region generation theres nothing I found that gives any clie where one should start, that link I gave to Hoddminir

is great for world building and LOD stuff but where to start with populating it with vegitation and rocks etc, see this is all done by hand

in Skyrim. Hoddminir is 4096x4096 he's gonna be years planing grass, trees and rocks never mind the other bits that make a landscape look

real

Link to comment
Share on other sites

 

(And aside to Kiwi-Hawk, I thought I was the only person on earth who still said Kia Ora!)

 

Used quite a lot downunder here lol no NOT Aussie, south a bit and more under lol the wee country where

we don't like nuks and the weather is ka pai my names a dead give away and we have the best ruby players in the world

Link to comment
Share on other sites

The only issue I have with tutes of this sort tho, is, it assumes the person really wants to learn to code -- That isn't always the case. Sometimes, the reader just wants to know how to do something specific -- How to add an item to inventory, how to make a quest update after a bad guy is killed, and so on.

The problem with this approach is that you begin rely on existing content and it'll be hard for you to modify existing scripts to suit your needs.

 

 

For instance --

"The cast operator attempts to cast the value from the left expression to the type to the right of it, and returns the resulting value.

 

Examples:

 

; cast a to a float and assign it to i

i = a as float"

 

What on earth does that mean? To me "cast" means cast a spell... is that what this code snippet does?

I did cover this in my tutorial, though I used the term typecast.

 

 

I guess what I'm saying is, does a person really need to know what all these things mean in terms of computer language? Isn't there just some simple way of saying "Type this to make this happen, and attach it to this NPC or to this item". Like the "make anything a chair" or "display your claws" tutorials -- we didn't have to understand all these esoteric terms. We just had to know, Do this, This, and This.

Then it's not a scripting tutorial, it's a tutorial for "how to do something". A scripting tutorial is aimed at those who want to learn scripting.

Link to comment
Share on other sites

Okay next part. Here I will talk about:

- Scripting structure

- Creating your own scripts from scratch

- Learning from other scripts

 

 

Scripts can be attached to most forms. Actors, Magic Effects, Quests, Activators etc. Depending on what you want to do, you need to attach the script to the right object.

 

For spells, you need to attach your script to a Magic Effect. If you want to add a script to something the player can interact with, you need to attach it to an intractable object, such as an activator, door or container.

 

To create a script, open up the form of the object you want to script in the Object Window. Most forms have a papyrus section. Right-click in the white field and select [add new script]

 

A new window will pop up. There are two fields you need to pay attention to, the Script Name, and the Extends: . You can ignore the tick boxes.

 

Script name will be the name of your script.

Extends is usually already filled in. If you added a script to a magic effect, it will (or should) extend ActiveMagicEffect. If you added a script to an activator, it will extend ObjectReference.

 

What does all of this mean?

When you extend something, you gain access to all its events. Since events is what executes a script, we must extend the right thing. Most commonly used are ActiveMagicEffect and ObjectReference. But it doesn't end there. The Actor Script extends ObjectReference, so if your script extends Actor, it also extends ObjectReference. We'll go more into this later on.

 

The basic script structure:

 

I forgot to mention it in the previous tutorial but " ; " means comment. Everything written behind a " ; " will be ignored

 

Let's look at an example. This is a script for a simple Recall spell. It teleports the player back to a specific location.

Scriptname RecallSpell extends ActiveMagicEffect

ObjectReference Property RecallMarker Auto
VisualEffect Property teleportFX Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)

teleport(akCaster, homeMarker)

endEvent

Function teleport(Actor caster, ObjectReference teleportMarker)
teleportFX.play(caster, 1.5)
utility.wait(1.0)
caster.moveto(teleportMarker)		
endFunction

 

Top to bottom:

First line: All scripts begin with this: Scriptname <name of the script> extends <What it extends>

- The name of the script must match the filename.

 

Properties:

 

Properties are special variables. I'd say that the best way to describe them is to serve as a link between the Creation Kit and the script.

For example, the teleportFX variable is what effect we will play when we teleport. This is set from the Creation Kit itself. There's a long list of effects we can use, but I prefer to use the effect use from the Call Of Valor-shout (which is a white-blue version of the Summon Atronach effect)

 

Same thing goes for the RecallMarker variable. It's variable type is ObjectReference. This means that it is an object placed in the world.

 

Next up is the Event. As stated in the previous tutorial, events execute a script. Our event is OnEffectStart. Most scripted spells use this event. Basically, when our magic effect begins, the script is executed.

 

Currently, there is only one line of code within our event: our custom teleport function. It has the caster and the RecallMarker as parameters.

 

The teleport function itself has three lines of code:

- teleportFx is the a VisualEffect-variable type. This means that we can manipulate it with all the functions from the VisualEffect Script.

We only use the Play()-function, which plays the effect on a specific reference for a specific amount of time.

 

We then wait one second. The Wait-function is a part of the utility script which we specify by typing "utility." before "wait(1.0)".

 

Finally, we call upon the MoveTo-function. This moves a reference to another reference. In our case, we move our caster to the RecallMarker.

 

I've used the term reference a lot, but what is a reference?

Basically, it's an object placed in the world.

 

 

I wrote a short bit about how to create a script above. Now I will talk about how to edit it.

 

Ideally you want to use Notepad++, but you can use the built-in editor. Read this article for how to set Notepad++ up properly.

 

To open up your script in the Creation Kit script editor, simply right click it and select edit source.

To open it in Notepad++, go to File->Open.. Navigate to the Skyrim/Data/Scripts/source folder and find your script.

 

Now you'll just have to fill in the code. But how do you know what to type in?

This is how I do it:

- I know what I want to do.

- I then break it down into what is happening.

- I then ask myself: Are there any in-game examples I can look at?

If yes, I find that script by filtering the script list by relevant terms.

If no, I open up Creationkit.com and search for relevant terms.

 

Let's look at an example:

 

At one point in time I decided to create Dragon Claw Holders.

"What is happening?"

The player activates something. A dragon claw is removed from the players inventory. The Dragon Claw is displayed on the wall.

"Are there any in-game examples i can look at?"

Two comes to mind: Weapon plaques and the Atronach Forge Sigil Stone.

I ended up with the Atronach Forge-version.

What does that script look like and what can we learn?

 

Scriptname AtrFrgSigilStoneScript extends ObjectReference  

miscObject property sigilStone auto
objectReference property sigilStoneREF auto
AtronachForgeSCRIPT property Forge auto
message property defaultLackTheItemMSG auto

EVENT onActivate(objectReference actronaut)
if Forge.sigilStoneInstalled == FALSE
	if actronaut.getItemCount(SigilStone) >= 1
		Forge.sigilStoneInstalled = TRUE
		sigilStoneREF.enable()
		(actronaut as actor).removeItem(sigilStone, 1)
	else
		; player must not have the sigil stone to install
		defaultLackTheItemMSG.show()
	endif
else
	; if the sigilstone is installed, then let the player get it back
	Forge.sigilStoneInstalled = FALSE
	sigilStoneREF.disable()
	(actronaut as actor).addItem(sigilStone, 1)
endif
endEVENT

 

The third property variable looks interesting: "AtronachForgeSCRIPT". It's not a variable, it is what I like to call a master-script. I'll go deeper into that in the next part.

Anyway, this is what happens when the script runs:

The script checks if the Sigil Stone is installed i.e. is placed.

It then checks if the player has a sigil stone in his inventory.

If he does and the sigil stone is NOT placed, the first thing that happens is we flag the Sigil Stone as installed.

We then enable the Sigil Stone

We then remove a sigil stone from the players inventory.

 

If the stone is installed, we do the things above, but reversed.

If the stone isn't installed and the player doesn't have the stone in his inventory, we display a message that says that the player lacks the item.

What can we learn and how does this help us to create dragon claw holders?

The first thing we should look at is what we extend and what the event is.

In this case we extend ObjectReference, which means this script is attached to an object placed in-game.

The event is OnActivate, which tells us that the object this script is attached to can be activated.

 

We can see that this script uses a master script, but if we look closer we can see that we don't really need a master script. We need a boolean variable that keeps track on wether or not our claw is placed or not.

Another thing to notice is that the Sigil Stone becomes "enabled". This means that the Sigil Stone displayed is not an item. It is a static object that is checked as initially disabled. Disabled objects are not visible until a script enables them.

 

What my script ended up looking like:

Scriptname DragonClawHolderScript extends ObjectReference  

MiscObject Property ClawToPlace  Auto  
{The claw we want to place}
Message Property FailMessage auto
{The message to show if the player dont have the claw in their inventory}
Bool Property isPlaced = false Auto Hidden

Event OnActivate(ObjectReference akActivator)
       if(isPlaced == FALSE)  ; is the claw placed?
               if akActivator.getItemCount(ClawToPlace) >= 1 ; Does the player have the claw?
                       isPlaced = TRUE
                       self.getLinkedRef().enable() ; Enable the Static Claw
                       (akActivator as actor).removeItem(ClawToPlace, 1) ; Remove the claw from the players inventory
               else
                       FailMessage.show() ; If the player doesnt have the claw, show the Fail message.
               endif
       else
               isPlaced = FALSE  
               self.getLinkedRef().disable() ; If the claw was already placed, disable the static claw
               (akActivator as actor).addItem(ClawToPlace, 1) ; add the claw back.
       endif
endEvent

Looks pretty similar right?

Notable differences:

- My script doesn't use a master script to keep track of the wether or not the claw is placed or not.

- I use GetLinkedRef(), rather than sending an ObjectReference Property into the script. This is because Bethesda suggests that you avoid using object references in scripts if necessary.

 

 

But what if we didn't have a script we could look at?

If that's the case, then you'll have to puzzle your script together.

If we go back to our initial breakdown: "The player activates something". A player can only activate objects placed in the world. Our best bet is to look at the ObjectReference Script-page.

 

Press ctrl+f. "Activat" is a good term to search for, as it covers both Activation and Activate. From this we find the Event OnActivate(). Read the page and find out what this event does.

Next step in our breakdown is "The dragon claw is removed from the players inventory". Press Ctrl+f again and enter: "Remove". Sadly, RemoveItem() is not a part of the ObjectReference script and cannot be found on its page. Enter "remove item" in the search box up top. We find out that RemoveItem() is a part of Actor Script.

How to solve the third step, "The dragon claw is placed on the wall", isn't obvious. This is when you have to think outside the box so to speak. The solution above doesn't display the claw the player had in his inventory; it displays a claw that looks like the claw the player had in his inventory.

 

How to solve problems like these come with experience and the patience of enduring hours browsing through the functions and events listed on the creation kit wiki.

 

In the next part I will cover useful functions, common events and some advanced methods.

 

Questions?

Link to comment
Share on other sites

 

 

For instance --

"The cast operator attempts to cast the value from the left expression to the type to the right of it, and returns the resulting value.

 

Examples:

 

; cast a to a float and assign it to i

i = a as float"

 

What on earth does that mean? To me "cast" means cast a spell... is that what this code snippet does?

I did cover this in my tutorial, though I used the term typecast.

 

 

 

OH!!! Okay *now* I almost begin to understand, thank you!

Edited by Allannaa
Link to comment
Share on other sites

To create a script, open up the form of the object you want to script in the Object Window. Most forms have a papyrus section. Right-click in the white field and select [add new script]

 

A new window will pop up. There are two fields you need to pay attention to, the Script Name, and the Extends: . You can ignore the tick boxes.

Hate to play devils advocate here, but can you tell me what program you are using to see that?

 

when I open say an Actor record and I right click on the Papyrus script window. There is no option to [add new script]. There is an "Add Script" option. The box that pops up only lists script names. There is no section labeled "Extends" and there is no tick boxes.

 

If however I select [New Script] in the initial box that pops up THEN I get a box like you are describing.... These are things that new users need to know. Things that get glossed over by the "experts"

Link to comment
Share on other sites

how to activate standalone mods if files are on bsa?

if there is a bsa file then there must be a corresponding esp file. Otherwise the game won't access them.

 

there is an ini entry that could be adjusted to not require using the esp file, but I don't recommend that as typically the bsa content requires the esp content to provide the interaction in game. However for completeness sake...

 

In Skyrim.ini in the [Archive] section there are two entries:

sResourceArchiveList

sResourceArchiveList2

You would add the bsa file to one of these lists and then disable the associated esp file. Can be done if you know for 100% that the associated esp is just a dummy, meaning it was made solely for the purpose of making the bsa file to pack pure replacer files (i.e. textures, meshes)

 

Typical usage is to just activate the esp plugin and the bsa content will be used, unless you have loose file versions from another mod of the same files used by the mod with the bsa, in which case the loose files will take priority over the bsa.

 

When loaded the game looks for data in the following places. The first place with data found is what gets used.

  • save game
  • loose files
  • plugins including bsa files from bottom of load order up to the top
  • main game files

Link to comment
Share on other sites

I still think "int" or "integer" refers to some off the wall math term that may mean "a number"
you are correct. it means a WHOLE number.

 

 

So -- "Int" = number from 0 to 9

and -- "Float" = a decimal like .14159 or sumpin?

@Allannaa I like what you try to do, I already noticed some facts for Skyrim that I did not know, thanks!

 

For the define of variables in scripts, this is general similar for most programming languages so just out of mind...

 

int a variable that can keep a number from -32767 to 32768 and can't have decimals

 

float a number that as you correct concluded can have decimals normally with an accuracy for up to 5 to 6 decimals and a 10^ part to be able to create really big numbers. The fishy thing with floats is that you can seldom do a straight if float = 134556.347854 then do something because the float is not always a true but a computer binary approximated representation that for some ranges introduce jitter. A compare in a script will then fail because the float might contain some .000000xxxx rests that then not match and the scripts fail. Normally a way to solve this is to either use a function that reduces the float variable to the needed amount of decimals before the check or make a if float > 134556.347 and float < 134556.348 then do something.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...