void main()
{
//NOTE: oGuard Must Be Defined
//(Determined by where you are using this script)
object oGuard = GetEnteringObject(); // OBJECT_SELF (Most likely use)
int nInt = GetLocalInt(oGuard, "GuardWeapon");
//For adding more weapons (of the same tagname + the Integer)
string sInt = IntToString(nInt);
//Change all of the weapons in the Guard inventory to the same tagname except
//on the very end add 1/2/3 etc..(e.g. tagname_1 / tagname_2 (tagname_) + (#)
//change this to the tagname used for all weapons - nInt
// e.g. weapon_tagname_ (not weapon_tagname_1)
// (To avoid confustion always use _ at the end of all weapon tagnames)
string sTag = "tagname_of_weapon_";
string sJoin = sTag + sInt; //Tells us which weapon we are looking for..
object oWeapon = GetItemPossessedBy(oGuard, sJoin); //find the weapon
//make the guard equip the weapon..
AssignCommand(oGuard, ActionEquipItem(oWeapon, INVENTORY_SLOT_RIGHTHAND));
//Main Script End
}
///////////////////////// HERE IS THE SCRIPT REFINED W/O COMMENTS /////////////////
void main()
{
object oGuard = GetEnteringObject();
int nInt = GetLocalInt(oGuard, "GuardWeapon");
string sInt = IntToString(nInt);
string sTag = "tagname_of_weapon_";
string sJoin = sTag + sInt;
object oWeapon = GetItemPossessedBy(oGuard, sJoin); //find the weapon
AssignCommand(oGuard, ActionEquipItem(oWeapon, INVENTORY_SLOT_RIGHTHAND));
}
Modifié par _Guile, 23 avril 2011 - 01:32 .