Jump to content
ℹ️ Intermittent Download History issues ×

[LE] Trying to get started with scripting (original skyrim)


monsto

Recommended Posts

I've got experience in python, php, javascript and some SQL, so the bulk of papyrus seems like pretty standard stuff.

 

What throws me off is when a Property is required, where to attach scripts, and whatever other declarations are required in a script header,

 

For a first script I want to do the following in-game.

  1. As player, move to a position.
  2. Press a key to save the players position and angle.
    1. Toggle visibility of a game asset (let's say iron swords) to depict the stored position and angle.
  3. At some future point return the player to the position.

What part of this needs a Property and why? Based on what I have learned by reading s#*!, it seems that i need to set up a Property to refer to the iron sword.

Will I a Property for referring to and moving the player?

 

Then there's the whole "press a key" thing. Should I make that a spell? I've seen mods that don't have a spell, but pressing an arbitrary key toggles "activation" of a mode where a whole set of keys/actions become available. I've tried looking at other peoples code, but it always seems like a spaghetti referential mess... which probably comes from not completely understanding how/when Property works. If I use that as a spell, where do I attach the script? To the spell, the spell effect, or something else?

 

If this were python or javascript, I'd absolutely just go build something and then poke at it till I got somewhere. My problem is that creation kit not only takes a week to start, but is also unstable. And I'm reluctant to go thru that start/crash process over and over without having at least some idea of what it's going to choke on and if I somehow caused it.

Link to comment
Share on other sites

To begin with, from my limited experience, most of the scripts you're likely to be dealing with while modding are likely to attach to one of three items: a Quest, an Actor, or a Magic Effect. If you attach a script to a Quest, it generally needs to extend "Quest" in order for the game to initialize it. If you create a script through the CK where you're attaching it, and then immediately close the dialogue window for the item you attached a script to by hitting 'OK' it will save a blank script to your \Scripts\Sources\ folder that already has the proper extension.

Properties are like Global variables only you're importing a specific reference as a new variable that you wouldn't necessarily have access to based on what class structure your script extends. A really good example of this is Perks. Say you've attached a script to an Actor that needs to check whether or not you have a specific Perk. You'd need to set up a property for that perk before just declaring it willy-nilly underneath the Actor class. To actually implement the Property correctly is more complicated than it should have to be because the Form (generic umbrella term that includes all of TES's records [Actor/Spell/Item/Quest]) you've attached your script to actually has to have a filled out Property reference that points to said Property's Form ID.

 

To add a Property via the CK, Click your script, open the Properties tab, Add a Property, Select it's type then type it's Editor ID into the "name" box, hit OK, then back out in the Properties tab choose "Auto-Fill" and the CK will automatically find the correct Form ID to associate with your Property. You cannot have a variable anywhere in your script that already has your Property's Editor ID as it's text when you're doing this so you may have to comment lines out temporarily while populating your Properties.

Back to your particular topic, there are at least two different Mark and Recall mods floating around and I would personally go delve into what they've done to figure out how to best approach your implementation. If you can learn to browse plugins in TES5Edit it does make sorting what's what within a plugin quite a bit easier as xEdit by nature filters out superfluous items. If you can then cross-reference what you learn in xEdit back to the CK you're set as the CK is the best place to actually alter or make Forms.

Also, you can compile your scripts and save your plugin in the CK then immediately go test in game without closing the CK assuming you have enough System RAM to do so.

Edited by MShoap13
Link to comment
Share on other sites

Properties are used in a few ways ...

To link your script to something in the game or as a generic way to script. Sometimes both.

 

exp: A short buy misc item script ...

 

Scriptname BuyItem Extends ObjectReference
; item activator buy script
MiscObject Property Item Auto
MiscObject Property Gold001 Auto
Actor Property PlayerRef Auto
Int Property Cost Auto
Event OnInit()
GoToState("Done")
EndEvent
Event OnActivate(ObjectReference akActionRef)
If(akActionRef==(PlayerRef))
If(PlayerRef.GetItemCount(Gold001)>=(Cost))
PlayerRef.RemoveItem(Gold001, Cost) ;* Take Gold
PlayerRef.AddItem(Item, 1) ;* Add Item ...
Else
Debug.Notification("Not enough gold")
Endif
Endif
GoToState("Done")
EndEvent
State Done
;do nothing
EndState
Though this script is very small, it is actually very powerful in it's generic form.
As we can from the CK put in any MiscObject in the item Property and set a price for the item in the cost Property.
This one script can now be used many times without changing the script as it can be customized to each item.
Also we are using Properties to link to the games gold and the player. So within just a few lines of code we are able to
handle any type of buy you may wish for the games MiscObject's. Good stuff, and a very advanced form of scripting.
Without this we would have to list every single MiscObject in the game or refer to a list.
The holy grail of scripting is to be as generic as possible. Property's are a dream come true for this.
As for your script ...
A simple way to do this would be to, when you press a key fill some float variables with the players position and angle then simply jump them to that.
Btw, the pressing a key thing is not easy and jumping the player to a spot like that can and will break courier quests. If you are just jumping to a spot
in the same cell I don't see a problem but, when you start jumping from world spaces ... problems ...
When the new Skyrim came out it was missing 3 very cool spells ... Mark, Return and Levitate.
Though those were loved spells as you continue to mod you will find there are good reasons they were taken out.
I hope this helps. I would write you a script for this but, I can't give you a script that I know will break the game ...
Link to comment
Share on other sites

Properties are

 

The definition of Property that made it click for me came from Cipscis ...scroll down about 2/3 the way till you get to Properties header.

 

I had seen a million different horrible paraphrases of what Property was and why it's there, and they all fell quite short. In 2 paragraphs, he clearly explains why you need Property and what it is for.

 

 

I would write you a script for this but, I can't give you a script that I know will break the game ...

 

 

First of all, it needs to be completely cell contained. That is to say that each cell will have it's own marks stored.

 

And then here's the thing: I intend to do this as a purely personal mod. I'm one of those "homemaker" types. I've built a couple of cells in CK and do my thing with them. I haven't truly played the game in a couple of years and have no desire play the game while any of this stuff is active. The combination of world altering mods that I have running would probably break the s*** out of the game anyway.

 

So rather than you writing it, i'd like to understand myself how to do this on my own. Therefore, if you wouldn't mind, would you be willing to be a short-term mentor for a couple weeks while I stumble thru this? Most of the stumbling will be with me getting things started... doing the obscure s#*!.

Link to comment
Share on other sites

The whole press a key thing is what is killing it (for me anyways) ... What are you trying to do here, make a portal ?

Or make a Mark and Return style portal. If so you can find Mark and Return type mods here on the Nexus.

 

No... for lack of a better word, I'm making a gallery.

 

Imagine an art gallery. paintings, sculptures, etc. I want to set "camera" positions, then cycle thru them via automation. I know you can't separate the camera from the player, and even if you could I don't care to I'm content to use "player.moveto" whatever invisible token I set out.

 

For example whiterun. Use TCL to get into position to best view Adrienne's forge. Press a key and set a marker. Walk up the hill to the marketplace. Press a key and set a marker. Do it again at Heimskr. When done, then press another key to cycle between the markers. Save markers on a per-cell basis.

 

This is the meat and potatoes of the script/mod. Future dreams include a menu with "change/delete/moveto" individual markers, perhaps add additional info to the marker, maybe even do movement between 2 different markers. But for right now, I just want to get the absolute basics: put down a marker, traverse the markers.

 

I don't have a problem using spells, but a "press a key to change modes" would be better. Jaxons Positioner takes KP_ENTER to change from "play the game" to "move the selected", but again I couldn't make heads or tails of where that's done in the code. It may also be a feature of MCM.

Link to comment
Share on other sites

Hmm, Check this page out ...

https://www.creationkit.com/index.php?title=Complete_Example_Scripts

 

Look at:

A Trigger That Detects When The Player Enters

Making a Cool Cut-Scene

 

or maybe

 

Move an Object to a Specific Location Without Fade

 

"I know you can't separate the camera from the player" [ Making a Cool Cut-Scene ] does just that.

Edited by NexusComa
Link to comment
Share on other sites

Hmm, Check this page out ...

https://www.creationkit.com/index.php?title=Complete_Example_Scripts

 

Look at:

A Trigger That Detects When The Player Enters

Making a Cool Cut-Scene

 

or maybe

 

Move an Object to a Specific Location Without Fade

 

"I know you can't separate the camera from the player" [ Making a Cool Cut-Scene ] does just that.

 

Yeah I've seen that page. What it doesn't really help with is the original problems I have here. . . which is basically how do I take this simple concept and stuff it into the way that skyrim/papyrus expects it?

  • Based on my description above, I'll need to use an asset for a marker. That'd be the simplest way to store the positions per cell. Lets say i repurpose that iron sword, and 'disable' it in game. That will need Property. I get that. But I'm moving the player. Do i need Property for the player?
  • To do these types of utility mods, I see Quests in the code. WTF?

My favorite part is that I'd be more than willing to just RTFM. The CK Wiki isn't much to speak of with the questions I have. It's incomplete and indexed poorly. . . unless I've missed something.

 

You know what, f*#@ it.

 

Thanks for replying.

Link to comment
Share on other sites

Use a Xmarker not a iron sword. The XMarker is then set in a property and you key your move off that. In your case considering you want to move to many

spot to view the art you will need many XMarkers. I've been modding Skyrim for years and I don't think I've ever gone to Wiki for anything.

 

I use the Creation Kit site. The page with all the commands on it ... http://www.creationkit.com/index.php?title=Category:Papyrus

Or I just google my way around ... on great trick when using google is add the word papyrus to the search. Exp: Skyrim papyrus "Move a player"

 

Make a script Add a XMarker as a property called Marker01. Put it the correct spot. Then use the moveto command ...

Player.MoveTo(Marker01)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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