Force Unequip?
Posted: Fri Apr 21, 2023 1:53 pm
Hello all...Still plugging away. Is there a way to force unequip via script? GaTakeItem doesn't seem to take an item if a PC has it equipped.
2D RPG Engine and Toolset for Creating Your Own Adventures
https://www.iceblinkengine.com/ib_forums/
https://www.iceblinkengine.com/ib_forums/viewtopic.php?f=7&t=67
Code: Select all
public void TakeItem(string resref, int quantity)
{
for (int i = 0; i < quantity; i++)
{
bool FoundOne = false;
int cnt = 0;
foreach (ItemRefs itr in mod.partyInventoryRefsList)
{
if (!FoundOne)
{
if (itr.resref.Equals(resref))
{
gv.sf.RemoveItemFromInventory(itr, 1);
FoundOne = true;
break;
}
}
cnt++;
}
cnt = 0;
foreach (Player pc in mod.playerList)
{
if (!FoundOne)
{
if (pc.BodyRefs.resref.Equals(resref))
{
mod.playerList[cnt].BodyRefs = new ItemRefs();
FoundOne = true;
}
if (pc.OffHandRefs.resref.Equals(resref))
{
mod.playerList[cnt].OffHandRefs = new ItemRefs();
FoundOne = true;
}
if (pc.MainHandRefs.resref.Equals(resref))
{
mod.playerList[cnt].MainHandRefs = new ItemRefs();
FoundOne = true;
}
if (pc.RingRefs.resref.Equals(resref))
{
mod.playerList[cnt].RingRefs = new ItemRefs();
FoundOne = true;
}
if (pc.Ring2Refs.resref.Equals(resref))
{
mod.playerList[cnt].Ring2Refs = new ItemRefs();
FoundOne = true;
}
if (pc.HeadRefs.resref.Equals(resref))
{
mod.playerList[cnt].HeadRefs = new ItemRefs();
FoundOne = true;
}
if (pc.GlovesRefs.resref.Equals(resref))
{
mod.playerList[cnt].GlovesRefs = new ItemRefs();
FoundOne = true;
}
if (pc.NeckRefs.resref.Equals(resref))
{
mod.playerList[cnt].NeckRefs = new ItemRefs();
FoundOne = true;
}
if (pc.FeetRefs.resref.Equals(resref))
{
mod.playerList[cnt].FeetRefs = new ItemRefs();
FoundOne = true;
}
}
cnt++;
}
}
}