Jump to content

Script Help Needed - Transmute Iron into Salt


hadoumastery

Recommended Posts

Scriptname transmuteIronOreToSaltScript extends ActiveMagicEffect

{script for spell to allow transmutation of ores}

 

import game

 

MiscObject Property Ore01 Auto

{Lowest value ore}

MiscObject Property Ore02 Auto

{Salt}

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(Ore01) >= 1

caster.removeItem(Ore01, 1, TRUE)

caster.addItem(Ore02, 1, TRUE)

advanceSkill("alteration",skillAdvancement)

else

; caster must have had no valid ore

FailureSFX.play(caster)

failureMSG.show()

endif

endEVENT

 

This is what I've got so far. It's adapting the original script into a iron ore=salt pile generator.

Link to comment
Share on other sites

@hadoumastery: you haven't explained what the problem is.

 

I haven't got the CK in front of me, but I think salt is a potion like most foods are?

 

Also

 

objectReference caster = akCaster

 

should be

 

ObjectReference caster = akCaster as ObjectReference

 

But that is redundant anyway, I think, because Actor already extends ObjectReference

 

So:

 

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

import game

MiscObject Property Ore01 Auto 
{Lowest value ore}
Potion Property salt Auto 
{Salt}
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)
if akCaster.getItemCount(Ore01) >= 1
	akCaster.removeItem(Ore01, 1, TRUE)
	akCaster.addItem(salt, 1, TRUE)
	advanceSkill("alteration",skillAdvancement)
else
	; akCaster must have had no valid ore
	FailureSFX.play(akCaster)
	failureMSG.show()
endif
endEVENT

Edited by steve40
Link to comment
Share on other sites

Oh one other thing, how do I turn the script into a .pex format?

 

To compile the script, right-click the script at the papyrus section of the magic effect (where you add the script) and select the option 'edit source'.

Then you can either 'save' or 'compile' it. If the compiler doesn't find anything to complain about, it will produce a .pex file.

 

Once the script is compiled you'll need to edit the properties (Properties -> Edit Value).

Link to comment
Share on other sites

I see, thanks again!

 

-I ran into an error. The error reads...

 

Starting 1 compile threads for 1 files...

Compiling "transmuteMineralScript"...

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\transmuteMineralScript.psc(0,0): filename does not match script name: transmuteironoretosaltscript

No output generated for transmuteMineralScript, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on transmuteMineralScript

 

Also, it seems to be replacing the original script. Any idea what to do to fix this?

 

-Ok I fixed an invalid object reference to salt, because it's actually called SaltPile. After that it still persists to give me the error, anything you can think of?

Edited by hadoumastery
Link to comment
Share on other sites

The error is self-explanatory: file name does not match script name. The name of the script inside the code (after ScriptName ...) must match the name of the .psc file.

 

Make a new script. You can do this either from the papyrus section of the magic effect (Add -> New Script) or the Papyrus Script Manager (right-click -> New). Name it TransmuteIronOreToSaltScript, it extends ActiveMagicEffect -> OK. Copy-Paste your code to the script and make sure the name after ScriptName is the same. Now it should compile.

Edited by Ghaunadaur
Link to comment
Share on other sites

  • Recently Browsing   0 members

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