I'm working on adding a little something to Forensics Eval to make it more useful/fun. When the player uses forensics eval on the ForensicBody item and they have the requisite skill level, a monster will appear (the murderer has returned to the scene of the crime!) and they have to kill it to get the reward. This also sets the m_Detective to them (similar to m_Forensicist as defined in Corpse.cs).

The part I'm struggling with is, if the body has already been researched by a Detective, I want it to return the name of the detective that solved the crime and not have a monster spawn. However as it is now, whether someone has or hasn't researched the body, the monster always spawns. How can I get it to return null if the body has already been researched?

Btw, the body will be on a spawner and work similarly to locked dungeon chests in that way. Otherwise I'd just delete the body after research.


Code:
else if ( target is ForensicsBody )
				{
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 50.0, 100.0))
                    {
                        ForensicsBody fb = (ForensicsBody)target;

                        if (fb.m_Detective != null)
                            from.SendLocalizedMessage(1042750, fb.m_Detective); // The detective  ~1_NAME~ has already discovered that:



                        else

                            fb.m_Detective = from.Name;
                        {
                            switch (Utility.Random(3))

                            {
                                case 0:

                                    {
                                        from.SendMessage("The murderer has returned to the scene of the crime!");

                                        Mobile spawn01 = new Ettin();
                                        spawn01.MoveToWorld(new Point3D(from.X + 15, from.Y, from.Z), from.Map);
                                        break;
                                    }

                                case 1:
                                    {
                                        from.SendMessage("The murderer has returned to the scene of the crime!");

                                        Mobile spawn01 = new Orc();
                                        spawn01.MoveToWorld(new Point3D(from.X + 15, from.Y, from.Z), from.Map);
                                        break;
                                    }
                                case 2:
                                    {
                                        from.SendMessage("The murderer has returned to the scene of the crime!");

                                        Mobile spawn01 = new Troll();
                                        spawn01.MoveToWorld(new Point3D(from.X + 15, from.Y, from.Z), from.Map);
                                        break;
                                    }
                            }
                        }
                    }
 

Attachments

  • ForensicEval.cs
    5 KB · Views: 3
since you set it to the name, therefor you use a string.

Replace
Code:
fb.m_Detective!=null
with
Code:
!String.IsNullOrWhiteSpace(fb.m_Detective)
 
I think you mean this:

Code:
 else if ( target is ForensicsBody )
				{
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 50.0, 100.0))
                    {
                        ForensicsBody fb = (ForensicsBody)target;

                        if (!String.IsNullOrWhiteSpace(fb.m_Detective))
                            from.SendLocalizedMessage(1042750, fb.m_Detective); // The detective  ~1_NAME~ has already discovered that:



                        else

                            fb.m_Detective = from.Name;

But that doesn't seem to work. let me know if I misunderstood
 
No thats fine, the other issue is that your ekse block is just that single line. You want to put the fb.m_Detective = from.Name; inside the block one line below it. And then the else block should look like this just with the rest of your code added in.

Code:
else
{
	fb.m_Detective = from.Name;
	switch (Utility.Random(3))
	{
		......
	}
}
 
Back