Jump to content

Papyrus and General Mod Help


Th4nat0s1s

Recommended Posts

Sure, you could have multiple levels, you don't need so many conditions though since elseif only runs if the above wasn't true:

      If TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) >= 10
            player.addspell(TT_Forge_GreaterFortifyBlacksmithing).
      ElseIf TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) >= 5
            player.addspell(TT_Forge_LesserFortifyBlacksmithing)
      Else
            debug.notification("You don't have enough to charge the forge...")
      EndIf

The thing is that addpsell is not cast, so if you addspell a fire and forget spell with duration it's going to add the spell to your spell list as if ou intended to cast it. Here you want to add an ability, which is constant, so you need a way to remove the spell once done. And in any case a method with duration would have the issue of finishing while on the forge, right?

That's why i suggested the get-close trigger thing since it offers an easy way to remove the spell. Another option of course is registering for the menu closing with skse as IsharaMeradin said.

Edited by FrankFamily
Link to comment
Share on other sites

UPDATE: Ok, so after writing out the script and trying to compile it in CK this is what I got...

 

 

Starting 1 compile threads for 1 files...

Compiling "TT_Forge_BuffSwitch"...
F:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\TT_Forge_BuffSwitch.psc(8,6): mismatched input 'Property' expecting FUNCTION
F:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\TT_Forge_BuffSwitch.psc(0,0): error while attempting to read script TT_Forge_BuffSwitch: Object reference not set to an instance of an object.
No output generated for TT_Forge_BuffSwitch, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on TT_Forge_BuffSwitch

 

And this is the script as is right now

 

ScriptName TT_Forge_BuffSwitch extends ObjectReference


;==========
;PROPERTIES
;==========


Spell Property TT_Forge_LesserFortifyBlacksmithing
Spell Property TT_Forge_GreaterFortifyBlacksmithing


Ingredient Property FireSalts Auto


Int Property BuffAmt Auto


ObjectReference Property TT_Forge_Cup_FireSaltsDepo Auto


;======
;Events
;======


Event OnActivator(ObjectReference akActivator)
      If TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) >= 10
            player.addspell(TT_Forge_GreaterFortifyBlacksmithing)
      ElseIf TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) < 10 && (TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) >= 5)
            player.addspell(TT_Forge_LesserFortifyBlacksmithing)
      ElseIf TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) < 5
            debug.notification("You don't have enough to charge the forge...")
      EndIf
EndEvent

Not sure what the first error is talking about but I am pretty sure the second one is because I havent set it to a switch yet, but I could be wrong.

Link to comment
Share on other sites

UPDATE::

 

So, after figuring out the code (I HOPE)

 

ScriptName TT_Forge_BuffSwitch extends ObjectReference


;==========
;PROPERTIES
;==========


Spell Property TT_Forge_LesserFortifyBlacksmithing Auto
Spell Property TT_Forge_GreaterFortifyBlacksmithing Auto


Ingredient Property FireSalts Auto


Int Property MaxBuffAmt = 10 Auto
Int Property MinBuffAmt = 5 Auto


ObjectReference Property TT_Forge_Cup_FireSaltsDepo Auto


;======
;Events
;======


Event OnActivator(ObjectReference akActivator)
      If TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) >= MaxBuffAmt
            Game.GetPlayer().AddSpell(TT_Forge_GreaterFortifyBlacksmithing)
debug.notification("The forge bursts to life!")
      ElseIf TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) >= MinBuffAmt
            Game.GetPlayer().AddSpell(TT_Forge_LesserFortifyBlacksmithing)
debug.notification("You see the flames brighten slightly in the forge...")
      ElseIf TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) < MinBuffAmt
            debug.notification("You don't have enough to charge the forge...")
      EndIf
EndEvent

So, now my issue is that I cant figure out how to get the button I am trying to use (ImpButton01) to actually activate..... any help??

 

EDIT:: Also, to top it off my container script wont allow me to put Fire Salts in for some reason... but looking at it, it should be fine...

 

ScriptName TT_Forge_Cup_FireSaltsOnly extends ObjectReference


;===========
;PROPERTIES
;===========


Ingredient Property FireSalts Auto


;==========
;EVENTS
;==========


Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
If akBaseItem != FireSalts 
RemoveItem(akBaseItem, aiItemCount, True, akSourceContainer)
EndIf
EndEvent
Edited by Th4nat0s1s
Link to comment
Share on other sites

Did you add the script to the placed reference of the button rather than the base object?

Don't want every instance of that button trying to run your script. :P

 

Did you assign data to the property variables by opening the property window via the property button?

The script can't do anything if it has no actual data to work with.

 

Are you testing on a clean save or new game?

There are a lot of things that don't like to work properly when the area being edited/tested has already been loaded into the save file.

Link to comment
Share on other sites

Did you add the script to the placed reference of the button rather than the base object?

Don't want every instance of that button trying to run your script. :tongue:

 

Did you assign data to the property variables by opening the property window via the property button?

The script can't do anything if it has no actual data to work with.

 

Are you testing on a clean save or new game?

There are a lot of things that don't like to work properly when the area being edited/tested has already been loaded into the save file.

 

I made a copy of the base item to apply the script to, complete with new name and RefID

 

I am assuming you mean by editing the script in CK and acctually (for example) sellecting the FireSalts property and then using the drop down to select FireSalts?

 

Yes, clean save, but with other mods, though I dont know why they would conflict seeing as I am using very simple scripts...

Link to comment
Share on other sites

little typo...

Event OnActivator(ObjectReference akActivator)

should be...

Event OnActivate(ObjectReference akActivator)

 

Wow! Good eye! Thank you!

 

UPDATE:: Ok, so now the problem seems to be that when I press the button it does not a) Consume the Fire Salts and b)Apply the buff..... I will be working on it, but any help is appreciated!

Link to comment
Share on other sites

You haven't added fire salt consumption, right?, something like this for example:

Event OnActivate(ObjectReference akActivator)
      If TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) >= MaxBuffAmt
            Game.GetPlayer().AddSpell(TT_Forge_GreaterFortifyBlacksmithing)
            TT_Forge_Cup_FireSaltsDepo.RemoveItem(FireSalts, MaxBuffAmt)
           debug.notification("The forge bursts to life!")
      ElseIf TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) >= MinBuffAmt
            Game.GetPlayer().AddSpell(TT_Forge_LesserFortifyBlacksmithing)
            TT_Forge_Cup_FireSaltsDepo.RemoveItem(FireSalts, MinBuffAmt)
            debug.notification("You see the flames brighten slightly in the forge...")
      ElseIf TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) < MinBuffAmt
            debug.notification("You don't have enough to charge the forge...")
      EndIf
EndEvent

As for the buff not being added, the script looks fine, if all properties are filled i'd check the actual spell. is it a constant self ability? also, check the magic effect , should be constant and self too and not have the HideUI flag if you want it to show in the active effects tab.

Edited by FrankFamily
Link to comment
Share on other sites

  • Recently Browsing   0 members

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