Author Topic: Creature Location Script Needed  (Read 618 times)

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Creature Location Script Needed
« on: February 25, 2014, 02:53:54 pm »


               

I have a boss that spawns in random places within my mod


 


I need a script that when used will find the creature using its tag or resref and  tell the pc it's location.


 


Thanks in advance



               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Creature Location Script Needed
« Reply #1 on: February 25, 2014, 03:48:17 pm »


               

void main()

{

object oPC; // put in your own method of getting the PC object, based on how this

            // script will be called (conversation, item use, chatbar command, etc.

string sBossTag = "theboss"; // put in the boss critter's actual tag here

string sBossArea;



object oBoss = GetObjectByTag(sBossTag);

if (oBoss != OBJECT_INVALID)

   {

   sBossArea = "The Boss is located at/in " + GetName(GetArea(oBoss)) + ".";

   }

else

   {

   sBossArea = "The Boss is nowhere to be found.";

   }

SendMessageToPC(oPC, sBossArea);

}