Killing multiple NPC's script

Post » Fri Jul 25, 2014 4:21 am

How can I make a script such as this? This will be my first attempt.

I know of the OnDeath script, but this will be multiple persons. I want to create a quest line where the Player helps a deserter NPC by wiping out all the bandits in Lost Knife Hideout. By doing so, every bandit in there has to be killed. After that, the quest is done.

I also want to make it to where the area is cleared and the NPC has comrades of its own in the cavern, such as how you wipe out one of the forts in Skyrim, the bandits are replaced by Imperials or Sons. And the bandits never again show up.

Hopefully this provides enough information. Thanks!

User avatar
cassy
 
Posts: 3368
Joined: Mon Mar 05, 2007 12:57 am

Post » Fri Jul 25, 2014 2:58 am

The amount of Aliases you need is the amount of Bandits in BOTH cells. Divide them by the cells you need. In this case, Lost Knife Hideout has 2 cells. If there is 7 Bandits in the first cell, you create 7 Aliases. If there is 3 for the other cell, create 3.

Fill Options: (For the first cell mobs)

Find Matching Reference. (nothing else checked)

â•šConditions:

  • GetInCell - LostKnifeHideOut01 == 1.00 AND
  • GetInFaction - BanditFaction == 1.00 AND

You do the above for the second cell bandits, but change it to LostKnifeHideOut02 == 1.00 AND

Create 2 globals.

Call them something like

BanditTotal = the maximum number of bandits.

BanditCount = the global that will be subtracted. This number needs to match the number of the BanditTotal.

Add these globals to the first tab of your quest. Text Display Globals.

For your quest objective tab, add your globals like this:

/

For the OnDeath Events

GlobalVariable property BanditCount autoActor property PlayerRef auto Event OnDeath(Actor akKiller)int iCount = BanditCount.GetValue() as int      if akKiller == PlayerRef        iCount -= 1           BanditCount.SetValue(iCount)           (GetOwningQuest() as myQuestScript).UpdateGlobals()          if iCount == 0             GetOwningQuest().SetObjectiveDisplayed(ObjectiveIndex) ; or whatever you need on this line to advance the quest.          else            ;keep killing          endif     endifEndEvent

I remember when people were starting out with quests that this was one the more desired things to do, but really hard to grasp at the time.

User avatar
Markie Mark
 
Posts: 3420
Joined: Tue Dec 04, 2007 7:24 am

Post » Fri Jul 25, 2014 4:05 am

Alright. I'll try this method then. I'll question if I end up at a dead end.

User avatar
c.o.s.m.o
 
Posts: 3419
Joined: Sat Aug 12, 2006 9:21 am

Post » Fri Jul 25, 2014 2:10 am

It's going to be the script you'll question, and I've posted the correct one just now.

However you're gonna need a quest script, so add that and then add the GlobalVariables, and make this simple function:

Function UpdateGlobals()    UpdateCurrentInstanceGlobal(BanditCount)EndFunction
User avatar
Kyra
 
Posts: 3365
Joined: Mon Jan 29, 2007 8:24 am

Post » Thu Jul 24, 2014 10:21 pm

Alright and what about spawning the new NPC's in the encampment? The ones that I mention later

User avatar
Carys
 
Posts: 3369
Joined: Wed Aug 23, 2006 11:15 pm

Post » Thu Jul 24, 2014 7:35 pm

Place an Xmarker where you want them to appear. Make it Initially disabled. Your NPCs need to link to this Xmarker via Enable Parent. They do not have to have the Initially Disabled box checked.

Make this Xmarker an Alias in your quest, check "Allow Disabled". You'll have to use Specific Reference, but that's ok, markers don't really cause much trouble(unless you duplicate them in the object window).

Setup your quest stage to Enable the Xmarker Alias, and this will "spawn" the NPCs linked to it.

Alias_MyEnableMarker.GetReference().Enable()

This is the quick way to do it.

User avatar
Dawn Farrell
 
Posts: 3522
Joined: Thu Aug 23, 2007 9:02 am


Return to V - Skyrim