Jump to content
⚠ Known Issue: Media on User Profiles ×

Scripting Questions


Mattiewagg

Recommended Posts

Alright. From now on, I'll be posting any questions I have about certain aspects of scripting here. Mostly, it'll be for my WIP mod Immersive Quests, but there might be some other questions thrown in here too. I'll cross out any of the questions that are answered. Here we go:4

 

  • Is there a better way to disable the walk away option than disabling player controls in the Begin Fragment of dialogue, and then re-enabling them?
  • Is there anything specific I need to do to make it so my mod doesn't require SkyUI, but if you have SkyUI installed there will be an MCM? Thanks to Ishara for answering the question.

 

On a separate note, does anyone know if you can use BBCode to create a sublist? For example, I have a numbered list, and then a bulleted sublist inside number 1, or something like that. So like this:

 

1)

2)

Bullet:

Bullet:

3)

Edited by Matthiaswagg
Link to comment
Share on other sites

 

 

Is there anything specific I need to do to make it so my mod doesn't require SkyUI, but if you have SkyUI installed there will be an MCM?

Yes. Plan the mod to use an MCM but make every single option utilize a global variable to store a numerical value that indicates to the rest of the mod what should be done. The MCM then becomes a convenience UI for using the console to set a series of global variables. Users without SkyUI and MCM can use the console to tweak the mod to their liking (or use your preset values). Users with SkyUI and MCM can use the MCM menu to tweak the mod to their liking.

 

Alternatively, make the mod without an MCM then graft an MCM menu on by adding global variables for the various tweakable options.

Link to comment
Share on other sites

 

 

 

Is there anything specific I need to do to make it so my mod doesn't require SkyUI, but if you have SkyUI installed there will be an MCM?

Yes. Plan the mod to use an MCM but make every single option utilize a global variable to store a numerical value that indicates to the rest of the mod what should be done. The MCM then becomes a convenience UI for using the console to set a series of global variables. Users without SkyUI and MCM can use the console to tweak the mod to their liking (or use your preset values). Users with SkyUI and MCM can use the MCM menu to tweak the mod to their liking.

 

Alternatively, make the mod without an MCM then graft an MCM menu on by adding global variables for the various tweakable options.

 

 

Thank you for answering that :smile:. It wouldn't be much of an MCM, really. Just one or two options to toggle quest markers on and off.

Link to comment
Share on other sites

 

 

 

Is there anything specific I need to do to make it so my mod doesn't require SkyUI, but if you have SkyUI installed there will be an MCM?

Yes. Plan the mod to use an MCM but make every single option utilize a global variable to store a numerical value that indicates to the rest of the mod what should be done. The MCM then becomes a convenience UI for using the console to set a series of global variables. Users without SkyUI and MCM can use the console to tweak the mod to their liking (or use your preset values). Users with SkyUI and MCM can use the MCM menu to tweak the mod to their liking.

 

Alternatively, make the mod without an MCM then graft an MCM menu on by adding global variables for the various tweakable options.

 

Is there a console command to set a global value? I looked in the Console Commands page, but I didn't find any.

 

Ah, nevermind: set global to value

Edited by Matthiaswagg
Link to comment
Share on other sites

  • 2 weeks later...

Alright. I've got another issue. So I'm trying to make the player read a note, but it has to be forced. They don't get to choose to read the note. So I thought you could do something like "Book.Activate(Game.GetPlayer())" but that doesn't seem to work. Here's the whole script, so you can help me correct any other glaring errors you see:

 

 

Scriptname IQ02PackageScript extends ReferenceAlias  
{Called when the player tries to open the package.}

Message Property OpenConfirmation Auto 
{Called when you say yes to opening the package. 0 is cancel, 1 is open, 2 is read the note.}
Message Property PackageOpenMessage Auto 
{Called when you equip the package. 0 is exit, 1 is read note, 2 is open.}
Book Property CourierNote Auto 
Actor Property PlayerREF Auto 
Weapon Property Cutlass Auto 
Armor Property Buckler Auto 

Event OnEquipped(Actor akActor)

	If akActor == PlayerREF

		Int iButton = PackageOpenMessage.Show()

		While iButton 

			If iButton == 1

				CourierNote.Activate(PlayerREF)
				
				If PlayerREF.GetItemCount(CourierNote) == 0

					PlayerREF.AddItem(CourierNote, 1)

				EndIf

			ElseIf iButton == 2

				iButton = OpenConfirmation.Show()

				While iButton

					If iButton == 1

						PlayerREF.AddItem(Cutlass, 1)
						PlayerREF.AddItem(Buckler, 1)
						PlayerREF.RemoveItem(Self.GetReference(), 1)

					ElseIf iButton == 2

						CourierNote.Activate(PlayerREF)

						If PlayerREF.GetItemCount(CourierNote) == 0

							PlayerREF.AddItem(CourierNote, 1)

						EndIf

					EndIf

				EndWhile

			EndIf

		EndWhile

	EndIf

EndEvent 

 

 

 

Compiler Errors:

 

 

Starting 1 compile threads for 1 files...
Compiling "IQ02PackageScript"...
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\IQ02PackageScript.psc(23,16): Activate is not a function or does not exist
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\IQ02PackageScript.psc(45,18): Activate is not a function or does not exist
No output generated for IQ02PackageScript.psc, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on IQ02PackageScript.psc
[Finished in 1.1s with exit code -1]

 

 

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

Book is a form type while activate runs on an object reference. You need to either make the book a persistent reference (for example by putting it in an alias) or place it in the world to use activate.

Ended up doing that. Thanks.

Link to comment
Share on other sites

Let me know if that works when you test it, was actually about to say the same thing and just do a getref call, but I don't know if it will work exactly and would be cool to get something to work like that in discworld

I created a holding cell (duplicated CTestCell, renamed it, I'll remove the changed flag on CTestCell in TES5Edit later), placed my note on a table, and used a specific reference alias on it. Then I called it like so:

 

 

MyNote.GetReference().Activate(Game.GetPlayer())

 

Works perfect. You could do a Create Reference in Object as well, I presume. Any alias type.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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