Jump to content

how to attach a teleport to location from mcm?


3aq

Recommended Posts

Nope doesn't seem to work for me, I put it reference the xmarker infront of the town and renamed the objectreference to XMarker in the script, I even changed the property type to Int, Object, and Reference, still no dice. Back to the drawing board.

Link to comment
Share on other sites

the line

Game.FadeOutGame(false, true, 2.0, 1.0)

shouldn't be affecting it, infact it's probably the only visual cue to tell me that the script is infact running

what this line does is momentarily blacks out the screen while you actually transit to the location at hand.

Link to comment
Share on other sites

You are trying to do the moving while still in the menu. Toggle the bool status when the option is selected and then use the OnConfigClose event to do the moving should the bool variable be of the correct value.

 

There are many functions that won't work while still in menu and could in fact cause the MCM menu to cease functioning especially when moving to another mod's menu without fully exiting back to the game screen.

 

It is okay to set the value of global variables or other property variables within the menu selection but actually manipulating things should be done when the menu closes and the game is no longer paused.

Link to comment
Share on other sites

Thank you for this info.. sadly I don't know how to apply it as I don't quite have the knowledge of OnConfigOpen/Close, for the most part all I have been doing is the OnOptionInit..

 

But I won't let this prevent me, hopefully.. anyways, here's the code I don't think will work.. but is this what you mean by functions operating outside the menu?

Event OnOptionSelect(int a_option)
	If (a_option == aa_01)
			{empty, moved to OnConfigClose()}
	endIf
endEvent

Event OnConfigClose()
	If (a_option == aa_01)
			Game.FadeOutGame(false, true, 2.0, 1.0)
			Game.GetPlayer().MoveTo(XMarker)
	endIf
endEvent
Edited by 3aq
Link to comment
Share on other sites

You misunderstood.

 

OnConfigClose not OnOptionClose. There is no such thing as OnOptionClose.

 

For a working example, take a look at my recently released Inventory Management System Rebuilt mod (the source scripts are packed inside the BSA). It does use the state method so there will be some differences.

 

And if putting it into the OnConfigClose event still does not work, utilize a short update as in the aforementioned example.

Link to comment
Share on other sites

Apologies, I mistyped. Thank you for the correction and moreso for the working example. Will report back, hopefully with good findings.

Link to comment
Share on other sites

here's to hoping I am doing something wrong because it isn't working. :psyduck:

 

the mod (with source and everything): https://ufile.io/mem0k

the code:

 

Scriptname _mcmToRiverwood2 extends SKI_ConfigBase
import UI

ObjectReference Property XMarker Auto

Int function GetVersion()
    return 4
endFunction

Event OnVersionUpdate(int version)
    If version > 1
        OnConfigInit()
    EndIf
EndEvent

int aa_01 ; coc Riverwood
bool bb_01 = false; bool for Riverwood

Event OnConfigInit()
	Pages = new string[2]
	Pages[0] = "About"
	Pages[1] = "Teleport"
EndEvent

Event OnPageReset(string page)
;---SPLASH
	If (page == "")
		loadCustomContent("img_riverwood2/splash.dds", 258, 95)
		return
	else
		unloadCustomContent()
	endIf
;---MENU
	If (page == Pages[0])
		draw_0()
	elseIf (page == Pages[1])
		draw_1()
	endIf	
endEvent

function draw_0()
	setCursorFillMode(TOP_TO_BOTTOM)
	AddHeaderOption("Testing mcm teleport to riverwood2 take 4")
endFunction

function draw_1()
	setCursorFillMode(TOP_TO_BOTTOM)
	AddHeaderOption("To Riverwood2")
	aa_01 = AddToggleOption("Go", bb_01)
endFunction

Event OnOptionSelect(int a_option)
	If (a_option == aa_01)
			bb_01 = !bb_01
			SetToggleOptionValue(aa_01, bb_01)
	endIf
endEvent

Event OnConfigClose()
	if (bb_01 == true)
			Game.FadeOutGame(false, true, 2.0, 1.0)
			Game.GetPlayer().MoveTo(XMarker)
			Utility.Wait(0.1)
			bb_01 = !bb_01
			SetToggleOptionValue(aa_01, bb_01)
                        RegisterForSingleUpdate(0.1)
	endIf
EndEvent


 

 

 

goals :

toggle will go from false to true

after close config will execute fade --> moveto --> reset toggle back to false

 

observed results:

toggles go from false to true

after close config executed fade --> reset toggle back to false.

Edited by 3aq
Link to comment
Share on other sites

Everything else but the moving is working? Then I would look at making sure you assigned the desired pre-placed object to your XMarker property. However, since xMarker is an actual base object name and many uses of it do not assign a new name, chances are if you "auto-filled" the property it could have filled with the incorrect object. But that is just a guess without taking a look at the actual mod itself. I do not have time to do that.

Link to comment
Share on other sites

No need to actually review the test mod, it's there for redundancy's sake.

 

That said I looked through it once more and figured out what was wrong. And as you guessed, CK was retitling the property name. Seems initially I had it set as Xmarker through SSEEdit, then by some oddity saving through CK changed the property as a reference. So my initial assumption is correct, you can moveto anything even "riverwood" itself as I initially did achieve just that (sadly I didn't document how exactly I did it).

BANSL6p.jpg

 

Thank you IsharaMeradin for sticking with me the entire way. I would also like to express my gratitude to Rasikko, and Creatoxx as well. So if the three of you are seeing this, thank you. :happy:

Edited by 3aq
Link to comment
Share on other sites

  • Recently Browsing   0 members

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