How do you spawn unique NPCs for quests?

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

How do you spawn unique NPCs for quests?

Post 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!
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post 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.
-= Ho Eyo He Hum =-
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post 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. :(
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post 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

Code: Select all

script=3000
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...
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post 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.
-= Ho Eyo He Hum =-
Post Reply