Jump to content

Recommended Posts

Posted
  On 6/17/2014 at 8:34 PM, IsharaMeradin said:

I know this is not the comments section of your blog. It is simply easier for me to use the formatting I am familiar with here at the Nexus.

May I point out some problems with the following taken from your blog:

 

  Reveal hidden contents

Your example uses the OnActivate event which means that the player has activated the object. Yet within the OnActivate event you script the object to be activated by the player. That will cause the OnActivate event to run again. Not what you want to have happen.

Now if you used a different event (maybe even a different object) and wanted the container to be opened at that point then you would use that line. This is the basics of how a bag of holding works. Equip one item and it causes the container to be activated. But rarely do you want to activate the same container within that container's activation sequence. You may very well end up with a loop that cannot be exited.

 

For a script that will add an item when a container is activated by the player, this is all you need:

 

  Reveal hidden contents

 

 

For a script that will add an item only when a quest is at a certain stage and the container is activated by the player this is all you need:

 

  Reveal hidden contents

 

 

 

Note that you do not need to make a property for the object that the script is attached to. It automatically can be referred to as Self. There is no else stage needed to allow the player to activate the container for normal use. If the quest stage check fails, it will still open, it just won't add the item in question.

 

Thanks. I'll fix those things.

Posted

Fixed. I originally had the script that was correct (though I was using a property pointing towards the container) before I looked at the tutorial, and my Oblivion modding self kicked in. It's still weird to adjust, but Papyrus is definitely more flexible than TESScript.

Posted
  Quote

 

 

To make the container activate-able in the second, modified script, you have to add Else statement. This means that if one or more of the above conditions is not met, then you should do the thing within the Else statement. I would a commented out line, since the OnActivate() event already activates the item, and I want it to continue doing that. This allows the script to compile with a "blank" line.

 

Else

 

;activate

 

This allows the player to activate it no matter what, but the item will only be added on stage 30. It's generally a good idea to put this in.

Please at least mention that this portion is unnecessary when using the OnActivate event of the container in question. The container has already been activated before it does any of the adding. It may be necessary when called on other events and you want to pass the processing on.

 

Think of it this way:

Container is activated.

If it is the player, it displays the container menu.

Then it checks the IF statements from top down.

When an IF statement is true, it performs that action.

When an IF statement is false, it does not perform that action.

In this scenario, the container has already opened so a failed IF statement simply does not add the gold.

 

All an Else does in this scenario is take up space.

 

 

  Reveal hidden contents

An empty else is automatically assumed by Papyrus. You only need the Else when you actually have something else you want done.

Posted
  On 6/17/2014 at 9:19 PM, IsharaMeradin said:

 

  Quote

 

 

To make the container activate-able in the second, modified script, you have to add Else statement. This means that if one or more of the above conditions is not met, then you should do the thing within the Else statement. I would a commented out line, since the OnActivate() event already activates the item, and I want it to continue doing that. This allows the script to compile with a "blank" line.

 

Else

 

;activate

 

This allows the player to activate it no matter what, but the item will only be added on stage 30. It's generally a good idea to put this in.

Please at least mention that this portion is unnecessary when using the OnActivate event of the container in question. The container has already been activated before it does any of the adding. It may be necessary when called on other events and you want to pass the processing on.

 

Fixed again. Sometimes I think I'm an idiot.

 

Thanks.

Posted
  On 6/18/2014 at 7:48 PM, asdecker said:

The Skyrim CK tutorials were really helpful. Especially the making a quest ones. Thanks.

Good. :D

Posted

I'll probably put this in the main post, too, but I'm moving my blog/tutorial site to a different location on Weebly. The old site will still be there, but I won't be updating it anymore. Once I've moved over fully, I'll update the old site to say so. I'll be moving over all the content from my old blog to the new site, so none of it will be lost.

 

Once the new site is up, I'll update this post. Thanks for reading.

Posted

Mostly finished the new site layout. If you've got any suggestions to make it more readable/better, then feel free to post here.

Posted

Finally moved all the old posts over to the new site. It's fully updated now.

 

The old site URL no longer works. It redirects to the new site.

  • Recently Browsing   0 members

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