So im trying to add a mod to OnMoveOver method (PlayerMobile)

What it does it check if both players are holding X items

and if they are it reveals and attach an xmlattachment to both, not working so far.

The console ''debug'' message is not even showing up

Can someone take a look? thanks :)

Code:
        public override bool OnMoveOver( Mobile m )
        {
        #region Region21
         if (m is PlayerMobile && m.Region.Name == "MyRegion21" &&  !HiddenWithSpell && Hidden);   //checking if players are in MyRegion21 and are hidden.

         {
PlayerMobile player1 = this as PlayerMobile;   //checking if players are playersmobile wtf?
PlayerMobile player2 = this as PlayerMobile;   //checking if players are playersmobile wtf?
if (player1 is PlayerMobile && player2 is PlayerMobile)  //unnecesary check?
{
Item[] raraa = new Item[2];
Item[] roroo = new Item[2];

raraa[0] = player1.Backpack.FindItemByType(typeof(item22)); //item22
roroo[0] = player1.Backpack.FindItemByType(typeof(item21)); //item21
raraa[1] = player2.Backpack.FindItemByType(typeof(item22)); //item22
roroo[1] = player2.Backpack.FindItemByType(typeof(item21)); //item21

if((raraa[0] != null && roroo[1] != null) || (roroo[0] != null && raraa[1] != null) )//player1 and player2 are holding different object types.
Console.WriteLine("/Debug/ HOLDING DIFFERENT ITEMS;");
XmlAttach.AttachTo(player1, new Xmlreve("reve" ,1, 8));     //we attach something to them
XmlAttach.AttachTo(player2, new Xmlreve("reve" ,1, 8));  //we attach something to them
player1.Hidden = false; //no hidden
  player2.Hidden = false;  //no hidden

RevealingAction();      //revealaction
  
         }
         }  
#endregion
 
Last edited:
Ok so your code is a mess :p

lets try to analyze it first.
- on line 4 of the snippet you added a ; after the if
- then you declared player 1 and 2 both as the player that is getting moved over.
- you then check again if both instances are PlayerMobile (you dont need to at all. There is already a check for m being a PlayerMobile. And since this is in the PlayerMobile.cs you knows that the one standing still is a PlayerMobile already.
- after your item checks in the if, you dont add the brackets to declare a body for the if. Therefor only the Console.WriteLine would be written in that case.
- then you set the players Hidden to false (still both the same playermobile) and after that you call RevealingAction(); but only for the moved over player.

so what to do:
- removing the ; on line 4
- you dont need to declare the player variables at all.
- remove the if to check if player1 and player2 are PlayerMobile's
- You can also remove the variables for the items. Since you only use them once you can use them directly (optional)
- adding the brackets for the if
- remove the playerX.Hidden
- add the RevealingAction() for the player that is moving over.

what the snippet should look like.

Code:
        public override bool OnMoveOver(Mobile m)
        {
            #region Region21
            if (m is PlayerMobile && m.Region.Name == "MyRegion21" && !HiddenWithSpell && Hidden) //checking if players are in MyRegion21 and are hidden.
            {
                if ((Backpack.FindItemByType(typeof(item21)) && m.Backpack.FindItemByType(typeof(item22)) != null) 
                 || (Backpack.FindItemByType(typeof(item22)) && m.Backpack.FindItemByType(typeof(item21)) != null)) // player1 and player2 are holding different object types.
                {
                    Console.WriteLine("/Debug/ HOLDING DIFFERENT ITEMS;");
                    XmlAttach.AttachTo(this, new Xmlreve("reve", 1, 8)); // we attach something to them
                    XmlAttach.AttachTo(m, new Xmlreve("reve", 1, 8)); // we attach something to them
                   
                    m.RevealingAction(); // revealing action mover
                    RevealingAction(); // revealing action
                }
            }
            #endregion
 
@PyrO I think your line 6 and 7 should look like this:

Code:
                if ((Backpack.FindItemByType(typeof(item21)) != null && m.Backpack.FindItemByType(typeof(item22)) != null) ||
                    (Backpack.FindItemByType(typeof(item22)) != null && m.Backpack.FindItemByType(typeof(item21)) != null))

Great minds think alike, cause I was nearly ready to post mine when you posted. :)
 
Back