Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-12-2009, 07:32 PM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
How can I make clientside findareanpcs work reliably?

(I had posted all this, then it fixed itself for a bit, now it's broken again.)

Problem: See picture. The player's weapon:

PHP Code:
     if(player.chat==""player.chat = (area_npcs.size() SPC "npcs in area (" temp.lowestx ", " temp.lowesty  ", " temp.highestx  ", " temp.highesty @")"); 
And the NPCs have a fairly predictable "message your location and timevar";
the trouble is they keep updating the message - even with the timevar - serverside and clientside, no problem - but after they've been idling against a wall for long enough (hard to pin down exactly how long it needs to be; could be a few minutes, could be until a player re-enters the map, could be until a player re-logs, whatever) they Fall Off the findareanpcs results table.

Until the player makes them move. Then they're back in the detection area.

So do I just have to make the zombies move around every so often? :-P
Attached Thumbnails
Click image for larger version

Name:	findareanpcs.png
Views:	205
Size:	97.6 KB
ID:	47686  
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #2  
Old 03-12-2009, 07:44 PM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Patch:
message("Idle2 v<r "@1+tt@" ("@tx@", "@ty@")"SPC timevar);
x=int(x-1+random(0,2));
y=int(y-1+random(0,2));

Horrible, but it works. I'm open to better suggestions...
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #3  
Old 03-13-2009, 02:05 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Maybe you have sleepwhennoplayers set to true in serveroptions?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #4  
Old 03-13-2009, 02:23 PM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Hmm, nope, don't see that in there. Would that do that though?

Mostly it just bugs me that movement, or the lack thereof, would cause findareanpcs to screw up...it's like, server, the NPC's either in the area or it isn't, whether or not the NPC's moving shouldn't affect things...
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #5  
Old 03-13-2009, 09:33 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Are they still in the 'npcs' array?
__________________
Reply With Quote
  #6  
Old 03-13-2009, 09:54 PM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Maybe; is there a findnpcs (findallnpcs, findlevelnpcs, findgmapnpcs) command hidden somewhere? ;-D
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #7  
Old 03-13-2009, 10:04 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Tyhm View Post
Maybe; is there a findnpcs (findallnpcs, findlevelnpcs, findgmapnpcs) command hidden somewhere? ;-D
Just as Chris said, the npcs array.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #8  
Old 03-14-2009, 02:43 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Thank you captain smarmypants, that's the same as an answer. I suppose then that I could say with(npcs) or for (npc:npcs) and it's a protected variable which always contains an array of all NPCs on the server in perpetuity? Or should I be doing an old fashioned for(temp.i=0;temp.i<npcscount;temp.i++) if(npcs[i].x... ?
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #9  
Old 03-14-2009, 09:15 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Tyhm View Post
Thank you captain smarmypants, that's the same as an answer. I suppose then that I could say with(npcs) or for (npc:npcs) and it's a protected variable which always contains an array of all NPCs on the server in perpetuity? Or should I be doing an old fashioned for(temp.i=0;temp.i<npcscount;temp.i++) if(npcs[i].x... ?
'npcs' is an array of all the NPCs in your current level. Similar to the 'players' array.

PHP Code:
for (temp.npc npcs) {
  echo(
"I found an NPC at (" npc."," SPC npc.") with an image of" SPC npc.image "!");
  
npc.trigger("Poke"player.account);
  
npc.var = "foo";

__________________
Reply With Quote
  #10  
Old 03-14-2009, 10:43 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Well shoot, I wish I'd known that a month ago, I coulda saved a lot of headache; I already run a specific scan on the NPCs in the area to make sure they're lined up with the player, above and beyond the findareanpcs' check to make sure they're in the right general box...

Works a bloody treat. Still ain't thrilled that findareanpcs is unreliable...but I'll live.
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #11  
Old 03-14-2009, 11:58 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Tyhm View Post
findareanpcs is unreliable
It really shouldn't be, I use it for quite a lot and it hasn't failed me a single time...
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #12  
Old 03-14-2009, 04:30 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Yea, I'm using it on a rather large scale and it's working perfectly...
Reply With Quote
  #13  
Old 03-19-2009, 02:04 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
I just remembered reading this a while back, might be of help.


Quote:
Originally Posted by Stefan View Post
If the npc is inactive or doesn't have a script, remember to wake it up when you add or modify data: a simple trigger("update", "") or similar will solve the problem.

Inactive npcs are not saved. It's the same problem when changing x or y of an inactive npc, you need to activate the npc so that the modifications are sent to the players.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #14  
Old 03-19-2009, 03:32 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Ahh. Good to know, thanks. I'm using the npc array and it's working swimmingly...which is good, because it'd be rather difficult to update an npc that wasn't saved anywhere at all ever...:-P
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:19 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.