Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

NPC's & AI: Sparring NPC's


Hanaisse
 Share

Recommended Posts

Sparring NPC's; aka Fight Club

gallery_1515_264_206022.jpg

Let's create a set of sparring NPC's, for NPC creation practice and to add some fun to our game. It's not as difficult as you might think.

STEP 1: Before we start.

In order to complete this tutorial you will need to have completed all four of InsanitySorrow's NPC & AI classes. This class will be building on some of those basics as well as new things. You should also have completed the CS Basics class to know your way around the CS.

This class will require this ESP - NPC07 Sparring Tutorial.esp. Please download and add to your Oblivion\Data folder before we start. It contains the basic location for our sparring partners.

Note: The ESP may or may not conflict with other mods in your load order. As this is an optional class on NPC creation you can disable the mod when completed if it interferes too much. Or, feel free to keep it active for some entertainment.

STEP 2: Let's get started.

Open up the CS (or CSE, it doesn't matter the basics are the same), check off our NPC07 Sparring Tutorial.esp and make it active.

The first thing we are going to do is create our two NPC's. We already know how to do that, right? Highlight the NPC heading in the Object window, right click in the Editor ID column and click NEW.

:smarty: Smarty Says: Do not copy an existing NPC. They will have things that we don't need and cleaning them up is more work then creating a new one.

Here's the general information you'll need.

Stats Tab;

ID: aaNPC07Spar01 & aaNPC07Spar02

Name: Give them any name you'd like

Level: 15

Class: Warrior

Race: Any race you like

Hair: Any style you'd like

Eyes: Any color you'd like

Gender: You can make them both male, both female, or male and female, it's your call

Check No Persuasion

Check No Rumors

Check Auto-calc Stats

Leave Combat Style at Default

Stop there. That's all we need on this tab.

Once you have both your fighters looking the way you'd like, let's give them some basic inventory.

Inventory Tab;

Basic clothing or armor (your choice)

Basic melee weapon (nothing enchanted, and bows do not work well)

A little gold

A bit of jewelry

Spells Tab;

Leave this blank. We won't be giving our NPC's any spells. No, not even a restore health spell.

Faction Tab;

A Faction is a way of joining a group of NPC's (and/or the player) with something in common together for added benefits. There are many factions in Oblivion. Some you know about, some you don't know about. For our sparring partners, we're going to create a unique faction just for them that no one else, not even the player, can be part of.

First thing we need to do is create the faction. Leave the NPC creation window alone for a moment and go to the Headers at the top of the CS.

Under Character is a listing called Factions. Click on this to open the Factions box.

gallery_1515_264_61059.jpg

Right click anywhere under the EditorID column and select New.

This will bring up a box asking to name our faction. Name it aaNPC07SparringFaction and click OK.

gallery_1515_264_50999.jpg

We should now have aaNPC07SparringFaction highlighted in the EditorID column and be looking at a blank page.

In the Name box add NPC07 Tutorial Sparring Faction.

Check the box - Hidden from PC

Check the box - Special Combat

gallery_1515_264_13932.jpg

That's all we need here. Click Apply. Don't close the box yet.

Bring the NPC creation window over top of the Faction creation window. Left click on our faction in the EditorID column, hold the mouse button and drag it to our NPC Faction tab.

gallery_1515_264_133120.jpg

Click Ok in the NPC window, open our second NPC window and do the same to add our faction. Close the Faction creation box when finished.

Save the esp.

STEP 3: Placing our NPC's.

We now need to open our exterior cell to place our NPC's into their training area. In the Cell View box go to Tamriel worldspace and double click on our cell aaNPC07Ext (it should be listed near the top).

Our training area is by the fence by the road, so zoom in toward that area marked here.

gallery_1515_264_70670.jpg

Drag and drop our NPC's into the render window in their training area, facing each other but leave some space between them.

gallery_1515_264_211207.jpg

Double click on one of the NPC's to open the Reference window and give the NPC a Persistent Reference ID. Do the same for the other.

Use ID's aaNPC07Spar01Ref and aaNPC07Spar02Ref respectively.

gallery_1515_264_33867.jpg

Save the esp.

STEP 4: Create/Place XMarkerHeadings

What is an xmarkerheading, you might ask. Well, it's basically what it sounds like - "X marks the spot". It's a mesh that is used to tell NPC's where they should be and what direction they should be facing.

In our Object Window, scroll down and highlight Statics category. Now scroll through the list of statics until you find "XMarkerHeading". Drag and drop it into our Render Window. Place it in front of NPC01. It should look like this.

gallery_1515_264_127763.jpg

You may be thinking, "Hey, I've seen that before." Looks like a MapMarker, doesn't it? It acts the same as one too, in that the 'nose' needs to point in the direction you're going. In this case, the nose should be pointing to our other NPC. Make sure to pan around to get it positioned properly.

Drag and drop a second XMarkerHeading and place it in front of NPC02, facing toward NPC01.

Double click the XMarkerHeading in front of NPC01 and give it the Persistent Reference of aaNPC07FightMarker01. In the X Target Data tab, click Select Reference in Render Window then double click on NPC02. Click OK.

gallery_1515_264_23847.jpg

Now do the same for NPC02's XMarkerHeading, using aaNPC07FightMarker02 as the Persistent Reference and NPC01 as the target ref.

Save the esp.

STEP 5: Create the scripts.

In order for our NPC's to spar they need scripts to tell them what to do. It's not expected for you to write these scripts. The scripts are provided here and require a copy/paste into the CS scripting box. We'll do this together for those unfamiliar with scripting.

In the CS, along the top row of icons, at the very end, is one that looks like a pencil. Click on this to open the Script Editing window.

gallery_1515_264_5787.jpg

Note: Screenshots here may not look like yours. This is from the CSE. The basics however are the same.

Click on the piece of paper looking icon in the corner that says NEW. Now copy / paste the following script into the editor window.

Scriptname aaNPC01Script

Short Practice

Begin GameMode
If (Practice == 0)
If (GetDistance aaNPC07FightMarker01 <= 500)
Set Practice to 1
Evp
Endif
Endif

If (Practice == 1)
If (GetDistance aaNPC07FightMarker01 > 500)
Set Practice to 0
Endif
Endif
End[/code] Make sure the Script Type says Object. Click on the little disk to save. The script name will change to the "scriptname" we gave it in our script. [center]gallery_1515_264_36599.jpg[/center] Click on the NEW icon again and copy / paste our second script.
[code]Scriptname aaNPC02Script

Short Practice

Begin GameMode
If (Practice == 0)
If (GetDistance aaNPC07FightMarker02 <= 500)
Set Practice to 1
Evp
Endif
Endif

If (Practice == 1)
If (GetDistance aaNPC07FightMarker02 > 500)
Set Practice to 0
Endif
Endif
End

Click on the disk to save. Close the Script Editor window.

Save the esp.

STEP 6: Apply the scripts.

Now we need to add these scripts to our NPC's. Open up aaNPC07Spar01 and in the Script box, click on the arrow to the right to bring up the script selections. Add aaNPC01Script. Click OK to close our NPC window.

gallery_1515_264_55038.jpg

Do the same for aaNPC07Spar02, adding script aaNPC02Script.

Save the esp.

STEP 7: AI Packages

Our final step is to give our NPC's AI packages so they act real and will actually spar when they have nothing else to do.

There's one important thing we need to do first and that is to give ownership of the house to our NPC's so they will use it and not wander to the Imperial City to eat.

In our Cell View window, go to Interiors, and right click on aaNPC07Int. Go to Edit. In the Interior Data tab, click on the arrow beside the Owner Faction box and choose our faction - aaNPC07SparringFaction. Click Apply and OK. (This is one reason we use Factions, to allow our two NPC's to live together.)

We're going to give our NPC's basic Eat, Sleep and Wander packages. We also need to create one more - our Sparring package.

Open aaNPC07Spar01 and click on the AI button to open the AI window. Under the AI Package List, Editor ID column, right click and select New. Add this information;

ID: aaNPC07SparAI01

Package Type: UseItemAt

Check Defensive Combat

Under Schedule Tab;

Time: Any

Duration: 10

gallery_1515_264_67105.jpg

Under Conditions Tab;

Click New at the bottom of the tab.

In the Condition Function box, click on the arrow to open the list and scroll to find GetScriptVariable.

Click the button under Function Parameters. Another little window will open. In the top SelectReferenceID box, click on the button that says TARGET.

gallery_1515_264_45805.jpg

We should be lucky and it should be filled in like this already. If not, find the proper references.

gallery_1515_264_2321.jpg

Click OK and now the Variable Name at the bottom of the Function Parameters box should say Practice. Click OK to close that window.

gallery_1515_264_11266.jpg

Back in our Conditions window, change the Value to 1.

Click New at the bottom again. We need a second condition.

In the Condition Function box, click on the arrow to open the list and scroll to find GetDeadCount.

Click the button under Function Parameters. Use the drop down arrow to change Actor Base to aaNPC07Spar02.

Click OK.

Our Conditions tab should look like this. Make sure the conditions are in this order.

gallery_1515_264_1446.jpg

Under Location Tab;

Check Location.

Check Near Reference Selected.

This should fill in Cell with our exterior cell name. If not, find aaNPC07Ext in the drop down list.

Click the drop down beside Ref and find our XMarkerHeading - aaNPC07FightMarker01.

gallery_1515_264_87492.jpg

Under Target Tab;

Select: Any Object

Object Type: Weapons: Melee

gallery_1515_264_31487.jpg

Our Spar AI package is complete. Click OK.

With our AI packages window still open, go to Characters > Packages and open the window beside ours. Drag and drop the following packages to complete our NPC.

- aaaEat8x2

- aaaEat18x2

- aaaSleep22x8

- aaaDefaultExploreEditorLoc512

Important: Arrange the order of the packages like this;

Eat

Sleep

Spar

Wander

gallery_1515_264_81348.jpg

Click Save to close the AI window, and click OK to close our NPC01 window. Our first NPC is complete.

Open aaNPC07Spar02 and repeat the above steps, making sure to change the references where appropriate.

Spar package ID = aaNPC07SparAI02

Conditions GetScriptVariable Ref = aaNPC07Spar02Ref

Conditions GetDeadCount = aaNPC07Spar01

Location Ref = XMarkerHeading aaNPC07FightMarker02

Save the esp.

Add a MapMarker to our Exterior cell if you'd like. (Remember CS Basics Class #3?)

Close the CS.

Stretch. Ahhh.

STEP 8: Test our Sparring partners

We're now ready to go in game and observe our set of Sparring NPC's. Make sure the esp is active in your Data Files (or in Wrye Bash or OBMM) and launch the game.

You can use the console to quickly coc to aaNPC07Ext, or fast travel to a location nearest them like Roland Jenseric's Cabin if you did not add a Can Travel To MapMarker.

Our location is here;

gallery_1515_264_12645.jpg

Enjoy the show!

FightClub.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...