I just can't seem to figure this out, and could use a little bit of help.
What I have done so far is to setup a dialogue, and then I wrote a small conversation action script to switch armor. No matter how I try I can't get the script work for my NPC though, although it does work for the player, if the player has the specified armor in inventory.
The NPC targeted by the script is standing right next to the player, and there are no other creatures in the area. Any ideas?
// make NPC with sNpcTag equip armor with sArmorTag
#include "ginc_param_const"
void main(string sArmorTag)
{
object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());
object oNpc = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_NOT_PC, oPC);
object oArmor = GetItemPossessedBy(oNpc, sArmorTag);
// Do stuff here
if(GetIsObjectValid(oArmor)){
AssignCommand(oNpc, ClearAllActions());
AssignCommand(oNpc, ActionEquipItem(oArmor, INVENTORY_SLOT_CHEST));
}
}





Retour en haut






