Hi,

My goal was to prevent players from hiding in plain sight while NPCs or other players were in close range and I got it working for players by:

Code:
            if (ok)
            {
                if (!m_CombatOverride)
                {
                    foreach (Mobile check in m.GetMobilesInRange(range))
                    {
                        if (check.InLOS(m) && check.Combatant == m)
                        {
                            badCombat = true;
                            ok = false;
                            break;
                        }
                    }
			// prevent players from hiding if other players are nearby
                    foreach (NetState ns in m.GetClientsInRange(5))
                    {
                        if (ns.Mobile != m)
                        {
                            badCombat = true;
                            ok = false;
                            break;
                        }
                    }

I can't get it working for nearby NPCs though. I tried but failed.
Any help please?
 
Hi,

My goal was to prevent players from hiding in plain sight while NPCs or other players were in close range and I got it working for players by:

Code:
            if (ok)
            {
                if (!m_CombatOverride)
                {
                    foreach (Mobile check in m.GetMobilesInRange(range))
                    {
                        if (check.InLOS(m) && check.Combatant == m)
                        {
                            badCombat = true;
                            ok = false;
                            break;
                        }
                    }
			// prevent players from hiding if other players are nearby
                    foreach (NetState ns in m.GetClientsInRange(5))
                    {
                        if (ns.Mobile != m)
                        {
                            badCombat = true;
                            ok = false;
                            break;
                        }
                    }

I can't get it working for nearby NPCs though. I tried but failed.
Any help please?
Likely as you did above and getmobiles in range but exclude whether in combat or not in combat then you could add an override for controlled such as your own pet
 
Back