delgathar Posted July 26, 2015 Posted July 26, 2015 Hey, Another Noob scripting question incoming. I've finished my MCM status window that I'm using as a control. Now I want to create perks and scripts for various checks to activate OnItemAdded etc.. I'm figuring now is the time to go ahead and set the MCMquest aside and make another script container quest. Is a script container quest necessary or just better from an OOP perspective? Or should I just keep everything tied to my MCM quest? The creation kit tutorial and most quest tutorials are for making standard quests. What about container quests. How can some of the quest options e.g. Quest Data, Quest Stages, be useful or be made useful for a background utility quest? Thank you.
Guest Posted July 26, 2015 Posted July 26, 2015 Hello. Having a specific quest to hold your main script is a good thing. This will enable you to differentiate the different items of your mod. E.G.: * A quest specific for the MCM * A quest as main script container * A "player" quest with stages if you need one Keeping them separate will also make more easy to update and improve them.
delgathar Posted July 26, 2015 Author Posted July 26, 2015 Thank you. In reference to what I read in Redit "If you attach scripts to a quest alias (such as the player alias), as soon as the mod is uninstalled, the quest stops running, the alias no longer exists, and the script is automatically dropped. Clean uninstall. This applies to any type of quest alias and is extremely useful." Does this mean it is better to create a player alias in my Quest Aliases tab and add scripts in the Papyrus Scripts box as opposed to adding them in the scripts tab? I'm assuming that I need to add a playeralias to my quest if I'm going quering player info and making adjustments to speed etc. Can I leave the scripts tab entries blank and put everything under PlayerAlias? Thank you.
Guest Posted July 26, 2015 Posted July 26, 2015 It is exactly the same. Scripts attached to ReferenceAliases and Quests get discarded when the main object does not exist anymore. But you have to be sure that: 1) The script is not registered for events 2) The script is not actually running If any of the previous condition fail, then the script is still stored in the savegame as orphan script. Scripts attached to quests will inherit the quest methods, events, and properties. Scripts attached to an alias will inherit from the alias (and the actor.)
delgathar Posted July 26, 2015 Author Posted July 26, 2015 Alright, so it sounds like adding a stopquest to my MCM menu is the most uninstall friendly way to make my mod. Thank you. I am just not understanding how Aliases are used here. I understand alias as "instead of" so AV is an alias for ActorValue But when I look at alias scripts, they seem completely different. Examples from another post in LL by B3lisario to help another modder. Don't worry the examples are short. Main Script example: Scriptname AE_Quest_Script extends Quest Armor[] Property armorToEquip Auto Event OnInit() CheckArmors() EndEvent Function CheckArmors() Actor player = Game.GetPlayer() int i = armorToEquip.length While (i > 0) i -= 1 int slotMask = armorToEquip[i].GetSlotMask() Armor current = player.GetWornForm(slotMask) as Armor if current == None player.equipitem(armorToEquip[i]) endif EndWhile EndFunction Alias script example: Scriptname AE_Alias_Script extends ReferenceAlias AE_Quest_Script Property QuestScript Auto Event OnPlayerLoadGame() QuestScript.CheckArmors() EndEvent Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference) QuestScript.CheckArmors() endEvent Somewhat germain because I'm making my own CheckArmors() function to make sure only cloth is worn. So alias scripts aren't just doing the same thing or changing the name, they have a different purpose. So, what is the purpose of an Alias script? The wiki tutorial is all about an alias to a normal quest, but I don't see the correlation to a utility quest.Thank you.
Guest Posted July 26, 2015 Posted July 26, 2015 Quests and ReferenceAliases are different objects. And they have different events. The "OnPlayerloadGame()" event, is sent to the ReferenceAliases that hold the specific actor "Player". Quests (and any other script) will NOT receive this event. So, reading belisario's code: * the utility function "CheckArmor()" is defined in a main quest script (correct place.) * a game load event is catch by defining the event method inside a script that is attached to the ReferenceAlias. This script will call the main function inside the quest. * another event is catch when the player will unequip something. To have this event you need to do it on: * - An Actor [bad choice is it is the player] * - An ObejctReference [pretty much impossible and a really bad idea to attach a script to the PlayerRef] * - A RefferenceAlias that is pointing to the player [this is the good choice.] A ReferenceAlias is just a pointer to an actor. It is used to have generic actors that do something, or to attach scripts to actors without touching the actual NPC. Because you can dynamically attach NPCs to ReferenceAliases, this is a really easy way to dynamically add factions/packages/scripts/etc. to a NPC. Player included.
delgathar Posted July 26, 2015 Author Posted July 26, 2015 Thank you. I'm going to spend some time mulling over what you said now.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.