Generate random NPC's?

Post » Wed Sep 14, 2011 5:58 am

Is it possible to generate new NPC's thru scripting?

I'm currently working on a mod that allows you to rent enchantments rather than buy them and when you don't return them, the person that rented the item out to you will send people to retrieve it. I would like for the player to be able to kill them off if they don't want to return the item, after which the owner would send a new gang, stronger and better equipped until the item is retrieved. To this end I would have to generate new NPC's everytime they get killed but I don't think it's even possible because as far as I understand it, anything you place in the world thru scripting already needs to exist otherwise it can't be referenced.

The basic need I would have I guess is the ability to duplicate an NPC, change their name and maybe their hair as well as their stats. I know stats are no problem, but their name and appearance are a problem I tink?

Is it really impossible or did I miss something vital? This is my first mod so I'm still lacking in experience, if anyone could tell me wether it can be done and if so, point me in the right direction I'd be very grateful.
User avatar
Kirsty Collins
 
Posts: 3441
Joined: Tue Sep 19, 2006 11:54 pm

Post » Wed Sep 14, 2011 3:38 pm

I like that idea.

You can't generate truly random NPCs, but you can randomly pick from those that have been made. If you have a look at the script that controls the Dark Brotherhood assassins in Tribunal, it essentially does what you want. Something only needs to be placed in the game if a script function that references it needs a fix, I believe. You can place items into the game via script with multiple functions. The Dark Brotherhood assassins that attack you when you sleep aren't placed in the game initially, but are placed by a script using PlaceAtPC.

Have a look at Morrowind Scripting For Dummies; specifically PlaceAtPC, PlaceAtMe, PlaceItem and PlaceItemCell.
User avatar
Louise Andrew
 
Posts: 3333
Joined: Mon Nov 27, 2006 8:01 am

Post » Wed Sep 14, 2011 5:14 pm

Thanks, I got the idea when someone asked about cheap enchanting services. I originally planned on doing a quest-mod first but this seemed like a better learning project.

I'm already working with the SFD to learn scripting for Morrowind. I code for a living so it's just a matter of getting up to speed but I still have a lot to learn about the limitations of the engine :)

So no truly random NPC's, no biggie. I should probably just give some of them a helmet to obscure their face, making them more diverse. And if I create a set of new NPC's to pick from and make sure they don't get recycled too fast it should all work out very well. I'll knock up a quick test-script tomorrow and see how it goes.

Thank you for your advice, I'll be making a WIP / REL-thread for this in the mod-section as it starts to flesh out.
User avatar
Robert Jr
 
Posts: 3447
Joined: Fri Nov 23, 2007 7:49 pm

Post » Wed Sep 14, 2011 5:53 am

I recommend you create more NPCs instead of changing their apperance/name (I doubt if it's even possible) especially if it's your first try with CS.
User avatar
Jimmie Allen
 
Posts: 3358
Joined: Sun Oct 14, 2007 6:39 am

Post » Wed Sep 14, 2011 7:30 pm

Maybe it would be possible to create a hidden interior cell with 1000 "repo thugs." That way the NPC's would be in the game, but they would not touch the outside world until the script prompted them to.
User avatar
Ice Fire
 
Posts: 3394
Joined: Fri Nov 16, 2007 3:27 am

Post » Wed Sep 14, 2011 4:39 pm

Thank you for your advice, I'll be making a WIP / REL-thread for this in the mod-section as it starts to flesh out.

No problem. You can also add items to your NPCs with leveled lists. This would give a single, basic archetype NPC different looks. Combined with a few looks for each archetype, and you have a good variety.

I recommend you create more NPCs instead of changing their apperance/name (I doubt if it's even possible) especially if it's your first try with CS.

Making a few variations is no problem. If multiple people are coming after you and they all look the same, it would be undesirable.

Maybe it would be possible to create a hidden interior cell with 1000 "repo thugs." That way the NPC's would be in the game, but they would not touch the outside world until the script prompted them to.

It's very possible and has been done in many a mod, but I don't think anybody really likes using this approach. I sure don't, anyway. Plus, 1000 NPCs is overkill.
User avatar
chirsty aggas
 
Posts: 3396
Joined: Wed Oct 04, 2006 9:23 am


Return to III - Morrowind