Jump to content

Papyrus and General Mod Help


Th4nat0s1s

Recommended Posts

So I am making a house mod and I am trying to do a Fire Salts Forge inside the house, but ONE thing is stopping me, I have no clue how to code the activator to check the storage and then apply a crafting buff.... would the buff apply to the forge or the player? and how much or what should it increase?

 

Any help is much appreciated.....

Edited by Th4nat0s1s
Link to comment
Share on other sites

F:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\TT_Forge_Cup_FireSaltsOnly.psc(4,10): no viable alternative at input '\\r\\n' => LINE 4

F:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\TT_Forge_Cup_FireSaltsOnly.psc(15,6): no viable alternative at input '\\r\\n' => LINE 15

 

These two are because semicolons only comment out the line behind them, not lines in between. So place one before PROPERTIES and EVENTS

 

F:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\TT_Forge_Cup_FireSaltsOnly.psc(22,6): required (...)+ loop did not match anything at input 'akBaseItem' => LINE 22

 

Which is "ElseIf akBaseItem == FireSalts ;Enable" the property type "item" you used for FireSalts isn't right i think, should be ingredient, weapon, armor, miscobject, etc maybe that's why it's failing.

 

In any case, why not check only if it's a fire salt, if it is enable and such, if not, send it back, why the VendorItemKey thing?

you could also use this: http://www.creationkit.com/index.php?title=AddInventoryEventFilter_-_ObjectReference

Edited by FrankFamily
Link to comment
Share on other sites

Oh my god, thank you so much, it worked... all of it

 

 

EDIT: UPDATE, soooo... I thought it worked but upon testing.... it seems to pass all items into the container EXCEPT the Fire Salts...

 

Rightn ow I am reworking the script and its looking more like this...

 

 

ScriptName TT_Forge_Cup_FireSaltsOnly extends ObjectReference

;===========
;PROPERTIES
;===========
Keyword Property VendorItemKey Auto
Keyword Property VendorItemIngredient Auto
Ingredient Property FireSalts Auto
ObjectReference Property TT_Forge_Cup_FireSaltsDepo Auto
;==========
;EVENTS
;==========
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
If akBaseItem.HasKeyword(VendorItemKey) ;Restrict
RemoveItem(akBaseItem, aiItemCount, True, akSourceContainer)
debug.notification("That doesn't go there....")
Else akBaseItem == FireSalts ;Enable
TT_Forge_Cup_FireSaltsDepo.AddItem(FireSalts)
debug.notification("Fire Salts Added")
EndIf
EndEvent
Edited by Th4nat0s1s
Link to comment
Share on other sites

But what's is TT_Forge_Cup_FireSaltsDepo?

 

One issue on that: "Else akBaseItem == FireSalts ;Enable" should be "elseif" if there's a condition after it.

 

If the container should only accept fire salts, just this would work. If the item is anything other than fire salts send it back, otherwise (it is a fire salt) keep it.

Ingredient Property FireSalts Auto

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

So I dont even need the ObjectReference for the chest with this?

 

And out of curiosity, how would you go about setting up the switch? It would have to run a check on the chest to make sure there are enough I assume, then cast a Smithing buff on the player? Or how would that work?

Edited by Th4nat0s1s
Link to comment
Share on other sites

Some of your post contents have been modified so I'm not exactly sure but am going to go out on a limb and guess that you are wanting to have a workstation that applies a buff to the player depending upon the quantity of fire salts stored in a particular container. Correct?

 

If that is the case, I see a two layer activation approach.

 

An activator surrounding the workstation (a trigger volume box set up as an activator - this is what they player would click) has a script which checks for the quantity of fire salts in the appropriate container. Depending upon the number, apply the buff to the player. Then once the buff is applied have the script activate the actual workstation so that the player can craft whatever.

 

Maybe something like (untested for compilation or functionality):

ObjectReference Property FireSaltsCont Auto
ObjectReference Property Workstation Auto
Ingredient Property FireSalts Auto
Int Property RequiredCountForBuff Auto
 
Event OnActivate(ObjectReference akActivator)
  If akActivator == Game.GetPlayer()
    If FireSaltsCont.GetItemCount(FireSalts) >= RequiredCountForBuff
      ;apply buff -- i do not know if you are using perk or spell
      Utility.Wait(0.25)  ;a small wait just to make sure the buff gets applied before the workstation gets activated
    EndIf
    Workstation.Activate(akActivator)  ;have workstation be activated by player whether or not they got the buff
  EndIf
EndEvent

The latest script snippet that FrankFamily posted would work perfectly on your fire salts container in order to allow only fire salts to be added.

 

EDIT: Just noticed that I don't have a means to remove/cancel the buff. That can't be done in this specific snippet. But if you don't mind requiring SKSE, then the workstation menu can be registered and when closed have the buff removed/canceled.

Edited by IsharaMeradin
Link to comment
Share on other sites

Ok, so I thought it would probably be easier to have it apply a buff to the player that had a set time limit, because I thought it would be harder to have a workstation that improves smithing quality?/level?/etc on use. In which case I might not need to require SKSE (even though I will probably tell people to DL it for good measure anyways... especially sense my mod will require RaceCompatability mod for a custom race house NPC) but anyways, if it does require, it shouldnt be an issue. I am sorry if I osund like a papyrus newb, but I am.... >_<

Link to comment
Share on other sites

How about a trigger volume that triggers when the players get close to the workstation, adding/removing the buff would be handled ontriggerenter/leave, as long as the buff is added silently the player would not even notice that the buff is added and removed even if he just walks close to the workstation with no intention of activating it.

Scriptname lwlalala extends ObjectReference  

Int InTrigger = 0
;buff property
Ingredient Property FireSalts Auto
ObjectReference Property FireSaltsCont Auto
Int Property RequiredCountForBuff Auto

Event OnTriggerEnter(ObjectReference akTriggerRef)
if (InTrigger == 0) && (akTriggerRef == PlayerREF) && (FireSaltsCont.GetItemCount(FireSalts) >= RequiredCountForBuff)
InTrigger = 1
;add buff
endif
EndEvent

Event OnTriggerLeave(ObjectReference akTriggerRef)
if (InTrigger == 1) && (akTriggerRef == PlayerREF)
InTrigger = 0
;remove buff
endif
EndEvent
Edited by FrankFamily
Link to comment
Share on other sites

Yeah, I guess that could work.... I was looking at an example inside of another house mod I like to use http://www.nexusmods.com/skyrim/mods/34834/? but when I tried to open the script thats tied to his forge it crashed my CK. But from what I saw, it looks like his script calls on a spell of Fortify Blacksmithing, and he also has one for his alchemy workbench that calls on a spell of Fortify Alchemy. Also, I found it interesting that he has two levels of each.... so I am curious if I could write it like this.....

Ingredient Property FireSalts Auto
ObjectReference Property TT_Forge_Cup_FireSaltsDepo Auto
;Int Property BummAmt Auto {How do I specify this amount as an Integer??}

Event OnActivator(ObjectReference akActivator)
      If TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) >= 10 ;and I would want to specify 10 Fire Salts here
            player.addspell(TT_Forge_GreaterFortifyBlacksmithing) ;The spell that I make in CK can be given a time limit I believe....
      ElseIf TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) < 10 && (TT_Forge_Cup_FireSaltsDepo.GetItemCount(FireSalts) >= 5) ;Here it would find that if I had less than 10 FireSalts but at least 5 then....
            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

Maybe this would work?

Edited by Th4nat0s1s
Link to comment
Share on other sites

  • Recently Browsing   0 members

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