Aller au contenu

Photo

Item Property Comparison Function


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
_Guile

_Guile
  • Members
  • 685 messages

Hello scripting masters, I was wondering if someone would be up for the task of helping me script an Item Property Removal System....
 

I've tried the suggestion Lightfoot8 gave below, e.g. return io==iProp;  (Didn't work)

 

Here is what I have so far, I believe this is going to require some work, becuase it's removing ALL Properties presently of the same type & subtype for Saving Throws...  Obviously I'm going to have to run checks on CostTableValues to ensure both values are the same, but I don't know how to code this efficiently, because the system is already intense enough...

 

 

int iMatch(object oScan, itemproperty io)
{
 // First read the PC Item's Property & get any Statistics on it...
 int ioType = GetItemPropertyType(io);
 int ioSub = GetItemPropertySubType(io);
 int ioDur = GetItemPropertyDurationType(io);
 int ioTable =  GetItemPropertyCostTable(io);
 int ioVal = GetItemPropertyCostTableValue(io);

 

 itemproperty ip = GetFirstItemProperty(oScan);
 while(GetIsItemPropertyValid(ip))
 {
  if(GetItemPropertyType(ip) == ioType && ioDur != DURATION_TYPE_TEMPORARY)
  {
   if(GetItemPropertySubType(ip) == ioSub)
   {
    return TRUE;
   }
  }

  ip = GetNextItemProperty(oScan);
 }

 return FALSE;
}



#2
Squatting Monk

Squatting Monk
  • Members
  • 446 messages

Here's the guts of IPGetItemHasProperty() from x2_inc_itemprop.nss. If it doesn't do what you need, it will at least get you started.
 

if ((GetItemPropertyType(ip) == GetItemPropertyType(ipCompareTo)))
{
     if (GetItemPropertySubType(ip) == GetItemPropertySubType(ipCompareTo) || bIgnoreSubType)
     {
        if (GetItemPropertyDurationType(ip) == nDurationCompare || nDurationCompare == -1)
        {
              return TRUE; // if duration is not ignored and durationtypes are equal, true
        }
    }
}


#3
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

what is wrong with.   

 

int PropertyIsMatching(itemproperty iProp, itemproperty io)

{

  return iProp == io; 

}



#4
Shadooow

Shadooow
  • Members
  • 4 471 messages

what is wrong with.   

 

int PropertyIsMatching(itemproperty iProp, itemproperty io)

{

  return iProp == io; 

}

i believe itemproperties behave as effects, effect eHaste != EffectHaste()



#5
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

now I remember that argument between us before.   If I remember most of that difference came from the Effect creator and how they where linked.    Iprops should not have a problem with iprop creator.   Of course I am not testing any of this(currently ) .  I was just wondering   if he tried a simple comparison before scripting one. 



#6
_Guile

_Guile
  • Members
  • 685 messages

OK, update, I've got the main script running, and it's not kicking out Too Many Instruction errors, (Yay!)....

 

I just gotta get the above function in the OP coded & I need some help here, because I don't know which functions need to check for what...