View previous topic :: View next topic |
Author |
Message |
*Worthy* Critical Thinker

Joined: 11 Aug 2003 Posts: 186
|
Posted: Sat Jun 19, 2004 12:46 pm Post subject: Fun with NPC references |
|
|
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 |
|
 |
Uncommon His legend will never die

Joined: 10 Mar 2003 Posts: 2503
|
Posted: Sat Jun 19, 2004 1:04 pm Post subject: |
|
|
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 |
|
 |
*Worthy* Critical Thinker

Joined: 11 Aug 2003 Posts: 186
|
Posted: Sat Jun 19, 2004 1:23 pm Post subject: |
|
|
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 |
|
 |
Me HI.

Joined: 30 Mar 2003 Posts: 870 Location: MY CUSTOM TITLE CAME BACK
|
Posted: Sat Jun 19, 2004 2:47 pm Post subject: |
|
|
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 |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Sat Jun 19, 2004 9:46 pm Post subject: Using NPC references with "create NPC" |
|
|
"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 |
|
 |
|