Jump to content

Help a beginner make a mod


Recommended Posts

Hi. My mod idea is simple, but I'm not sure how to implement it properly with the least possible bugs and conflicts.

 

Basically I want there to be a one-time check for every NPC, probably when I enter their cell, to add certain items yet to be decided. Let's say for example purposes, I want to add an Apple to their inventory.

 

Now this script will determine how many Apples to give the NPC based on certain factors. For example, the NPC's Luck value, and whether or not the NPC is female. Just for example purposes, let's say females get 3 Apples more than males get, with a base number of Apples added determined by the NPC's Luck.

 

Also, I want to make sure that this never runs on the player, which is probably the easy part of the script.

 

Finally I want to make it so that this script doesn't ever happen again on this same NPC, until this NPC respawns somehow, in the case of bandits.

 

I understand this may not be the best way to do things, but I don't know how else to do it other than to make a leveled list for every character, which is obviously a worse idea, because it will conflict with other mods that modify leveled lists, not to mention having to check each and every NPC for its stats, not to mention having to make patches for mods that add NPCs like Crowded Cities, CM Partners, etc... You get the idea.

 

The reason I want to make this script is to give special items to certain NPCs based on their stats and other factors rather than just their level (as opposed to a leveled list), and to make it scripted so that it'll work even on NPCs added by other mods. So, for example, if an NPC has an intelligence of 75, we can assume this is a very learned person, and therefore, should have some books fit for intelligent people in its inventory.

 

I'm a beginner at scripting, though I have a little working knowledge of some of its functions (such as blocks, declaring variables, etc.). Clear explanations or even a sample script would be enough for me, and I can probably figure out how to edit it myself.

 

Thank you for reading this.

 

- edit: Oh, and I put it in Troubleshooting because I already tried making such a script but it wasn't working properly. I'm probably missing some basic stuff that experienced modders already know. If this should be in another section, I hope the moderators could fix it up for me. ;D

Link to comment
Share on other sites

That is some pretty hefty scripting you want to do there. It is way beyond my current skill level. I am wondering if you could do some sort of a Set Self to GetSelf GetIsActionRef sort of thing linked to a script on a quest using the unreliable If Player.GetDistance <=. It is really a nightmare trying to have a script effect every single possible NPC in the whole game. It works much easier if you can make a single actor persistant, give him or her a referenceID and place the script effecting only him or her on him or her.
Link to comment
Share on other sites

What you want can be best accomplished using the GetFirstRef and GetNextRef functions of OBSE. An example script can be found in my NPCs Have Bones mod. It ads bones to NPCs that are in the same cell as the Player. It also adds a token (an unplayable piece of jewelry) to them that the script checks for before adding bones. If they don't have it, bones and the token get added. You could use my script as a base and modify it with skill and attribute checks to do what you want.
Link to comment
Share on other sites

Alright thanks. I'll have a look at the script. :D Sounds very similar to what I want to do already.

 

Follow-up question. If I get the script to work, and it does add to their inventory, how can I force the NPC to equip it if it's equippable? Let's say, I wanna give a farmer's hat that uses a tail slot to a Farmer. I already know NPCs don't equip tail slot items by default, and you probably have to force them to equip it via script or something.

Link to comment
Share on other sites

Thank you. :) I'll play around with the script now. It looks so ridiculously simple and a lot shorter than I thought it would be, but I guess we owe that to OBSE. If the original bones script works, which it probably does or else you wouldn't release it, then mine should too, though I suddenly realize how many conditions and possible items I'll have to make available. o_O

 

Anyway thanks for all the help!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...