Resource icon

Custom Detect Hidden 3.1415

No permission to download

ViWinfii

Rookie
Jul 13, 2014
71
14
8
ViWinfii submitted a new resource:

Custom Detect Hidden - Customized Detect Hidden skill that does not require a target.

Do you think it is a waste of time having to choose a target when trying to detect hidden players or traps? Do you find the Detect Hidden skill to be boring and not worth training? Then this script is for you.

This script completely changes how Detect Hidden is used. The Detect Hidden button in your skills gump opens a Detect Hidden Menu for using two new powerful abilities: Detect and Reveal. Both abilities rely on and will raise your Detect Hidden skill.

Using Detect
The concept behind...
Read more about this resource...
 

ViWinfii

Rookie
Jul 13, 2014
71
14
8
like sphere51a??
I honestly don't remember how Sphere used detect hidden. I haven't been on a sphere server in almost 14 years :) Download the package and test it out - easy to install as it is unzip, drop, and compile. Be sure to delete the old DetectHidden.cs first.
 

ViWinfii

Rookie
Jul 13, 2014
71
14
8
Sure it can. If you want to stick to the idea of having only the skill Reveal to dealing with traps then look the function Rev at line 209 in DetectRevealHidden.cs. At line 209, I cycle through all items within range to find anything of type BaseFactionTrap in a foreach loop:
Code:
                    foreach (Item item in itemsInRange)
                    {
                        if (item is BaseFactionTrap)
                        {
                            BaseFactionTrap trap = (BaseFactionTrap)item;

                            if (src.CheckTargetSkill(SkillName.DetectHidden, trap, 80.0, 100.0))
                            {
                                src.SendLocalizedMessage(1042712, true, " " + (trap.Faction == null ? "" : trap.Faction.Definition.FriendlyName)); // You reveal a trap placed by a faction:

                                trap.Visible = true;
                                trap.BeginConceal();

                                foundTrap = true;
                            }
                        }
                    }
You could add another if statement after the one that is there to detect regular traps on containers within the same range. How you send that information to the player is up to you - any easy way is to use src.SendMessage("You detect a trap nearby") after you successfully detect a trap. DetectRevealHidden was meant to find hidden players or hidden faction traps, not actually for detecting a trap on a chest.
 

ViWinfii

Rookie
Jul 13, 2014
71
14
8
Meh, I had a spare 5 minutes. Replace the entire Rev function with this:

Code:
		private static void Rev( Mobile src, object targ )
		{
            if (DateTime.Now.Ticks < src.NextSkillTime)
            {
                src.SendSkillMessage();
                return;
            }
         
			double srcSkill = src.Skills[SkillName.DetectHidden].Value;
			int range = (int)(srcSkill / 10.0);

            if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
                range = 0;

            bool foundAnyone = false;
            bool foundTrap = false;
            int containertrapsfound = 0;

            Point3D p;
            p = ((Mobile)targ).Location;

			BaseHouse house = BaseHouse.FindHouseAt( p, src.Map, 16 );
			bool inHouse = ( house != null && house.IsFriend( src ) );
			
			if ( inHouse )
				range = 22;
			
			if ( range > 0 )
			{
				foreach ( Mobile trg in src.GetMobilesInRange( range ) )
				{
					if ( trg.Hidden && src != trg )
					{
						double ss = srcSkill + Utility.Random( 21 ) - 10;
						double ts = trg.Skills[SkillName.Hiding].Value + Utility.Random( 21 ) - 10;
						
						if ( (src.AccessLevel >= trg.AccessLevel) && ( (ss >= ts) || ( inHouse && house.IsInside( trg ) )) && (src.InLOS(trg)) )
						{
							trg.RevealingAction();
							trg.SendLocalizedMessage( 500814 ); // You have been revealed!
							foundAnyone = true;
						}
					}
				}

                if (Faction.Find(src) != null)
                {
                    IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, range);

                    foreach (Item item in itemsInRange)
                    {
                        if (item is BaseFactionTrap)
                        {
                            BaseFactionTrap trap = (BaseFactionTrap)item;

                            if (src.CheckTargetSkill(SkillName.DetectHidden, trap, 80.0, 100.0))
                            {
                                src.SendLocalizedMessage(1042712, true, " " + (trap.Faction == null ? "" : trap.Faction.Definition.FriendlyName)); // You reveal a trap placed by a faction:

                                trap.Visible = true;
                                trap.BeginConceal();

                                foundTrap = true;
                            }
                        }

                        if (item is Container)
                        {
                            Container cont = (Container)item;
                         
                            if (src.CheckTargetSkill(SkillName.DetectHidden, cont, 0.10))
                            {
                                containertrapsfound++;
                            }

                        }
                    }

                    itemsInRange.Free();
                }
			}

            if (!foundAnyone && !foundTrap)
            {
                src.SendLocalizedMessage(500817); // You can see nothing hidden there.
            }
            else
            {
                if (foundTrap)
                    src.SendMessage("You find a trap hidden in the shadows!");

                if (foundAnyone)
                    src.SendMessage("You find someone in the shadows!");
            }

            if (containertrapsfound != 0)
            {
                if (containertrapsfound == 1)
                    src.SendMessage("You detect one trap nearby.");
                else
                    src.SendMessage("You detect " + containertrapsfound.ToString() + " traps nearby.");
            }

            src.NextSkillTime = DateTime.Now.Ticks + TimeSpan.FromSeconds(6.0).Ticks;
		}
That should give a 10% chance of detecting a trap on a container nearby. But this could also make macroing DetectHidden very easy. As it is though, this will only work if the player is in an existing faction. To get it to work without factions you will have to create your own foreach loop checking items within your defined range outside of the if statement 'if (Faction.Find(src) != null)'.
 
Last edited:

Fireball

Squire
Sep 6, 2014
174
20
18
United Kingdom
uoutopia.com
Shard Name
UO:Utopia
OK thanks. Well the way it works/worked on OSI shards is that it displays [Trapped] above the container in red for explosive, green for poison and I think it was blue for dart. Same for faction traps; they displayed [Faction Trap] over the trap. Green for gas trap as per the image below.

Yes it does accelerate your skill gain because you are detecting multiple targets. It is supposed to work like that. We used to train it in the Warrior's Guild building just West of Britain because of the high concentration of trapped crates in there. The radius of detection increased with skill as did the chance of detection. So at GM you had 100% chance of detection and maximum range, but as you know, the use was targeted to a point on the ground or an item/chest. Your way of detecting from the body is much nicer and has more realism.

My toon Renim on Siege Perilous detecting faction traps around 2000/2001:
awww.bihguild.com_uo_Siege_Screenshots_RenimTraps.jpg


FB
 

ViWinfii

Rookie
Jul 13, 2014
71
14
8
Ah I didn't know that - I haven't played OSI in over a decade. I'll see about making a new version to include the different colors of detecting traps - it must be some predefined localoverheadmessage for an item. I don't think the current build of ServUO supports that feature but I could work on adding it for them too.
 

pall

Squire
Aug 20, 2014
207
8
18
31
Shard Name
Ultima Iberia / Renegados UO
i install this in my server, but when players start to use they cant continue using another skill, including detect hiding if they close the window. :S
 

Kilra Yan

Squire
Aug 26, 2015
278
18
18
36
i install this in my server, but when players start to use they cant continue using another skill, including detect hiding if they close the window. :S
there should be already implemented in servUO a passive detect hidden in the lastest ServUO rep

to know if you have open DetectHidden.cs

look if you having this code
Code:
 public static void DoPassiveDetect(Mobile src)
 

pall

Squire
Aug 20, 2014
207
8
18
31
Shard Name
Ultima Iberia / Renegados UO
no. i doesnt have this in the detecthidden.cs
 

pall

Squire
Aug 20, 2014
207
8
18
31
Shard Name
Ultima Iberia / Renegados UO
uffff so much mods :S.
 

ViWinfii

Rookie
Jul 13, 2014
71
14
8
i install this in my server, but when players start to use they cant continue using another skill, including detect hiding if they close the window. :S
pall, did you get this working for yourself?