Page 1 of 1
How do you spawn unique NPCs for quests?
Posted: Mon Jan 09, 2006 3:57 am
by stranf
So I was browsing spawn.dfn and the other NPC script files and have a good feel about how to define an NPC. I also was checking the conversation files and figured out the onspeak functions as well. It seems that the computer gets the text and replies based on if the NPC in range is addressed by name.
What I do not know how to do, is create a stationary, and/or wandering NPC, with a pre-set (non random) name that I can use for quests.
I'd still like to use the templates for the graphics and clothing.
I'm fairly comfortable with using the template NPCs, but they are too random to be useful when dealing with quests.
Thanks a ton!
Posted: Mon Jan 09, 2006 9:17 am
by Xuri
The NPCs doesn't actually only respond if addressed by name. The order of the entries in speech.js is irrelevant, they are all keywords the NPCs respond to.
You can copy & paste the DFN section for an existing NPC (from uox3\dfndata\npc\*.dfn) into an existing or a new .dfn file in the same folder, then modify it's values to your liking - including those for name, equipitem, packitem, script, etc.
Or you can create a basic NPC ingame using for instance 'ADD NPC male or 'ADD NPC female, then customize the NPC ingame using GM commands.
Posted: Mon Jan 09, 2006 6:54 pm
by stranf
thanks, that should be enough to get me stared.
I'll post if I have any other questions. As for now, it's time for the new school semester.

Posted: Tue Jan 10, 2006 5:33 pm
by stranf
Ok, I'm at school and don't have UOx3 with me, but I looked at the NPC dfn. files, and if I recall correctly, the line said something like
Does this point to the speech.js? I guess my question is, is if I write costomizable onspeech scripts or item add or removal, how do I link it to the NPC template in the dfn file?
Thanks guys, can't wait until I get the hang of this script engine...
Posted: Tue Jan 10, 2006 6:36 pm
by Xuri
script=3000 points to the script defined in jse_fileassociations.scp with a scriptID of 3000. And that is 3000=npc/speech/speech_001.js. =)
If you write your own onSpeech scripts (or using any other JS event), you must save it as a .js file, define a unique scriptID for it in jse_fileassociations.scp, then change the SCRIPT= tag to the scriptID of your new .js file.
Note that at the moment you can only assign one scriptID to any given item/character - but you can however put any number of JS events in the same .js file. That is, you cannot have two onSpeech events in the same file, but you can have onSpeech, onCollide, onUse, etc all in the same file.