//----------------------------------------------------------------------
// Checks for silk carpet in placeable.
//----------------------------------------------------------------------
case EVENT_TYPE_INVENTORY_ADDED:
{
object oItem = GetEventObject(ev, 0);
if (oItem == GetObjectByTag("gen_im_treas_silkcarp",0))
{
location lCarpetSpot = GetLocation(OBJECT_SELF);
Safe_Destroy_Object(oItem); //to prevent removal of carpet
Safe_Destroy_Object(OBJECT_SELF); //container destroyed on close
// create a carpet placeable at the location
object oCarpet1 = GetObjectByTag("carpet1",0);
SetObjectActive(oCarpet1,1);
WR_SetPlotFlag(PLT_INTERIOR_DECORATION, CARPET1, TRUE);
RewardXPParty(250);
}
bEventHandled = TRUE;
break;
}
So here's the issue: the GetObjectByTag function grabs the first Silk Carpet in memory, and so long as there is only one, it's fine. But if the PC has more than one carpet (I was using 4 for testing), the game will as often as not grab the "wrong" iteration of gen_im_treas_silkcarp (i.e. one still in the PCs inventory) causing the CASE to fail. In that case, the PC may need to put 3 or 4 carpets into the hole before one appears on the floor.
So what I think I'm looking for is a way to construct the if (oItem == GetObjectByTag line so that it is simply testing to see if the tag is gen_im_treas_silkcarp, NOT checking to see if it's a specific iteration of that. Or else I'm looking for a way to pick the specific iteration of gen_im_treas_silkcarp that is already inside OBJECT_SELF (or closest to lCarpetSpot).
Any ideas?
FWIW, I have the same sort of thing (part of the same quest) for paintings appearing on the wall, and that works great, because the paintings, being gifts, have unique tags.
Modifié par BillHoyt, 21 mai 2010 - 02:14 .





Retour en haut






