Remove Smithing Inged. Requirement Temporarily

Post » Wed Jun 20, 2012 8:03 am

Hello again everybody, I have another quick question for a mod that I am working on. My question is two fold:

First: Is there a way to temporarily remove all ingredient requirements for a crafting station via scripting, or would I have to create a new kind of crafting station and make new copies of the recipes that don't require ingredients?

Second: How would I go about modifying the smithing skill of the player temporarily (without an enchantment) when a crafting station is activated? As I understand it, the code would look something like this:
Scriptname AAATestScript extends ObjectReferenceEvent OnActivate(ObjectReference akActionRef)	           Modify Smithing Skill -50%	          On Menu close    	    Restore Smithing SkillEndEvent

As you can tell I'm pretty new at this. I know what I want it to do and how to set it up, but I can't find the specific commands to do it. Does anyone know if it is even possible?

Thanks in advance for your help.
User avatar
Matthew Barrows
 
Posts: 3388
Joined: Thu Jun 28, 2007 11:24 pm

Post » Wed Jun 20, 2012 5:49 am

I don't know about the recipes, but the easiest way to modify the smithing skill is via a spell, fired from a script.

1. Create a magic effect, type fire and forget, target self, Value modifier (if it's supposed to stack, else use a peak value modifier).
There are 3 things you can affect: Smithing (this will modify the smithing skill directly by points); SmithingMod (Presumably, this modifies the maximum improvement you can get on a weapon by %); SmithingPowerMod(This modifies the power of smithing modifiers by %).
Tick the box "detrimental" if you want to reduce these modifiers. I am not sure what exactly the difference between SmithingMod and SmithingPowerMod is. For spells, Mod affects mana costs and PowerMod affects strength.

2. Now create a spell and give the magic effect to the spell with the desired magnitude and duration. if you want to decrease smithing by a percentage, see below.

3. in your script, do:
spell property smithyspell auto  event onActivate(ObjectReference akActrionRef)  smithyspell.cast(Game.getplayer(), game.getplayer()endevent

easy as that. the trouble is attaching that script to every workstation, but I am not good with aliases, so I'll let someone else figure that out.

4. Now if you want say a 50% decrease in smithing, you need to go an extra mile. Since the value modifier is not percentage based, you will need the following:
Add a new keyword to your magic effect, name it something like Perksmithyscaling
create a new perk
create a perk effect select "mod spell magnitude" as entry point and "set to actor value mult" as function
have the spell magnitude set to smithing x 0.5
under the spell conditions tab, add a condition for "haskeyword" perksmithyscaling == 1
Change your script to look like this:
spell property smithyspell autoperk property smithyperk autoevent onActivate(ObjectReference akActrionRef)  if game.getplayer().hasperk(smithyperk) == 0    game.getplayer().addperk(smithyperk)  endif  smithyspell.cast(Game.getplayer(), game.getplayer()endevent
User avatar
Bones47
 
Posts: 3399
Joined: Fri Nov 09, 2007 11:15 pm

Post » Wed Jun 20, 2012 6:52 pm

Thanks so much for your response. I've been playing around with your scripts (both variations) and I am seeing results, but I'm not sure I fully understand WHY they are working. So if you don't mind, let me see if I can explain it back to you.

spell property smithyspell autoperk property smithyperk auto

Here you are just declaring the variables - simple.

event onActivate(ObjectReference akActrionRef)

Set this script to fire when activated (in this case it is actually activated by another script)

if game.getplayer().hasperk(smithyperk) == 0	game.getplayer().addperk(smithyperk)  endif
I believe this means that IF the player does not have the perk that I created, then he is given the perk.

The perk has been set up to multiply the players smithing skill by .5, cutting it in half.

smithyspell.cast(Game.getplayer(), game.getplayer())

Here, the spell that knocks the players smithing skill down is cast. Now, I don't understand why this is needed WITH the perk. Can't they act independently? I guess my greatest source of confusion is understanding how the spell and the perk interact. When I removed the spell line from the script, nothing happened, but the spell itself works well, albiet a little unpredictably. It's hard to determine how many points it will knock your smithing skill down, as the magnitude of the spell does not correlate to the number of points.

So far, I have been unable to cut the smithing skill down by 50 percent. I always seems to go WAY over that.

Also, wouldn't the perk need to be removed at the end of the script if this is to be a temporary effect?

I really appreciate your help, and I'm sorry that it took me a while to respond, I just wanted to see if I could figure out as much as possible before asking for more help.

EDIT: I got the 50% percent drop working correctly (needed to set spell duration to only 1 sec), the problem is that the drop seems to be permanent. How can I return the smithing skill to normal after the menu is closed?

Any more help you could provide would be much appreciated.
User avatar
Mimi BC
 
Posts: 3282
Joined: Sat Oct 07, 2006 10:30 pm

Post » Wed Jun 20, 2012 9:42 am

You got the script pretty much right, but the perk works differently:
The perk actually affects the spells you cast, not your smithing value. What it does is if it finds a spell with the specified keyword, it will set that spells magnitude (the strength of it's effect) to smithing x 0.5, in other words 50% of your smithing skill. That is why the condition on the perk is important, else all your spells will suddenly have a magnitude of 50% of your smithing skill.
since your newly created spell should be the only spell with that keyword, it will only affect that spell, setting its magnitude to 50% of your smithing spell, no matter what magnitude you have specified in the spell. If the box "detrimental" is checked, your smithing skill should reduce to 50%.
You could remove the perk afterwards, but since the perk does nothing but interact with your spell, that is not needed. Just be carefull that no other spells have that keyword and that your magic effect has no school and no other keywords.
User avatar
Catharine Krupinski
 
Posts: 3377
Joined: Sun Aug 12, 2007 3:39 pm

Post » Wed Jun 20, 2012 7:28 am

Thanks, that really helps me understand why it works the way it does. I still can't figure out how to make this a temporary effect though.

I'm also finding that the first Item modified is unaffected by the drop in the skill level, but any subsequent items are.

Another problem is that the effect stacks, meaning every time the station is used, it permanently cuts the users smithing skill in half; obviously a bad situation.

Anybody have any ideas how these can be resolved?

EDIT: Would a simple script that did something like this work?

Scriptname AAABase extends ObjectReferenceint newValint oriGinalevent onActivate(ObjectReference akActrionRef)     oriGinal=player.av smithing     newVal = orig * .5     player.av smithing = newVal     {bring up the menu here}     player.av smithing = oriGinalendevent

I mean obviously most of that is placeholder until I can find the proper scripting commands, I'm really just using my java experience for this, but logically it could work. Any thoughts?
User avatar
Laura Wilson
 
Posts: 3445
Joined: Thu Oct 05, 2006 3:57 pm

Post » Wed Jun 20, 2012 7:27 am

Use Peak value modifier instead of value modifier, the second AV needs to be set to a keyword then, I would use magicalchfortifysmithing

If you set the magic effect to fire and forget, you should be able to give it a duration in the associated spell.
User avatar
Rebekah Rebekah Nicole
 
Posts: 3477
Joined: Fri Oct 13, 2006 8:47 pm

Post » Wed Jun 20, 2012 6:20 pm

The thing is that I am already using Peak Value Modifier on the spell, and the duration is only a single second.

I'll set up the second AV and see if the helps.
User avatar
Megan Stabler
 
Posts: 3420
Joined: Mon Sep 18, 2006 2:03 pm

Post » Wed Jun 20, 2012 5:02 am

Yeah, the second AV is required, otherwise peak value modifier is like a value modifier. The second AV tells the effect which effects NOT to stack with.

That duration thing is strange though.. Of course, I just realized you can get the same effect without a perk if you just attach a scipt that directly mods the player's smithing AV...

It is strange that the effect does not go away though. it should expire normally.
User avatar
Andrea Pratt
 
Posts: 3396
Joined: Mon Jul 31, 2006 4:49 am

Post » Wed Jun 20, 2012 7:30 am

Yea, I think I'm going to try to eliminate the need for the perk and the magic effect. Plus, modifying smithingmod seems to be working much better than modifying the smithing skill directly. As far as I can tell the default value of smithing mod is zero, while a value of -50 cuts the amount the weapons can be improved in half. I'm going to see if I can put together a simple script real quick.

I threw this together real quick. It would work, but I don't know the equivalent papyrus commands to get and modify attributes, so I'm using the console commands as placeholders.

Scriptname AAABase extends ObjectReference int newValint originalValevent onActivate(ObjectReference akActrionRef) Debug.MessageBox(player.getav smithingmod)originalVal=player.getav smithingmodDebug.MessageBox(originalVal)newVal = originalVal * .5Debug.MessageBox(newVal)player.setav smithingmod = newValDebug.MessageBox(player.getav smithingmod)player.av smithing = oriGinalDebug.MessageBox(player.getav smithingmod) endevent

Does anyone know how to get/modify attributes via papyrus? My searching just keeps turning up the console commands.
User avatar
Annika Marziniak
 
Posts: 3416
Joined: Wed Apr 18, 2007 6:22 am

Post » Wed Jun 20, 2012 1:49 pm

Not sure why this won't compile. Would anyone mind helping me out?

Scriptname AAABase extends ObjectReferencefloat newValfloat originalValevent onActivate(ObjectReference akActrionRef)Debug.MessageBox(player.getav("smithingmod"))originalVal=player.getav("smithingmod")Debug.MessageBox(originalVal)newVal = originalVal * 0.5Debug.MessageBox(newVal)player.setav("smithingmod", newVal)Debug.MessageBox(player.getav("smithingmod"))player.setav("smithingmod",  oriGinal)Debug.MessageBox(player.getav("smithingmod"))endevent

Error Code
Starting 1 compile threads for 1 files...Compiling "AAABase"...c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AAABase.psc(14,23): no viable alternative at input '.'No output generated for AAABase, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on AAABase

Thanks in advance.

EDIT: I figured out why it wouldn't compile, The script has a ways to go, but I got a basic debug script working. If anyone is interested, it is posted below.

Scriptname AAABase extends ObjectReference float newValfloat originalValevent onActivate(ObjectReference akActrionRef) Debug.MessageBox("Original Smithingmod = " + Game.GetPlayer().GetActorValue("smithingmod"))originalVal=Game.GetPlayer().GetActorValue("smithingmod")Debug.MessageBox("originalVal = " + originalVal)newVal = (originalVal - 50)Debug.MessageBox("newVal = " + newVal)Game.GetPlayer().ModActorValue("smithingmod", newVal)Debug.MessageBox("New Smithingmod = " + Game.GetPlayer().GetActorValue("smithingmod"))Game.GetPlayer().SetActorValue("smithingmod",  originalVal)Debug.MessageBox("End Smithingmod = " + Game.GetPlayer().GetActorValue("smithingmod")) endevent
User avatar
JUDY FIGHTS
 
Posts: 3420
Joined: Fri Jun 23, 2006 4:25 am


Return to V - Skyrim