Jump to content

Scripting: Changing Transmute Mineral Ore spell


MrSquits

Recommended Posts

Hello

 

I'm trying to alter the Transmute Mineral Ore spell so that it changes 10 Iron Ore into 1 Silver Ore, and 10 Orichalcum Ore into 1 Gold Ore, but I don't have any idea how to go about it.

 

I've looked in the Creation Kit and found reference to a scipt file, but I don't know how to change the spell to do what I want.

 

Does anyone have advice/tips for me?

 

Thanks.

Link to comment
Share on other sites

It's a fairly simple script. Open it up and take a look. Here it is recreated:

Scriptname transmuteMineralScript extends ActiveMagicEffect  
{script for spell to allow transmutation of ores}

import game

MiscObject Property Ore01  Auto  
{Lowest value ore}
MiscObject Property Ore02  Auto  
{Middle value ore}
MiscObject Property Ore03  Auto  
{Highest value ore}
Sound Property FailureSFX  Auto  
float property skillAdvancement = 15.0 auto
{How much to advance the skill?  Only works when spell actually transmutes something}
message property failureMSG auto


EVENT OnEffectStart(Actor akTarget, Actor akCaster)
	objectReference caster = akCaster
	if caster.getItemCount(Ore02) >= 1
		; favor the more valuable ore first
		caster.removeItem(Ore02, 1, TRUE)
		caster.addItem(Ore03, 1, FALSE)
		advanceSkill("alteration",skillAdvancement)
	elseif caster.getItemCount(Ore01) >= 1
		; if none of that, look for the base ore to upgrade
		caster.removeItem(Ore01, 1, TRUE)
		caster.addItem(Ore02, 1, FALSE)
		advanceSkill("alteration",skillAdvancement)
	else
		; caster must have had no valid ore
		FailureSFX.play(caster)
		failureMSG.show()
	endif
endEVENT

As you can see, there are two "GetItemCount" checks. You'll need to change those from 1 to 10. There are also two RemoveItem functions. You'll also need to change their values from 1 to 10.

 

You will also need to add a new property, similar to the property for Ore02. Call it Ore04. You will want to change the first two references to Ore02 to Ore04.

 

The last thing you will need to do is look at the magic effect in the Creation Kit. In the lower right of the window, there is a pane with attached scripts. Select the script and click Edit Properties. One of those properties will be the new Ore04. Select it and click the Edit button. Then use the drop down menu to point this new property to the form name for Orichalcum.

 

The script will look like this when you are done:

Scriptname transmuteMineralScript extends ActiveMagicEffect  
{script for spell to allow transmutation of ores}

import game

MiscObject Property Ore01  Auto  
{Lowest value ore}
MiscObject Property Ore02  Auto  
{Middle value ore}
MiscObject Property Ore03  Auto  
{Highest value ore}

MiscObject Property Ore04 auto
{Orichalcum}

Sound Property FailureSFX  Auto  
float property skillAdvancement = 15.0 auto
{How much to advance the skill?  Only works when spell actually transmutes something}
message property failureMSG auto


EVENT OnEffectStart(Actor akTarget, Actor akCaster)
	objectReference caster = akCaster
	if caster.getItemCount(Ore04) >= 10
		; favor the more valuable ore first
		caster.removeItem(Ore04, 10, TRUE)
		caster.addItem(Ore03, 1, FALSE)
		advanceSkill("alteration",skillAdvancement)
	elseif caster.getItemCount(Ore01) >= 10
		; if none of that, look for the base ore to upgrade
		caster.removeItem(Ore01, 10, TRUE)
		caster.addItem(Ore02, 1, FALSE)
		advanceSkill("alteration",skillAdvancement)
	else
		; caster must have had no valid ore
		FailureSFX.play(caster)
		failureMSG.show()
	endif
endEVENT

Link to comment
Share on other sites

Thanks for the quick response.

 

I've made the changes, but the spell still works as normal. I tried it in a game that had already begun. Would I need to use this in a new game?

Link to comment
Share on other sites

Did you compile the script after making the changes?

 

If not, confirm that the changes are still present in the PSC file. Then open the Creation Kit. Go to the Gameplay menu and click on the Papyrus Script Manager option. In the new window that appears use the filter to locate the script, right click on the script name and choose compile. The script will attempt to compile. If there are no errors reported, test it out in game. If there is an error reported, post it along with the script code.

 

If you did compile and it is not working mid-game, test it on a new game.

Link to comment
Share on other sites

You shouldn't have to start a new game, but it never hurts to be safe.

 

Follow IsharaMeridin's instructions if you did not compile the script. However if you were using the built-in editor it should compile when you saved. In any event you would not have been able to fill the new Ore04 property if the script had not compiled.

 

Double check the obvious: plugin activated, no other mods loading after it that change the same effect.

 

If nothing else works, locate the spell (not the magic effect) and make a tiny change (for example, add an extra character to the end of the name), then click OK, then reopen the spell and revert the change. This will create a "dirty edit." I don't think it should be necessary in this case, but there is some magic effect information that is stored in the spell and loaded from there rather than from the effect form, so it is a good idea to make sure that you override any spells that use magic effects you have changed in your mod, even if you don't want to make any changes to the spell form.

Link to comment
Share on other sites

I started again.

 

The first time, I edited the actual .psc file after copying the original. I didn't compile anything. I restored that file the second time, working exclusively in the Creation Kit.

 

I had come on here to ask for help, as my script didn't compile, but I saw the problem when I went to copy the script into this message.

 

IT WORKS NOW!!!

 

Thank you so much for your time. I was expecting some vague hints, not detailed description.

Link to comment
Share on other sites

  • 1 year later...

I actually was insterested in using this kind of script to add an item that comes with the same mod(I'm working on making it), can plugin item forms also be linked to those properties? If it can, does it get the right item even if you change the load order(considering it's a custom spell)?

 

PS: It's an Arcane Archery mod that will need a huge bit of repetition, and I'll need to be on vacation before starting on it, so if anyone wants to take up the "project", I would gladly share the idea and what I know so far, no credit needed as long as I can play it(I still need to learn to upload plugins anyway).

Link to comment
Share on other sites

You can assign any object of the property's type no matter the source of that object provided that the object comes from the current plugin or one of its masters. The load order ID#s are intended to fluctuate. The last 6 digits are fixed ID#s for the record in question. The two combined make for the full form ID that the game uses.

 

To be technical, every record in every plugin has 00 for the first two digits. It only shows other values because of its load order position in the Creation Kit, the game or any other utility that can read ESP/ESM files.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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