sahisahi

Member
Im trying to add checks to notoriety based on SolidHueOverride (Player colors) is not working. Players with same solidhueoverride see each other as enemy and can attack each other. I want them to be invul if player have same solidhueoverride.

Pic below players have same solidhueoverride 1150 and see each other as enemy also can attack. (i want them to be invul to each other if have same solidhueoverride)


samehueenemy.png

Next pic, player one have solidhueoverride 1150, player two doesnt (-1) and see each other as enemy, why?

sillyhue.png


I have an event where players get their solidhueoverride.


MobileNotoriety

Code:
    public static int MobileNotoriety( Mobile source, Mobile target )
        {
if (source is PlayerMobile && target is PlayerMobile)
            {
  
                 if (source.SolidHueOverride  != -1 || target.SolidHueOverride  != -1)
                {
                      if ( source.SolidHueOverride  == 1156 && target.SolidHueOverride  == 1150);   //Differente solidhueoverride = enemy
                             return Notoriety.Enemy;
                  
                            if ( source.SolidHueOverride  == 1150 && target.SolidHueOverride  == 1156); //Differente solidhueoverride = enemy
                                return Notoriety.Enemy;
                  
                             if ( source.SolidHueOverride  == 1150 && target.SolidHueOverride  == 1150);  ////Same team solidhueoverride = invul
                                return Notoriety.Invulnerable;
                   
                             if ( source.SolidHueOverride  == 1156 && target.SolidHueOverride  == 1156);   ////Same team solidhueoverride = invul
                                return Notoriety.Invulnerable;
            }
  
            }

Allow_Harmful

Code:
public static bool Mobile_AllowBeneficial( Mobile from, Mobile target )
        {
  if (from is PlayerMobile && target is PlayerMobile)
            {
  
                 if (from.SolidHueOverride  != -1 || target.SolidHueOverride  != -1)
                {
                      if ( from.SolidHueOverride  == 1156 && target.SolidHueOverride  == 1171);   //Differente solidhueoverride = enemy
                            return true;
                  
                            if ( from.SolidHueOverride  == 1150 && target.SolidHueOverride  == 1156); //Differente solidhueoverride = enemy
                                return true;
                  
                             if ( from.SolidHueOverride  == 1150 && target.SolidHueOverride  == 1150);  ////Same team solidhueoverride = invul
                                 return false;
                   
                             if ( from.SolidHueOverride  == 1156 && target.SolidHueOverride  == 1156);   ////Same team solidhueoverride = invul
                                 return false;
            }
  
            }

EDIT: i noticed that
Code:
 if (from.SolidHueOverride  != -1 || target.SolidHueOverride  != -1)
that check is just wrong, removed it, will test and post results

EDIT2: Doesnt matter if player have solidhueoverride or not, everyone see everyone as enemy, weird
 
Last edited:
The checks you are doing is from compared so a static value and then target compared to a static value instead of from compared to target. Both methods are following the same logic on that note. To compare from to target you can use the code below. It checks for playermobile and the solid hue override from both from and target is the same, if so returns true, else false.
Code:
public static bool Mobile_AllowBeneficial( Mobile from, Mobile target ){
    return from is PlayerMobile && target is PlayerMobile && from.SolidHueOverride == target.SolidHueOverride;
}
 
What about checking for items?

Mobile_AllowHarmful
Code:
   Item rara = from.Backpack.FindItemByType(typeof(objeto1150));
           Item roro = from.Backpack.FindItemByType(typeof(objeto1156));
            if (from is PlayerMobile && target is PlayerMobile)
            {
         if ( rara != null && roro != null) // 1150 vs 1156 can attack
            return true;
          
          
         if ( rara != null && rara != null) // 1150 vs 1150 CANT attack
            return false;
          
          
             if ( roro != null  && roro != null ) // 1156 vs 1156 CANT attack
            return false;
          
          
             if ( roro != null && rara != null ) // 1156 vs 1150 can attack
            return true;
            }

MobileNotoriety
Code:
     Item raraa = source.Backpack.FindItemByType(typeof(objeto1150));
           Item roroo = source.Backpack.FindItemByType(typeof(objeto1156));
            if (source is PlayerMobile && target is PlayerMobile)
            {
         if ( raraa != null && roroo != null) // 1150 vs 1156 ENEMY
             return Notoriety.Enemy;

         if ( raraa != null && raraa != null) // 1150 vs 1150 INVUL
             return Notoriety.Invulnerable;
      
             if ( roroo != null && roroo != null ) // 1156 vs 1156 INVUL
             return Notoriety.Invulnerable;
                  
             if ( roroo != null && raraa != null ) // 1156 vs 1150 ENEMY
             return Notoriety.Enemy;
            }


Doesnt seem to work :p, both players get flagged as invul even if items are the two differnt ones
[doublepost=1506265179][/doublepost]
The checks you are doing is from compared so a static value and then target compared to a static value instead of from compared to target. Both methods are following the same logic on that note. To compare from to target you can use the code below. It checks for playermobile and the solid hue override from both from and target is the same, if so returns true, else false.
Code:
public static bool Mobile_AllowBeneficial( Mobile from, Mobile target ){
    return from is PlayerMobile && target is PlayerMobile && from.SolidHueOverride == target.SolidHueOverride;
}


Code:
if (from is PlayerMobile && target is PlayerMobile && from.SolidHueOverride == target.SolidHueOverride )
            {

                      if ( from.SolidHueOverride  == 1156 && target.SolidHueOverride  == 1150);   //Differente solidhueoverride = enemy
                            return true;
                           
                            if ( from.SolidHueOverride  == 1150 && target.SolidHueOverride  == 1156); //Differente solidhueoverride = enemy
                                return true;
                           
                             if ( from.SolidHueOverride  == 1150 && target.SolidHueOverride  == 1150);  ////Same team solidhueoverride = invul
                                 return false;
                            
                             if ( from.SolidHueOverride  == 1156 && target.SolidHueOverride  == 1156);   ////Same team solidhueoverride = invul
                                 return false;
            }

like this?
 
Code:
Item raraa = source.Backpack.FindItemByType(typeof(objeto1150)); //looking this item only once, inside the source's pack never the target.
           Item roroo = source.Backpack.FindItemByType(typeof(objeto1156)); //Same issue as line above.
           if (source is PlayerMobile && target is PlayerMobile) //if you really need these to be playmobile then the above variables should be moved inside this check.
           { 
//this if statement is checking the same thing as...
         if ( raraa != null && roroo != null) // 1150 vs 1156 ENEMY
             return Notoriety.Enemy;
//this if statment and also...
         if ( raraa != null && raraa != null) // 1150 vs 1150 INVUL
             return Notoriety.Invulnerable;
//and this one....
             if ( roroo != null && roroo != null ) // 1156 vs 1156 INVUL
             return Notoriety.Invulnerable;
//and this one to are all 100% the same evaluation.
             if ( roroo != null && raraa != null ) // 1156 vs 1150 ENEMY
             return Notoriety.Enemy;
           }

The two methods you are doing are checking the same things so both have the same issues.
hope the comments help.
First thing you need to do is have 2 raraa and roroo values, you can do that with a simple array, using index 0 for the source/from and index 1 for the target. That would then give you the 4 values you need to make the correct checks, comparing if we found raraa on source raraa on target roroo on source or target and look something like this.
Code:
if(source is PlayerMobile && target is PlayerMobile){
Item[] raraa = new Item[2];
Item[] roroo = new Item[2];
raraa[0] = source.Backpack.FindItemByType(typeof(objeto1150));
roroo[0] = source.Backpack.FindItemByType(typeof(1156));
raraa[1] = target.Backpack.FindItemByType(typeof(1150));
roroo[1] target.Backpack.FindItemByType(typeof(1156));

if((raraa[0] != null && raraa[1] != null) || (roroo[0] != null && roroo[0] != null))// source and target both holding objects of same type
{}
else if((raraa[0] != null && roroo[1] != null) || roroo[0] != null && raraa[1] != null)) //source and target are holding different object types.
{}

As for the last bit of code there, you actually don't need the extra checks with the way I set it up. It already does all of that.
 
Code:
Item raraa = source.Backpack.FindItemByType(typeof(objeto1150)); //looking this item only once, inside the source's pack never the target.
           Item roroo = source.Backpack.FindItemByType(typeof(objeto1156)); //Same issue as line above.
           if (source is PlayerMobile && target is PlayerMobile) //if you really need these to be playmobile then the above variables should be moved inside this check.
           {
//this if statement is checking the same thing as...
         if ( raraa != null && roroo != null) // 1150 vs 1156 ENEMY
             return Notoriety.Enemy;
//this if statment and also...
         if ( raraa != null && raraa != null) // 1150 vs 1150 INVUL
             return Notoriety.Invulnerable;
//and this one....
             if ( roroo != null && roroo != null ) // 1156 vs 1156 INVUL
             return Notoriety.Invulnerable;
//and this one to are all 100% the same evaluation.
             if ( roroo != null && raraa != null ) // 1156 vs 1150 ENEMY
             return Notoriety.Enemy;
           }

The two methods you are doing are checking the same things so both have the same issues.
hope the comments help.
First thing you need to do is have 2 raraa and roroo values, you can do that with a simple array, using index 0 for the source/from and index 1 for the target. That would then give you the 4 values you need to make the correct checks, comparing if we found raraa on source raraa on target roroo on source or target and look something like this.
Code:
if(source is PlayerMobile && target is PlayerMobile){
Item[] raraa = new Item[2];
Item[] roroo = new Item[2];
raraa[0] = source.Backpack.FindItemByType(typeof(objeto1150));
roroo[0] = source.Backpack.FindItemByType(typeof(1156));
raraa[1] = target.Backpack.FindItemByType(typeof(1150));
roroo[1] target.Backpack.FindItemByType(typeof(1156));

if((raraa[0] != null && raraa[1] != null) || (roroo[0] != null && roroo[0] != null))// source and target both holding objects of same type
{}
else if((raraa[0] != null && roroo[1] != null) || roroo[0] != null && raraa[1] != null)) //source and target are holding different object types.
{}

As for the last bit of code there, you actually don't need the extra checks with the way I set it up. It already does all of that.


Thanks for the info, have never used that method before. Thank you . At least i learnt something new

Edit this is what i have:

Mobile_AllowHarmful

Code:
 if(from is PlayerMobile && target is PlayerMobile)
            {
Item[] raraa = new Item[2];
Item[] roroo = new Item[2];
raraa[0] = from.Backpack.FindItemByType(typeof(objeto1150));
roroo[0] = from.Backpack.FindItemByType(typeof(objeto1156));
raraa[1] = target.Backpack.FindItemByType(typeof(objeto1150));
roroo[1] = target.Backpack.FindItemByType(typeof(objeto1156));
if((raraa[0] != null && raraa[1]/ != null) || (roroo[0] != null && roroo[0] != null))// source and target both holding objects of same type
     return false;

else if((raraa[0 != null && roroo[1] != null) || (roroo[0] != null && raraa[1] != null) )//source and target are holding different object types.
     return true;

            }

Mobilenotoriety

Code:
    if(source is PlayerMobile && target is PlayerMobile)
    {
Item[] raraa = new Item[2];
Item[] roroo = new Item[2];
raraa[0] = source.Backpack.FindItemByType(typeof(objeto1150));
roroo[0] = source.Backpack.FindItemByType(typeof(objeto1156));
raraa[1] = target.Backpack.FindItemByType(typeof(objeto1150));
roroo[1] = target.Backpack.FindItemByType(typeof(objeto1156));
if((raraa[0] != null && raraa[1] != null) || (roroo[0] != null && roroo[0] != null))// source and target both holding objects of same type
     return Notoriety.Ally;

else if((raraa[0] != null && roroo[1] != null) ||(roroo[0] != null && raraa[1] != null)) //source and target are holding different object types.

return Notoriety.Enemy;   
        }



Issues;

Player holding objeto1150 see player holding objeto1156 and CAN attack him (Wich is correct)

Player holding objeto 1156 see player holding objeto1150 as ALLY and CANT attack him. (Not working as intended)

:confused:
 
Last edited:

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back