SRL Archive - Reflection Development

Poll: Do you like these changes to FindNPC?


Nava2

2009-03-24 18:02:58

{*******************************************************************************
function FindNPC(TheVar: Variant; var NPC: TNPC):boolean;
By: Widget
Description: Finds the tile of the named NPC and puts it in the NPC var.
Returns true if found, false if not. (Try walking with the MM if
it's not on the main screen. Now uses a Name or NPCType
*******************************************************************************}
Function FindNPC(TheVar: Variant; var NPC: TNPC):boolean;
var
NPCs: array of TNPC;
begin
NPCs := SortNPCs(GetNPCsBy(TheVar));
result := GetArrayLength(NPCs)<>0;
if not result then
Exit;
NPC := NPCs[0];
end;

Now you can use either an ID or a name with the same function.

Please post some comments, if the general consensus is that it should stay the same, it will.

People, this WILL break some scripts.

But, this isn't a big deal. It would mean changing FindNPCByID to FindNPC, and GetNPCsByID/GetNPCsByName to GetNPCsBy.

Just laying that out, clearly. :)

E: These are currently committed to the Development SVN, not the regular.

mormonman

2009-03-24 19:05:48

I really like this, because it makes you only have to use one easy function instead of trying to choose between the two :P

noidea

2009-03-24 19:09:59

Yes. Already doing well as a developer. :p

Blumblebee

2009-03-24 20:09:12

bleh I could care less tbh, finding the npc by the id is pretty much the only thing I ever use. None the less good job ;)

Tniffoc

2009-03-24 20:53:37

I only use reflection for walking, but if I ever did want to use NPCs, I would like this to be what I'm using.

mormonman

2009-03-24 21:42:15

From: Blumblebee
bleh I could care less tbh, finding the npc by the id is pretty much the only thing I ever use. None the less good job ;)


Using the name is pretty useful imo. When making an autofighter of the same named things that have different ids(goblins for example) it is easy to use… I am actually going to use this for my GWD afker(want details pm me :P)

Nava2

2009-03-24 22:05:22

Well, once the poll is done it will decide. Also, I have been a reflection developer for quite awhile :)

Smarter Child

2009-03-24 22:07:49

Yeah, much better, you can choose between the two then! :D

Nava2

2009-03-24 22:31:26

By the way, the new GetNPCBy procedures are much faster than the old if there are several NPCs around. :)

They just look longer ;)

n3ss3s

2009-03-25 09:21:16

Most likely good changes, but if people still are using lots of Narcle's scripts, he will tear your ass in 3.

Naike

2009-03-25 11:57:27

Only if it wont fuck up all the reflection scripts!

If it won't then fine by me ;)

BazzBarrett

2009-03-26 14:21:27

yup defonatly change it, aslong as it whont screw all previous scripts up, i hate it when people make changes that wreak perfectly good scripts…

sdawgakavip

2009-03-26 15:39:25

I actually like this a lot, it makes it a lot easier

Nava2

2009-03-27 09:03:56

People, this WILL break some scripts.

But, this isn't a big deal. It would mean changing FindNPCByID to FindNPC, and GetNPCsByID/GetNPCsByName to GetNPCsBy.

Just laying that out, clearly. :)

escotsKep

2009-04-01 03:43:53

you not delete my spam?