Results 1 to 7 of 7

Thread: GetNPCInfo

  1. #1
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default GetNPCInfo

    SCAR Code:
    Procedure GetNPCInfo;
    {*******************************************************************
    Procedure GetNPCInfo;
    By: Waddo
    Description: Displays the info of loaded NPC's.
    ********************************************************************}

    var
      i: integer;
      NPCs: array of TNPC;
    begin
      NPCs := GetNPCs;
      if (GetArrayLength(NPCs)=0) then Exit;
      for i := 0 to High(NPCs) do
        writeln('NPC: '+NPCs[i].Name+' ID: '+IntToStr(NPCs[i].NPCType)+
        ' Tile X: '+IntToStr(NPCs[i].TileX)+' Tile Y: '+IntToStr(NPCs[i].TileY));
    end;

    Helpful when creating scripts using reflection.

    When ran in the courtyard above the mining guild it returned

    SCAR Code:
    NPC: Dwarf ID: 3220 Tile X: 3010 Tile Y: 3337
    NPC: Banker ID: 6200 Tile X: 3010 Tile Y: 3353
    NPC: Banker ID: 6200 Tile X: 3011 Tile Y: 3353
    NPC: Banker ID: 6200 Tile X: 3012 Tile Y: 3353
    NPC: Banker ID: 6200 Tile X: 3013 Tile Y: 3353
    NPC: Banker ID: 6200 Tile X: 3014 Tile Y: 3353
    NPC: Banker ID: 6200 Tile X: 3015 Tile Y: 3353
    NPC: Dwarf ID: 3221 Tile X: 3018 Tile Y: 3332
    NPC: Dwarf ID: 382 Tile X: 3018 Tile Y: 3340
    NPC: Dwarf ID: 3294 Tile X: 3020 Tile Y: 3338
    NPC: Dwarf ID: 3295 Tile X: 3018 Tile Y: 3337 <---this is the ID I created this to
    NPC: Dwarf ID: 3219 Tile X: 3022 Tile Y: 3348    find it is the dwarf with the mining
    NPC: Guard ID: 9 Tile X: 3009 Tile Y: 3323         skill cape the X and Y tiles help you
    NPC: Guard ID: 9 Tile X: 3005 Tile Y: 3324         to tell him a part from the other dwarfs
    Blank!

  2. #2
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Dude, thats pretty cool. Will it only work in S.M.A.R.T. like Reflections?
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  3. #3
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It is reflection. XD
    Blank!

  4. #4
    Join Date
    Mar 2007
    Location
    Players[-1].Loc
    Posts
    962
    Mentioned
    4 Post(s)
    Quoted
    5 Post(s)

    Default

    This is the format I've been using:
    SCAR Code:
    for i := 0 to High(NPCs) do
        begin
          s := padr(NPCs[i].TheName,15);
          s := s + '   ID: '+padr(inttostr(NPCs[i].NPCType),7);
          s := s + '  ('+inttostr(NPCs[i].x)+', '+inttostr(NPCs[i].y)+')';
          s := s + '  In Fight: '+BoolToStr(NPCs[i].InFight);
          s := s + '  Is Moving: '+BoolToStr(NPCs[i].IsMoving);
          Writeln(s);
        end;


  5. #5
    Join Date
    Sep 2006
    Location
    include srl/srl.scar ( aussie)
    Posts
    2,875
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Waddo View Post
    SCAR Code:
    Procedure GetNPCInfo;
    {*******************************************************************
    Procedure GetNPCInfo;
    By: Waddo
    Description: Writes the info of loaded NPC's.
    ********************************************************************}

    var
      i: integer;
      NPCs: array of TNPC;
    begin
      NPCs := GetNPCs;
      if (GetArrayLength(NPCs)=0) then Exit;
      for i := 0 to High(NPCs) do
        writeln('NPC: '+NPCs[i].TheName+' ID: '+inttostr(NPCs[i].NPCType)+
        ' Tile X:'+inttostr(NPCs[i].x)+' Tile Y: '+inttostr(NPCs[i].y));
    end;

    Helpful when creating scripts using reflection.

    When ran in the courtyard above the mining guild it returned

    NPC: Dwarf ID: 3220 Tile X: 3010 Tile Y: 3337
    NPC: Banker ID: 6200 Tile X: 3010 Tile Y: 3353
    NPC: Banker ID: 6200 Tile X: 3011 Tile Y: 3353
    NPC: Banker ID: 6200 Tile X: 3012 Tile Y: 3353
    NPC: Banker ID: 6200 Tile X: 3013 Tile Y: 3353
    NPC: Banker ID: 6200 Tile X: 3014 Tile Y: 3353
    NPC: Banker ID: 6200 Tile X: 3015 Tile Y: 3353
    NPC: Dwarf ID: 3221 Tile X: 3018 Tile Y: 3332
    NPC: Dwarf ID: 382 Tile X: 3018 Tile Y: 3340
    NPC: Dwarf ID: 3294 Tile X: 3020 Tile Y: 3338
    NPC: Dwarf ID: 3295 Tile X: 3018 Tile Y: 3337
    NPC: Dwarf ID: 3219 Tile X: 3022 Tile Y: 3348
    NPC: Guard ID: 9 Tile X: 3009 Tile Y: 3323
    NPC: Guard ID: 9 Tile X: 3005 Tile Y: 3324

    cool function then we could use
    TileToMM? for the finding right?

  6. #6
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    You could use TileToMM to walk to the tile, then use FindNPC to try and find the NPC you're looking for.

    Cool function, though.
    :-)

  7. #7
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yep

    or just walktotile(x,y)

    or you can use the id to find the npc using the id and walk to it dynamically during runtime
    Blank!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •