#include "x2_inc_switches"
void main()
{
object oPC;
oPC = GetPCItemLastEquippedBy();
object oItem = GetPCItemLastEquipped();
//If not level 40, unequip the item!
if(GetHitDice(oPC)<=39)
{
AssignCommand(oPC, ClrarAllActions(TRUE));
AssignCommand(oPC, ActionUnequipItem(oItem));
AssignCommand(oPC, ActionDoCommand(SetCommandable(TRUE)));
SetCommandable(FALSE,oPC);
}
}
I am currently not near the toolset, SO sorry if it does not compile right the first time.
There Is no need to search for the item. GetPCItemLastEquipped(); will return the correct item that triggered the event without a search. We also set the PC uncommandable untill he has unequiped the item. This way he can not do anything so clear his action of unequiping it.
Edit: Now that I look at the script again. If you are running the script as a TagBasedScript you will also need a check for the Event that is runnung the script. If you are running it directly in the module Event you will need some kind of filter for the item, Such as the Tag, Or else the will not be able to equip any item.
Modifié par Lightfoot8, 19 avril 2011 - 02:01 .