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 02-24-2009, 05: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 will become famous soon enough
the NPC's name

The wiki has failed me again.

with(findnpc("turret"))

that's great, but how do I get the NPC's name? I mean, how do I know which NPC to find? Does it even work with putnpc2sies?

Here's the problem:
I've made a script that, clientside, comes up with a list of targets, then sends these targets to the serverside. The serverside checks the list of targets to make sure the player isn't being cheeky, then applies damage. Currently I've got the clientside triggering with a list of npc.id s, and the server's catching it no problem, but I can't seem to go from a list of npc.ids to a list of actual NPCs, short of running a very large findareanpcs and comparing their IDs...I'd much rather either send a list of npc.names (or whatever the mysterious property is, the wiki's no help) or look them up by id directly. temp.npc=npc.id(param1)? =findnpcbyid(param1)?
__________________
"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 02-24-2009, 06:27 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
The only NPCs having names you can assign yourself are the database NPCs. The others either have no name, or they have a generated name (putnpc2()). Either way, you can't change the name yourself. Though, putnpc2() returns the name of the newly created NPC when it is called. Maybe you will find this useful.
__________________
Reply With Quote
  #3  
Old 02-24-2009, 10:38 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
Try using npc.name instead of the ID, then using findNPC(name) on serverside.

Quote:
Originally Posted by Crow View Post
Though, putnpc2() returns the name of the newly created NPC when it is called. Maybe you will find this useful.
No, putnpc2() returns the actual NPC object, hence why you can do this:

PHP Code:
temp.npc putnpc2(3232"");
npc.var = "foo";
npc.join("meow"); 
__________________
Reply With Quote
  #4  
Old 02-25-2009, 02:58 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 will become famous soon enough
npc.name doesn't return the #n of the NPC?
__________________
"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 02-25-2009, 03:53 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
npc.name doesn't return the #n of the NPC?
#n is nick. That's npc.nick. npc.name is the actual name given to the NPC (something like localnpc_level.nw_30_30_1).
__________________
Reply With Quote
  #6  
Old 02-25-2009, 05:31 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 will become famous soon enough
Sweet! Now if I can just get that to work...right now
PHP Code:
echo("Name="@npc.name); 
returns
PHP Code:
Name
. It returns a value for npc.id (usually in the 300s), but no name. -_-
In fact,
PHP Code:
        echo("Name="@npc.name@" ID="@npc.id); 
returns
PHP Code:
NameID=300 
__________________
"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 02-25-2009, 05:51 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 will become famous soon enough
So there IS such a command as findNPCByKD? You"wouldn't know by reading the wiki...OH, THERE IT IS. "findnpcby" brings nothing, "findnpc" has 0 hits, but "findnpcbyid" has a hit. SO YOU JUST HAVE TO SEARCH FOR THE EXMCT TERM. YOU JUST HAVE TO KNOW`EXACTLY WHAT YOU'RE LOO[ING FOR BEFORE YOU LOOK2FOR!IT.

Right now K got it passing ID from client to server (it stays the same), and the server does a gigantic findareanpcs, checks which one{ match IDs, and kills 'em.

However - findnpcbyid is apparently clientside only. -_-
__________________
"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

Last edited by Tyhm; 02-25-2009 at 06:05 AM..
Reply With Quote
  #8  
Old 02-25-2009, 06:22 AM
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 having the same problem right now actually...

It'd be nice if that worked serverside
Reply With Quote
  #9  
Old 02-25-2009, 05:32 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by cbk1994 View Post
No, putnpc2() returns the actual NPC object, hence why you can do this:

PHP Code:
temp.npc putnpc2(3232"");
npc.var = "foo";
npc.join("meow"); 
Ah, well, I always get confused about this, since Graal handles it in a very weird way..
__________________
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:18 AM.


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