Question about Papyrus properties using external scripts

Post » Fri Nov 16, 2012 6:23 pm

Hello, I'm trying to refactor a spaghetty script I made, cause adding new things to it became a pain, but I don't understand if it is possible to set a property's value from an external script. Here (http://www.creationkit.com/Property_Reference) there is an example using get and set, but that property is and "int" one, whereas I need an "Armor" one. Before I try to mess with my existing script, I'd like to know if what I'm doing is feasible.
So, there are two scripts, one runs on an npc and should force him to equip a certain armor when needed, and the other script that should decide what armor the npc should equip when needed, chosing it from 3 different armors.
Here are the two scripts:

Spoiler

Script that runs on an NPC:
Scriptname ActorWithItems extends ActorArmor property currentlySelectedArmor auto ;connected to armor1 object in CK (I set the initial value to armor1)Function equipCurrentArmor() ;equips the currently selected armor	Self.EquipItem(currentlySelectedArmor)EndFunctionFunction setCurrentArmor(Armor newArmor) Global ;allows to set the property?	currentlySelectedArmor = newArmor ; is it possible to assign it this way?EndFunctionAuto state loop	...do something...EndState

Spoiler

External script:
Scriptname chooseArmor Extends MagicEffect ;I make the player get this effect somehow (eg drinking a potion);possible armors the npc can wearArmor property armor1 auto ;connected to armor1 object in CKArmor property armor2 auto ;connected to armor2 object in CKArmor property armor3 auto ;connected to armor3 object in CKActorWithItems Property referencedNPC Auto ;connected to what in the Ck?Event OnEffectStart()	;here there should be a messagebox allowing to choose one of the three armors, but let's just test it with armor2:	referencedNPC.setCurrentArmor(armor2)	referencedNPC.equipCurrentArmor() ;the npc should equip armor2 instead of armor1, right?EndEvent

So what do you think about them, is it possible to dynamically set a property from an external script this way?
User avatar
Rhi Edwards
 
Posts: 3453
Joined: Fri Jul 28, 2006 1:42 am

Return to V - Skyrim