A couple of how-to questions for expert modders

Post » Tue Jun 19, 2012 12:11 am

Hi there,

First I must say that I'm one of those newcomers to TES modding world.

I created a small mod, both as experiment for myself and to make use of it, that will share with the community once I have it somewhat polished, but I have a couple questions about the editor, that I was unable to find anywhere.

1- I wanted to allow the player to sit on a rock. I tried with some items called "invisible chair marker", even added a script I found around called "playersitscript", but nothing happens, and I don't see a marker anywhere when running the game. I don't know if this is even doable.

2- I wanted to add an activator to a barrel, so when the player uses it, a bottle of mead is placed in the inventory. I put an item called "activator" (or something similar), and added an own script, based on an example form the CreationKit site, that it's supposed to add an item into the player inventory. Compiled the script with no errors, but I don't see the activator in game, and nothing happens at all.


I seem to be missing something about how to implement these things... any tips appreciated.

Thanks in advance.
User avatar
Amy Siebenhaar
 
Posts: 3426
Joined: Fri Aug 10, 2007 1:51 am

Post » Mon Jun 18, 2012 9:56 pm

I made the Sittable rocks mod for Oblivion.
Have not yet looked at making it for Skyrim.
But in Oblivion, I had to create a rock mesh that had sittable properties.
I couldn't do it with a script / Construction Set alone.
I'm not sure if it's the same for the CK. I've not looked at it's Furniture system yet.

How I created Oblivion's Sittable rocks mod
Spoiler
I created the rock mesh with sittable properties with an external NIF tool.
I loaded a normal chair (had sittable properties already) and a normal rock.
I deleted the chair mesh and imported the rock mesh onto it. I had to position the rock mesh so the sittable area was in the correct spot.
I had to create several rock meshes (one for the different types of rock that exists in Oblivion's game world.
Then I...:
  • (With OBSE) I detected when the player pressed the Activate key.
  • (With OBSE) If the player had a rock in their target, I found out which type of rock they had targeted.
  • I moved the rock mesh I made that was of the same type of the rock they had targeted to the game world.
  • Foced the player to sit on it with a script (rockRef.Activate Player, 1)
(With OBSE) = wasn't possible with the Construction Set alone.

I can guess, it'll be similar in Skyrim.
User avatar
Loane
 
Posts: 3411
Joined: Wed Apr 04, 2007 6:35 am

Post » Mon Jun 18, 2012 7:51 pm

Theres very ODD bug with triggers. Triggers must be placed around the 45 degree mark in order for them to be activated... (Unless you are using an activator with a model?)
User avatar
Pawel Platek
 
Posts: 3489
Joined: Sat May 26, 2007 2:08 pm

Post » Tue Jun 19, 2012 6:01 am

I made the Sittable rocks mod for Oblivion.
Have not yet looked at making it for Skyrim.
But in Oblivion, I had to create a rock mesh that had sittable properties.
I couldn't do it with a script / Construction Set alone.
I'm not sure if it's the same for the CK. I've not looked at it's Furniture system yet.

How I created Oblivion's Sittable rocks mod
Spoiler
I created the rock mesh with sittable properties with an external NIF tool.
I loaded a normal chair (had sittable properties already) and a normal rock.
I deleted the chair mesh and imported the rock mesh onto it. I had to position the rock mesh so the sittable area was in the correct spot.
I had to create several rock meshes (one for the different types of rock that exists in Oblivion's game world.
Then I...:
  • (With OBSE) I detected when the player pressed the Activate key.
  • (With OBSE) If the player had a rock in their target, I found out which type of rock they had targeted.
  • I moved the rock mesh I made that was of the same type of the rock they had targeted to the game world.
  • Foced the player to sit on it with a script (rockRef.Activate Player, 1)
(With OBSE) = wasn't possible with the Construction Set alone.

I can guess, it'll be similar in Skyrim.


Thanks kuertee.

I just wanted to allow the player to sit on a cliff edge. I don't know how it worked in Oblivion editor, but in the CK when you place a chair you can see markers in blue colors indicating where the NPC/Player is going to sit. There are also chairs without markers. And then there are the so-called "invisible chair marker", where you only see a sitting human figure, with no chair. I assumed that maybe it was enough placing one of those.

Theres very ODD bug with triggers. Triggers must be placed around the 45 degree mark in order for them to be activated... (Unless you are using an activator with a model?)

Thanks for this info, I didn't know. I will try placing both the invisible chair, and the activator, in 45o positions. I don't exactly know what you mean by "activator with a model". I placed an item that in the render window shows as a semitransparent orange cube. It was called something similar to activator. I also found a mead barrel that was called "barrel activator" or something like that, but had no markers or scripts attached as far as I saw, and didn't work either...

I'll try it again and update.
User avatar
Scott Clemmons
 
Posts: 3333
Joined: Sun Sep 16, 2007 5:35 pm

Post » Tue Jun 19, 2012 7:16 am


I don't exactly know what you mean by "activator with a model". I placed an item that in the render window shows as a semitransparent orange cube.

Some of the activators in the activator's tab have models associated with them that are placed along with it... Of course, Now That im not half asleep, Im pretty sure Im wrong about that. Used to be that way in the GECK, but mabye not now in the CK.
User avatar
Jessica Raven
 
Posts: 3409
Joined: Thu Dec 21, 2006 4:33 am

Post » Tue Jun 19, 2012 6:52 am

Yeah I have a similar problem, and actually the (teleport) script DOES work on one activator but not on another
User avatar
Danger Mouse
 
Posts: 3393
Joined: Sat Oct 07, 2006 9:55 am

Post » Mon Jun 18, 2012 5:12 pm

Update: Didn't work. Placing the markers on 45o setting has same result... I guess I'm missing some steps here.

Now with the CK opened I can post exactly what I have:

I duplicated the item called "DefaultInvisibleActivator". Inside I placed an own-created script, based on an example from CK site:

Spoiler

Scriptname KatixaAddMead
{
Game.GetPlayer().AddItem(Ale, 1, false);
}

Compiled with no errors. This script is added on the "Scripts" tab of this activator item. Anyway, as a developer, I'm used to an event that triggers a function, or a specific call somewhere, but as I know nothing about TES modding I just can guess that the "activator" item is just that... an activator, and runs certain script. But in game I see nothing to "activate", so I guess I'm doing it wrong.

What am I missing?

Thanks.
User avatar
Lisa
 
Posts: 3473
Joined: Thu Jul 13, 2006 3:57 am

Post » Mon Jun 18, 2012 7:28 pm

Did you write your script in a documentation string? When you place {} characters it makes a sort of commentary. So it didn't compile nothing, you just created a blank script with a commentary.

You should just go to Creation Kit Wiki and read tutorials there. This will explain everything. Your script should look like this:

Scriptname KatixaAddMead extends ObjectReferenceObjectreference Property Ale  Auto;In Skyrim you have to declare properties in order to use any of the in-game objects.Event OnActivate(ObjectReference akActionRef);This tells the game when to execute the scriptakActionRef.AddItem(Ale, 1, false); In your script the player would get beer even if some NPC activated the barrel.; akActionRef points to whoever used the activator.EndEvent

And you shouldn't paste it in documentation string box. In a window that shows up, where you write your script's ID, click OK, then right-click on your script and choose "Edit Source". Then compile, save and exit. Then click on Properties button, select your property, click on Edit value and choose your object. However, properties must already exist in a world and I'm not sure what's with the items in containers.

Also, if I understood correctly, you want a barrel to be an activator yet you used another object? Just place a normal usable barrel, one that a player can click on and put something in or take out, and put your script on this barrel. This way whenever the player clicks on the barrel, he doesn't go to an inventory window but gets ale instead.


PS. I really, really don't want to be snarky but look at these quotes: I duplicated the item called "DefaultInvisibleActivator" and But in game I see nothing to "activate". The whole thing's quite simple, really, when you look at it closely.
User avatar
A Dardzz
 
Posts: 3370
Joined: Sat Jan 27, 2007 6:26 pm

Post » Mon Jun 18, 2012 10:37 pm

Did you write your script in a documentation string?

(...)


Thanks a lot for your reply, Universal. I will try to answer your questions.

I wrote the script in the Notepad window opened after using the Edit Source option. The initial default line was "Scriptname [namehere]". I just edited adding the line of code from the CK documentation which I assumed was to execute when.. something, happened. Here is where I was a bit confused, because I didn't exactly know how I was supposed to trigger that piece of code. I then attached this script to the Activator object, assuming that being an activator, it would just run the scripts inside. Anyway, as I see, I have to add the events, in this case OnActivate...

The open and close { }, I put them because when I first compiled the script, I got errors, so I though I needed them to start and end the function.

About your barrel question, yes I want the player to get a bottle of Ale when using it, but the thing is that the barrel I'm using is NOT usable, and I placed the invisible activator on the "tap", so when the player goes there just activates it and gets the bottle. I guess I know where you're coming from with your PS... so, as I understand, I can only use activators on objects that are usable by default? Can't I just add an activator (for "E" key) to a tree? a rock? an impaled head?

In any case, I will do some tests based on the code you pasted.
User avatar
Amy Siebenhaar
 
Posts: 3426
Joined: Fri Aug 10, 2007 1:51 am

Post » Tue Jun 19, 2012 4:20 am

OK, maybe I was unnecessarily snarky after all. I thought that this invisible activator is sort of a trigger -- an invisible object that gets activated when an actor walks into it. It may be possible that you could place insisible activator over a static object... Otherwise you can only activate objects that are activators, containers, actors (when they're dead they're acting like a container) etc. No static. Wouldn't any other barrel work, like the one called MeadBarrel02?

Anyway if you insist on your static model I would suggest that you try something like this: take a container and make a new object based on it (you can duplicate or simply open the original object's data window and change ID -- it will ask you to create a new Form then). Now change this new object's mesh. For instance it seems that a container-barrels use mesh contained in a file Barrel01.nif, while static-barrels use Barrel02.nif. If you set your barrel's model as Barrel02.nif -- or whatever else -- it should still act as an activator while looking like static.

Or at least that's the theory. I haven't tried that.



PS. When you use my script remember that you have to define Properties. The Property Ale is declared but you have to go to Properties section of your script and edit their value... And here's the problem, I don't know how to just create this ale. I used an ObjecReference Property but this only works with Objects' References, i.e. actual objets placed somewhere. I'm trying to figure out how to do what you want.

EDIT: MAYBE it will work without the property (?):
Spoiler
akItemToAdd: The base form add to this reference's inventory.
EDIT2: On the other hand it seems it have to be a Form Property:
Spoiler
Function AddItem(Form akItemToAdd,
I guess you'll have to see what works.
User avatar
Sabrina Schwarz
 
Posts: 3538
Joined: Fri Jul 14, 2006 10:02 am

Post » Mon Jun 18, 2012 7:04 pm

My problem was solved by giving the duplicated activator a regular (2nd line in editor) name besides the base ID-name. That makes the activators actually clickable.
User avatar
naome duncan
 
Posts: 3459
Joined: Tue Feb 06, 2007 12:36 am

Post » Mon Jun 18, 2012 9:04 pm

The "invisible activator" problem is solved. I just needed to set a name for it (thanks Aezeal).

I added the script to the "base object" I created duplicating the original activator. This is what it has:

Scriptname KatixaAddAle extends ObjectReference  objectReference property Ale AutoEvent OnActivate(ObjectReference akActionRef)Debug.Notification("Hello, world!")akActionRef.AddItem(Ale,1)EndEvent

Now the problem is that this AddItem does nothing. I configured a sound for the activator, which plays correctly, and I see the "Hello world" message on the top-left corner. But no Ale for me.
I also tried with Game.GetPlayer(), instead of the actionref, and even changed the "Ale" item to something like "FoodMead", just in case, with same result.

I'm still doing something wrong, but I don't know what.
User avatar
Becky Cox
 
Posts: 3389
Joined: Thu Jun 22, 2006 8:38 am

Post » Tue Jun 19, 2012 7:57 am

I think it may have something to do with the ale Property but, as you could see in my last post, I don't quite know how to do this myself. I wish I could help more but for now I can only suggest looking for various solutions yourself or waiting for somebody else. Although maybe I'll try to look at this when I have a time. What is your the type of your Property Ale?

Of course, the Property is a problem. You saw how confused I was in my last post. In all probability you have to use a Property in the AddItem function (that's simply how it works in Papyrus) but on the other hand ObjectReference only works for Objects that are already placed somewhere in the world. While you, obviously, want to create a new item.

The Wiki seems to suggest that you can create a Property of a base item and it is easy when we're talking, for instance, about various miscellaneous items (hides, lockpicks, gold etc.). They have their own type. So do books, ingredients and other stuff. But there's no food type! I think a Form Type should work? But in my case I can only choose two objects to link to the Form-type Property.

So I guess I know not much more than you about how to do this.



EDIT:

All right, I've got this. The wiki can be really unclear but there are many informations if you look very close.

Food is classified as potions in CK. Potions have their own Property type. So you should change your property to:
Potion Property Ale  Auto
Then attach a mead to it in the Properties window. (Actually if you name it Ale it will automatically fill as an ale.]
User avatar
Stacyia
 
Posts: 3361
Joined: Mon Jul 24, 2006 12:48 am

Post » Tue Jun 19, 2012 5:16 am

Thanks for your time Universal.

Yesterday I tried several things with that information you posted, but none worked. I will dig into Bethesda's code on quests or situations where the player gets an item, to see if I get some clues.

I must say that I was missing the part of adding the property. I was just adding the code I posted. Yesterday I deleted it all and re-started. I created the script and tried with a different item. Then selected that same item type on the property menu, using the option "select reference in render window". Nothing at all.

I'm at work right now so I can't paste any code here, and I won't be able to do it for another 10 hours, but in any case, I will come back with updates if I finally manage to get this working, because I HAVE to get this working :verymad: :happy:
User avatar
Floor Punch
 
Posts: 3568
Joined: Tue May 29, 2007 7:18 am

Post » Mon Jun 18, 2012 7:26 pm

OK, OK, OK... I'm beginning to understand this a bit more... I used 20 mins of my lunch break to do a couple testings.

First, I must say that it worked.. just "a bit".

1- I made the trigger-box (activator) bigger.
2- I added OnTriggerEnter event, duplicating OnActivate, just for testing.
3- I deleted and created again the Property, this time using the 2 combo boxes, first selecting my Cell, then selecting an item from the list available.

When trying this in game, I got my bottle of reserve mead (not sure if activating, or entering the trigger). But it just worked ONCE.

After hitting the "E" key and entering the trigger several times with no more reserve Mead for me, I had the idea of checking the room where my Reserve mead is placed. There were 2 bottles, instead of the 3 I have available.

So, my guess is that this simply "moves" a specific object / reference to the player's inventory. And I don't need that, I need an item TYPE to be CREATED inside player's inventory.

This, I will try later, but just wanted to update with the progress made.
User avatar
Lisa Robb
 
Posts: 3542
Joined: Mon Nov 27, 2006 9:13 pm

Post » Tue Jun 19, 2012 12:05 am

Katixa, I wrote about this in my last two posts. I explained this: ObjectReference points only to ONE, SPECIFIC object placed in the world. In your case you have to use Potion-type Property and assign to it a Base Object. It will create a new reference to this object every time a player uses the barrel.

Proper script should look like this then:
Scriptname KatixaAddAle extends ObjectReference  Potion property Ale AutoEvent OnActivate(ObjectReference akActionRef)	 akActionRef.AddItem(Ale,1)EndEvent
User avatar
Marcus Jordan
 
Posts: 3474
Joined: Fri Jun 29, 2007 1:16 am

Post » Tue Jun 19, 2012 2:03 am

This is amazing... I did some tests, and worked. Edited the code again, and stopped working. I put back the same code as before, and still nothing.

Finally managed to make it work anyway... the best part is that the code is exactly the same as the one I had yesterday... I noticed that the Property had it's value lost, even if I defined it again 2 minutes ago. It was "<< default editor value >>", instead of the item I initially chose. The thing is that if I modified some code on the editor, the property would just get reset or something, so I had to set it back to it's correct item value. This happens for being a newbie...

Thanks for your time Universal.
User avatar
Lisha Boo
 
Posts: 3378
Joined: Fri Aug 18, 2006 2:56 pm

Post » Mon Jun 18, 2012 5:12 pm

You're welcome.

Also, my guess is that while editing the code you changed this Property's type or name... Therefore the game treated it like a new Property.

PS. That barrel was needed for your "Hjerim Cellar" mod? I must say that screenshots look cool.
User avatar
Elizabeth Lysons
 
Posts: 3474
Joined: Fri Feb 02, 2007 7:16 am

Post » Tue Jun 19, 2012 9:16 am

You're welcome.

Also, my guess is that while editing the code you changed this Property's type or name... Therefore the game treated it like a new Property.

PS. That barrel was needed for your "Hjerim Cellar" mod? I must say that screenshots look cool.

Looks like that, because I renamed my property a couple times, so maybe it resets after that. Yesterday I was both changing it from ObjectReference to Potion, etc.. I learned the lesson.

And yes, it was for that mod. I wanted to experiment a bit both with world editing and also trying to add some custom scripts to see how this works.
User avatar
phillip crookes
 
Posts: 3420
Joined: Wed Jun 27, 2007 1:39 pm


Return to V - Skyrim