Jump to content
ℹ️ Intermittent Download History issues ×

Papyrus - Assistance With Script


SabinXL

Recommended Posts

What are the pros and cons of each example?

Hijacking much? :tongue: Anyway, the first example can be configured to fire when the quest/game starts. The second example will mainly run when you call the function from an objectreference or alias. Usually that would be when the ObjectReference that the script is attached to loads (ie. when the object's parent cell loads). Also, the first example is shorter code and doesn't necessarily require any code to be attached to an alias or objectreference. But they're basically just two different ways to skin the same cat.

Edited by steve40
Link to comment
Share on other sites

Thanks Steve - didn't realize we could nest scripts within scripts, saves me a ton of time not having to re-apply properties :biggrin:.

 

Much appreciate the assistance from you and taleden - I'm going to go and work on the implementation and report my results.

Link to comment
Share on other sites

OK, I feel like i'm 90% there but I'm getting stuck on configuring my alias, it seems...

 

Code I'm using has been updated as follows, below:

 

 

 

Code being attached to the Quest:

Scriptname PSSMI_CraftedSynchArmorIron extends Quest  
; Script purpose is to have the crafted items created by my mod inherit any
; changes made to basic, vanilla armor made by other mods loaded prior.

; Setting up properties to pass in the crafted and original armor sets. 
Armor Property CraftedBoots Auto
Armor Property CraftedGauntlets Auto
Armor Property CraftedCuirass Auto
Armor Property CraftedHelmet Auto
Armor Property CraftedShield Auto

Armor Property OriginalBoots Auto
Armor Property OriginalCuirass Auto
Armor Property OriginalGauntlets Auto
Armor Property OriginalHelmet Auto
Armor Property OriginalShield Auto

Event OnInit()
; Call SynchArmor to perform updates.
SynchArmor()
EndEvent

Function SynchArmor()
; Setting armor value, weight and gold value for each crafted item.
CraftedBoots.SetAR(OriginalBoots.GetAR())
CraftedBoots.SetWeight(OriginalBoots.GetWeight())
CraftedBoots.SetGoldValue(OriginalBoots.GetGoldValue())

CraftedCuirass.SetAR(OriginalCuirass.GetAR())
CraftedCuirass.SetWeight(OriginalCuirass.GetWeight())
CraftedCuirass.SetGoldValue(OriginalCuirass.GetGoldValue())

CraftedGauntlets.SetAR(OriginalGauntlets.GetAR())
CraftedGauntlets.SetWeight(OriginalGauntlets.GetWeight())
CraftedGauntlets.SetGoldValue(OriginalGauntlets.GetGoldValue())

CraftedHelmet.SetAR(OriginalHelmet.GetAR())
CraftedHelmet.SetWeight(OriginalHelmet.GetWeight())
CraftedHelmet.SetGoldValue(OriginalHelmet.GetGoldValue())

CraftedShield.SetAR(OriginalShield.GetAR())
CraftedShield.SetWeight(OriginalShield.GetWeight())
CraftedShield.SetGoldValue(OriginalShield.GetGoldValue())

Debug.MessageBox("Quest Script Finished!")
EndFunction

 

Code being attached to the ReferenceAlias:

Scriptname PSSMI_CraftedAliasArmor extends ReferenceAlias  
; Script purpose is to call the Armor Synch scripts to run 
; on subsequent game loads.  

; Staging quest scripts to call within event. 
PSSMI_CraftedSynchArmorIron Property ArmorScriptIron Auto

Event OnPlayerLoadGame()
; Call defined script properties.
ArmorScriptIron.SynchArmor()
EndEvent

 

 

 

Compiles just fine, and when I run a clean save the quest scripts run without a hitch. The problem is when I save, exit the game and then load the save to see if the Alias script triggers, I get nothing.

 

Below is how I've configured my Reference Alias:

 

http://i50.tinypic.com/5fktnc.png

 

 

I tried using a unique actor and specific reference, but I'm not sure I'm choosing the correct things. Also to note, I attached the alias script which calls the original script, but I can't select anything for the ArmorScriptIron Property... is this normal?

Edited by SabinXL
Link to comment
Share on other sites

Code being attached to the ReferenceAlias:

Scriptname PSSMI_CraftedAliasArmor extends ReferenceAlias  
; Script purpose is to call the Armor Synch scripts to run 
; on subsequent game loads.  

; Staging quest scripts to call within event. 
PSSMI_CraftedSynchArmorIron Property ArmorScriptIron Auto

Event OnPlayerLoadGame()
; Call defined script properties.
ArmorScriptIron.SynchArmor()
EndEvent

 

 

 

Compiles just fine, and when I run a clean save the quest scripts run without a hitch. The problem is when I save, exit the game and then load the save to see if the Alias script triggers, I get nothing.

 

Below is how I've configured my Reference Alias:

 

http://i50.tinypic.com/5fktnc.png

 

 

I tried using a unique actor and specific reference, but I'm not sure I'm choosing the correct things. Also to note, I attached the alias script which calls the original script, but I can't select anything for the ArmorScriptIron Property... is this normal?

 

Did you double check that the PSSMI_CraftedSynchArmorIron property on the script on your ReferenceAlias has been populated?

Link to comment
Share on other sites

I believe I did - checked this:

 

http://i46.tinypic.com/9sq612.png

 

 

I went to go populate the property, but the only thing I can select is NONE. I'm thinking something needs to be selected here (though not sure what), and I'm not quite sure how I need to reconfigure the property in order for options to populate. From steve40's post, I was under the impression that having a property set as the type of my script would do the trick and that I'd be able to figure out what to select in the property options in the dropdown.

Link to comment
Share on other sites

I believe I did - checked this:

 

http://i46.tinypic.com/9sq612.png

 

 

I went to go populate the property, but the only thing I can select is NONE. I'm thinking something needs to be selected here (though not sure what), and I'm not quite sure how I need to reconfigure the property in order for options to populate. From steve40's post, I was under the impression that having a property set as the type of my script would do the trick and that I'd be able to figure out what to select in the property options in the dropdown.

 

You have a script (PSSMI_CraftedSynchArmorIron) attached to a quest (PSSMI_ArmorSynchQuest). In order to get the property to auto-fill how you want, the property type must be the name of the script, and the property name must be the name of the quest to which that script is attached. So try this:

 

PSSMI_CraftedSynchArmorIron Property PSSMI_ArmorSynchQuest Auto

Link to comment
Share on other sites

I believe I did - checked this:

 

http://i46.tinypic.com/9sq612.png

 

 

I went to go populate the property, but the only thing I can select is NONE. I'm thinking something needs to be selected here (though not sure what), and I'm not quite sure how I need to reconfigure the property in order for options to populate. From steve40's post, I was under the impression that having a property set as the type of my script would do the trick and that I'd be able to figure out what to select in the property options in the dropdown.

 

You have a script (PSSMI_CraftedSynchArmorIron) attached to a quest (PSSMI_ArmorSynchQuest). In order to get the property to auto-fill how you want, the property type must be the name of the script, and the property name must be the name of the quest to which that script is attached. So try this:

 

PSSMI_CraftedSynchArmorIron Property PSSMI_ArmorSynchQuest Auto

 

EDIT: Works! Did a bit of digging on how auto-fill works to make sure I understood it, and it's definitely neat. Root cause of my issue was I had the wrong script attached to my quest, so when auto-fill was looking for properties it couldn't actually grab what it was looking for.

 

Thanks again for all the assistance.

Edited by SabinXL
Link to comment
Share on other sites

  • Recently Browsing   0 members

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