Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Fun with NPC references

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
*Worthy*
Critical Thinker




Joined: 11 Aug 2003
Posts: 186

PostPosted: Sat Jun 19, 2004 12:46 pm    Post subject: Fun with NPC references Reply with quote

What commands do not work well with NPC references? For example, whenever I try to create an NPC that's a copy of an NPC & I use a variable for its reference, it copies NPC (0):

testNPC:=NPCreference(5)
createNPC(testNPC,2,3) #this creates a copy of NPC (0), not 5.

Are there any other commands that will not work with an NPC reference? Or am I mistaking when I say "create NPC" does not work with NPC references?

Thanks,

~Worthy
_________________
You can do whatever you want...but prison is full of people who make bad decisions.
Back to top
View user's profile Send private message Send e-mail AIM Address
Uncommon
His legend will never die




Joined: 10 Mar 2003
Posts: 2503

PostPosted: Sat Jun 19, 2004 1:04 pm    Post subject: Reply with quote

It goes this way:
Code:
testNPC := create npc (5,2,3)

The thing is, you were trying to assign a reference to an npc that hasn't been placed yet. You do it this way instead and it will give you the reference of the particular npc that was just created.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
*Worthy*
Critical Thinker




Joined: 11 Aug 2003
Posts: 186

PostPosted: Sat Jun 19, 2004 1:23 pm    Post subject: Reply with quote

I see what you're saying, but I meant it the way I typed it: using a variable that refers to an NPC reference when creating an NPC (when I created the NPC, I wanted to use a reference, not the ID #5 because a reference is a quicker command). Thanks for answering my question though; I'll just have to change my "create NPC" commands that use an NPC reference.

Thanks a lot!

~Worthy
_________________
You can do whatever you want...but prison is full of people who make bad decisions.
Back to top
View user's profile Send private message Send e-mail AIM Address
Me
HI.




Joined: 30 Mar 2003
Posts: 870
Location: MY CUSTOM TITLE CAME BACK

PostPosted: Sat Jun 19, 2004 2:47 pm    Post subject: Reply with quote

NPC references, if I recall correctly, are fairly large negative numbers, like -200 and stuff. This is probably to keep them from interfering with NPC ID numbers, which are small positive numbers. When you "create npc(testnpc,2,3)," you are trying to create a copy of NPC #-234 (or something along that line), and most likely Hamsterspeak goes AGH and changes the huge negative to the number 0.
_________________
UP DOWN UP DOWN LEFT LEFT RIGHT RIGHT A B START
Back to top
View user's profile Send private message AIM Address
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Sat Jun 19, 2004 9:46 pm    Post subject: Using NPC references with "create NPC" Reply with quote

"create NPC" is the only NPC command that can ONLY accept NPC ID numbers and not references. (Technically, "Alter NPC" and "set NPC speed" only take ID numbers too, but unlike "create NPC" they are capable of gracefully converting references into ID's behind the scenes so you never notice the limitation)

Anyway, you can accomplish the bahaviour you want by using the "get NPC ID" command.

Code:

testNPC:=NPCreference(5)
createNPC(get NPC ID(testNPC),2,3) #this creates a copy of NPC 5
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group