Yago
2011-04-15 19:50:41
Is it possible for more than one NPC to have the same ID or Index? If so then how can you tell if an NPC has disappeared?
2011-04-15 19:50:41
2011-04-15 19:52:37
2011-04-15 19:54:42
From: Dervish
Count npcs ? :s
2011-04-15 19:56:45
While infight do wait(333);Should work for what you want, obviously you can change for an eating procedure and some antiban etc :)
2011-04-15 20:39:53
2011-04-17 23:29:55
2011-04-18 00:27:20
From: Yago
Bump… So is it possible for more than one NPC to have the same ID and/or Index?
Also, since NPC's move around alot is there a way to update an NPC? like get the new tile and stuff?
2011-04-18 05:56:50
function updateNPC(theNPC:TNPC):TNPC;
var
allNPCs:TNPCArray;
i,hi:Integer;
begin
allNPCs := GetNPCs(theNPC.ID);
hi := High(allNPCs);
for i := 0 to hi do
if(allNPCs[i].index = theNPC.index) then
begin
Result := allNPCs[i];
break;
end;
end;
(note that I didn't tested this code)
function fastInfight:Boolean;
var
me:TMe;
begin
me:getMe;
Result := (me.interacting > 0);
end;
2011-04-18 06:12:18
From: masterBB
Every NPC has its own index. It's possible to track an NPC by its index. The ID however is shared with all NPCs of the same type.
It's possible to update an NPCs tile by using something similar as this:
2011-04-18 06:27:35
2011-04-18 11:07:20
From: Capricorn
You would probably think that and it would make 100% sense for it to work that way until you find out the indexes for NPCs change randomly about every 10-15 seconds.
function updateNPC(ID:int):TNPC;
var
allNPCs:TNPCArray;
currentNPC:TNPC;
i,hi:Integer;
begin
if not(AreWeInteracting(currentNPC)) then
Exit;
if not(currentNPC.ID = ID) then
Exit;
allNPCs := GetNPCs(ID);
hi := High(allNPCs);
for i := 0 to hi do
if(allNPCs[i].index = currentNPC.index) then
begin
Result := allNPCs[i];
break;
end;
end;function updateNPC(ID:int):TNPC;
var
currentNPC:TNPC;
begin
if not(AreWeInteracting(currentNPC)) then
Exit;
if not(currentNPC.ID = ID) then
Exit;
Result := currentNPC;
end;function updateNPC(ID:int):TNPC;
var
currentNPC:TNPC;
begin
Result := NULL_NPC;
if (AreWeInteracting(currentNPC)) then
if (currentNPC.ID = ID) then
Result := currentNPC;
end;
2011-04-18 12:33:35
From: masterBB
function updateNPC(ID:int):TNPC;
var
currentNPC:TNPC;
begin
Result := NULL_NPC;
if (AreWeInteracting(currentNPC)) then
if (currentNPC.ID = ID) then
Result := currentNPC;
end;
From: HarryJames
hey will only change like a few times, just store those IDs in a TIntegerArray?
2011-04-18 19:15:04
From: masterBB
edit: faster example than HarryJames his suggestion would be:
function fastInfight:Boolean;
var
me:TMe;
begin
me:getMe;
Result := (me.interacting > 0);
end;
2011-04-18 19:24:49
From: Yago
Yea, but what if you're not interacting with the NPC and you want to update it anyways?
I think there has to be some other way…
2011-04-18 21:27:40