Transmute Mineral Ore: How Papyrus recognize which ore to us

Post » Mon Jun 18, 2012 3:39 pm

I've looked at the Trasmute spell to cannibalize its scripts and use it for my purposes, but I am not able to "get into" the code.

After searching into the spell a bit, I found the following script which seems to "rule" all the transmutation process... transmuteMineralScript.

The code is like this:

"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
"


Now...Ore01, Ore02 and Ore03 are quite generic as reference so I'd have thought one of the following options:
a) Iron Ingot, Silver Ingot and Gold Ingots are marked as such somewhere.
B) The game checks for the most valuable items with "Ore" as reference name within the Misc Items category.

For the option "a", I don't see any ground for that. Ingot item descriptions are quite simple and even the keywords have nothing to do with Ore01, Ore02, etc...!

For the option "b", the problem is that Ebony is the most expensive (highest value) item with "Ore" descriptor, so, if it worked as I supposed above, we'd have Iron -> Gold -> Ebony
instead of Iron -> Silver -> Gold as it is!

Now...I've checked for Global Variables...none...

...I've checked for quests...none...

...so, given that I know that the computer is non-intelligent, so it's not going to make up which ore is Ore01 all by himself (basic computer science concept)...

...how Papyrus get that Ore01 is Iron, Ore02 is Silver and Ore03 is Gold? Where the critical passage of telling the game which reference to check is gone (because the script above seems to me like a phrase with no verb or noun...the problem is that probably is hidden somewhere else)?

Anyone has any idea?

Thanks,
Guido
User avatar
gemma
 
Posts: 3441
Joined: Tue Jul 25, 2006 7:10 am

Post » Mon Jun 18, 2012 4:51 pm

The script is attached to the spell, look in the Magical Effect for Transmute, look at the properties for the script that is where they will be set up
User avatar
Hayley Bristow
 
Posts: 3467
Joined: Tue Oct 31, 2006 12:24 am

Post » Mon Jun 18, 2012 3:03 pm

The properties "Ore01", "Ore02" and "Ore03" are set to refer to particular objects.
In this case, they are set to refer to Iron, silver and gold ores.

This is set in whatever object the script is attached to. There should be a "properties" button next to the list of scripts.
User avatar
MatthewJontully
 
Posts: 3517
Joined: Thu Mar 08, 2007 9:33 am

Post » Mon Jun 18, 2012 4:01 pm

So you guys are telling me that:
1) The script doesn't set Properties, but just sets the Rules to manage them.
2) The spell set the Properties.

Am I getting it right? :-?
Jashkar

P.S.: This means that the above said script could be used to make another spell which transmutes other kinds of ore without even changing the script??
That's amazing! :o
User avatar
Meghan Terry
 
Posts: 3414
Joined: Sun Aug 12, 2007 11:53 am

Post » Mon Jun 18, 2012 2:13 pm

Properties are set in the ESP. They are set _anywhere_ a script is used, including fragments. This way you could use the script on another spell and set the ores differently if you wanted to go from moonstone -> malachite -> whatever. They dont even have to be ores any misc object would work.
About the script properties, if you want to refer to SomeSpell and you have it set up as Spell Property SomeSpell Auto when you go to assign it properties in the script you can hit the auto button and it will find that spell.
User avatar
Jade Payton
 
Posts: 3417
Joined: Mon Sep 11, 2006 1:01 pm

Post » Mon Jun 18, 2012 3:40 pm

Now I understand...thank you a lot guys!!! :)
Jashkar
User avatar
Kanaoka
 
Posts: 3416
Joined: Fri Jun 16, 2006 2:24 pm


Return to V - Skyrim