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:
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:
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?