Jump to content

Need scripting advice/help for my mod - Enchanting Vendors


elite403

Recommended Posts

Hi,

 

I'm starting out on a mod, where I think that if Morrowind had vendors that could enchant your weapons/armour, Skyrim should too.

 

Basically I got the enchanting done and it kinda works. However the problem I encountered is:

 

1. I wear my chest armour, I talk to the vendor, the SKSE script works and the armour is enchanted.

2. If I now load a previous savegame before I talk to the vendor, the chest armour is ALSO enchanted now (which shouldn't be the case since I have not talked to the vendor in this save).

 

Code fragment:

 

Enchantment Property FortifyHeavy15  Auto 
MiscObject Property Currency  Auto


Armor pArmour = Game.GetPlayer().GetWornForm(4) as Armor

Enchantment CurrEnch = pArmour.GetEnchantment()
if CurrEnch == None
  if Game.GetPlayer().GetItemCount(Currency) > 1000

    pArmour.SetEnchantment(FortifyHeavy15)

    Game.GetPlayer().UnEquipItem(pArmour, false, true)

    Game.GetPlayer().EquipItem(pArmour, false, true)

    Game.GetPlayer().RemoveItem(Currency, 1000)

 else

    Debug.Notification("You do not have enough gold")

  endif

else

  Debug.Notification("Your armour/clothing is already enchanted")

endif

 

I suspect somehow I'm looking at the game's base objects instead of "this particular one the player is using"... but I have no clue how to "get the one the player is using"... any advice?

 

Many thanks in advance!

Link to comment
Share on other sites

Enchanting items simply cannot apply retrospectively to earlier saves. You must have loaded the wrong save.

 

Also, your script doesn't seem to test for the possible case where the player may not be wearing armor (pArmour == none).

Edited by steve40
Link to comment
Share on other sites

@steve40

Well I made a savegame just before talking to the vendor, so I'm quite sure it's the "right" savegame. Still, as far as testing goes, after enchanting I loaded the savegame I made before I talked to the vendor, and the armour appears as enchanted. I am thus stumped as to why the armour should be enchanted before I talked to the vendor. The armour script won't fire because the dialogue option simply wouldn't appear if the player wasn't wearing anything with the keyword "ArmourCuirass" or "ClothingBody" hence I didn't test for the possibility of pArmour == None. As it is, I'm thinking that's why there are no mods doing enchanting vendors/machines/chests etc.

 

@Korodic

Ok then I'm stumped as to why earlier saves show the enchantment already applied to the armour before enchanting.

 

Anyway thanks to both you guys for replying. I guess enchanting your un-enchanted items probably can't be done correctly as of right now. even with SKSE 1.6.9

Link to comment
Share on other sites

Not to frustrate you about the idea - but economics of skyrim is actually providing something like that. Weapons and armor can be given to a blacksmith to be tempered with and at the jarl's wizards you can get stuff enchanted - both as a service.

Link to comment
Share on other sites

Not to frustrate you about the idea - but economics of skyrim is actually providing something like that. Weapons and armor can be given to a blacksmith to be tempered with and at the jarl's wizards you can get stuff enchanted - both as a service.

 

Unless it works with non-vanilla assets it isn't as good as the OP was suggesting.

Link to comment
Share on other sites

Works with everything - vanilla or custom - as long as the forms have been properly setup for enchantment and/or tempering. So in other words - if you could enchant it yourself it can be enchanted as a service as well Edited by dwiss
Link to comment
Share on other sites

as of your problem with the script : documentation states that you enchant the base object :

SetEnchantment - Armor

SKSE Member of: Armor Script, Weapon Script

Sets the enchantment associated with this armor. Note refers to the base object, not an object reference. (This function requires SKSE)

Edited by dwiss
Link to comment
Share on other sites

@dwiss

Honestly, I looked at Economics of Skyrim a long time back, and it changed too many things for my liking hence I never actually downloaded nor installed it. If they now have enchanting services, then I wouldn't want the other vendors to be changed just to get enchanting services.

 

Also, yeah dang I missed that part in the documentation for "SetEnchantment"... thanks for pointing it out :(

 

Thanks again guys for the replies!

Link to comment
Share on other sites

@elite I wasnt implying that you need the entire mod - but as what you try to achieve has been already made looking into it might be a good idea to get yours working. And i mean study it - dont just copy it :wink:

Edited by dwiss
Link to comment
Share on other sites

  • Recently Browsing   0 members

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