Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Command for class NPCs: "rename" (https://forums.graalonline.com/forums/showthread.php?t=45314)

GrowlZ1010 06-06-2003 11:52 PM

Command for class NPCs: "rename"
 
NPC Code:

rename newname;



Since classes can be accessed with the getnpc statement and their cryptic NPCServer internal code number - usually looking something like localnpc_growlzblank_14777372_0 - shouldn't it be possible to rename them to something coherent? For example, giving a NPC a serial number:

NPC Code:

rename Sign #v(this.serial);



You could then do with (getnpc(Sign 2210)) instead of having to use something obscure like localnpc_signtest_33712039_4. This way, scripts could write their serial number to a string list on a DB NPC (no more having class NPCs somebody else laid but that you can't locate), and the database could even send them information about other class NPCs.

Kaimetsu 06-06-2003 11:56 PM

Class NPCs? Using getnpc to get classes? Wha? Classes are just chunks of code, they can't exist independently.

GrowlZ1010 06-06-2003 11:59 PM

Quote:

Originally posted by Kaimetsu
Class NPCs? Using getnpc to get classes? Wha? Classes are just chunks of code, they can't exist independently.
I should probably have clarified that I meant NPCs created by joining a class.

Kaimetsu 06-07-2003 12:07 AM

Are you talking about those created via putnpc2?

GrowlZ1010 06-07-2003 12:12 AM

Quote:

Originally posted by Kaimetsu
Are you talking about those created via putnpc2?
Yup.

A NPC created with putnpc2 is stored with a long and complicated internal ID string as pointed out in my first post. I'm suggesting a way to change that string to something sensible, like a serial number to call the NPC by.

For example, here's a weapon script that gets one of my Drone NPCs (created with putnpc2) - temporary NPCs that can be used to block rooms etc. and have unique ID numbers - and gives it new text; however, at the moment, there's no way of getting the NPC's ID string without using the NPC-Control, and to get its string with that requires you to know where it is!

NPC Code:

if (actionserverside){
setstring this.reply,Couldn't find the NPC;
with (getnpc(localnpc_growlzblank_14777372_0)){
setstring this.msg,ZIYEHOY!;
setstring thiso.reply,Gottum, sir!;
}
setplayerprop #c,(#s(this.reply));
}
//#CLIENTSIDE
if (weaponfired) triggeraction 0,0,serverside,TempTest;


TripleE 06-07-2003 12:33 AM

Quote:

Originally posted by GrowlZ1010
Yup.

A NPC created with putnpc2 is stored with a long and complicated internal ID string as pointed out in my first post. I'm suggesting a way to change that string to something sensible, like a serial number to call the NPC by.

For example, here's a weapon script that gets one of my Drone NPCs (created with putnpc2) - temporary NPCs that can be used to block rooms etc. and have unique ID numbers - and gives it new text; however, at the moment, there's no way of getting the NPC's ID string without using the NPC-Control, and to get its string with that requires you to know where it is!

NPC Code:

if (actionserverside){
setstring this.reply,Couldn't find the NPC;
with (getnpc(localnpc_growlzblank_14777372_0)){
setstring this.msg,ZIYEHOY!;
setstring thiso.reply,Gottum, sir!;
}
setplayerprop #c,(#s(this.reply));
}
//#CLIENTSIDE
if (weaponfired) triggeraction 0,0,serverside,TempTest;


That's pretty clever to think up. I guess it would also be easier to find stuff,because you wouldnt need to remember all those serial sting numbers. Nice Growlz ;)

Python523 06-07-2003 03:25 AM

Quote:

Originally posted by GrowlZ1010
Yup.

A NPC created with putnpc2 is stored with a long and complicated internal ID string as pointed out in my first post. I'm suggesting a way to change that string to something sensible, like a serial number to call the NPC by.

For example, here's a weapon script that gets one of my Drone NPCs (created with putnpc2) - temporary NPCs that can be used to block rooms etc. and have unique ID numbers - and gives it new text; however, at the moment, there's no way of getting the NPC's ID string without using the NPC-Control, and to get its string with that requires you to know where it is!

NPC Code:

if (actionserverside){
setstring this.reply,Couldn't find the NPC;
with (getnpc(localnpc_growlzblank_14777372_0)){
setstring this.msg,ZIYEHOY!;
setstring thiso.reply,Gottum, sir!;
}
setplayerprop #c,(#s(this.reply));
}
//#CLIENTSIDE
if (weaponfired) triggeraction 0,0,serverside,TempTest;


with (getnpc(localnpc_growlzblank_14777372_0))

you can actually do that? o_O never knew
and stefan said he is going to make a way to convert putnpc2 npcs to DB NPCs (on the npc list) and a way to rename them when I asked him about this a week ago, need to remind him to do it


All times are GMT +2. The time now is 09:53 AM.

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