Jump to content

SpeedMult AV Conflict Between Scrolling Speed Continued & Armor Enchantments


SojournerOne

Recommended Posts

Papyrus is much more forgiving on order than say LUA (still cannot figure out LUA). For me it makes logical sense to start first with the event where I "hook" into the game (i.e. what will trigger my mod script to start) and then go from there.

 

For example, I made the OnInit block to handle setting up the mod. But then I later needed to re-run that code at following sessions, so it got moved to a function which I could then call from the player alias script. Same with the OnKeyDown event. Set it up initially, realized that there was the need for duplicate code, created a function. Then discovered that I needed to import the SafeProcess function from another mod of mine.

 

It is sort of like Basic with its Goto command where you can jump ahead to a later added section then jump back to where it had been to continue what was previous.

Link to comment
Share on other sites

I don't know if there is a way to easily reset the SpeedMult to the "initial value" during momoents like these:

 

 

Event OnOptionSelect(int option)
	if (option == toggle_B)
		toggle = !toggle
		SetToggleOptionValue(toggle_B, toggle)

		if (toggle == True)
			PlayerRef.AddSpell(_ScrollingSpeedIsFirstPVSPL,false)
			RegisterForKey(key_faster) ;Scroll UP
			RegisterForKey(key_slower) ;Scroll DOWN
			RegisterForKey(key_modifier) ;Shift
		else
			PlayerRef.ForceActorValue("Speedmult", 100)
			PlayerRef.RemoveSpell(_ScrollingSpeedIsFirstPVSPL)
			Game.GetPlayersLastRiddenHorse().ForceActorValue("Speedmult", 100)
			UnregisterForKey(key_faster) ;Scroll UP
			UnregisterForKey(key_slower) ;Scroll DOWN
			UnregisterForKey(key_modifier) ;Shift
			PlayerRef.ModActorValue("InventoryWeight", 1)
			PlayerRef.ModActorValue("InventoryWeight", -1)
			Game.GetPlayersLastRiddenHorse().ModActorValue("InventoryWeight", 1)
			Game.GetPlayersLastRiddenHorse().ModActorValue("InventoryWeight", -1)
			UnregisterForAllControls() 

 

 

 

using just the script, especially due to the fact that the enchantments I applied to the Bandolier / Campfire objects can change the SpeedMult when unequipped or swapped with another item of greater or lesser magnitude, and beyond that, I can't even think of a way to be able to account for all four of the SpeedDiffs. It's worse in the original script, as there are up to 8 options available, and I think Sthaag is going to make the number of possible speeds open to player choice in a future update.

 

I was thinking I should have put something into the enchantments that would make the game constantly make sure the effects are being applied, but that won't help if ModActorValue or ForceActorValue happens... This is very tricky.

Edited by SojournerOne
Link to comment
Share on other sites

The smarter design since only one speed could be applied at any one time would have been to store the selected speed within a global variable. The the value of the global variable could be used to increase or decrease the speed as needed with ModActorValue upon exit of the MCM menu. But that is a lot of rewriting of someone else's script. Not something I am interested in doing especially if that author intends on making further changes.

 

If each of your bandolier / campfire objects use ModActorValue to increase / decrease as needed when equipped / unequipped then you do not need to worry about interaction between them. They'll automatically adjust the value as needed. Its the ForeActorValue usage in other mods that could cause issues. Even so, if the player activates the mod with ForceActorValue first, they can freely use anything with ModActorValue after that. They just need to make sure that they stop using anything with ModActorValue before making any changes to a mod using ForceActorValue.

 

It can be annoying but sometimes it is easier / smarter to instruct users to interact with mods in a specific order. Thus if they screw it up, it is on them for not paying attention.

Link to comment
Share on other sites

GlobalVariables are used in a variety of ways so there will most likely not be a single script that can provide a good example of all possible uses.

 

GlobalVariables are sometimes used as switches. In this case, the GV is given explicit values with SetValue and / or SetValueInt and specific actions take place at some future point when the result of GetValue and / or GetValueInt is compared against the desired value.

 

Other times a GV is used to track the progress of a gathering style quest. In this case, Mod should be used to change the current value up or down.

 

GlobalVariables are also able to be used as conditions for spells and other things. This makes them a viable method of communicating whether or not certain non-papyrus driven mechanics can perform a specific action.

 

GlobalVariables can also be used to indicate the status of something that is not accessible via papyrus itself. For example, there is no way to determine whether the player is currently in first person or third person. My 1st Person Check tutorial / resource demonstrates one method of passing this status into script from a spell effect by means of a GV.

 

Since GlobalVariables are stored in an actual record within the ESP / ESM file, they can be assigned to properties and allow the passing of values / status / etc between scripts without actually linking the scripts.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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