Jump to content

Photo

How to get any NPC to fight for you using quest aliases?

alias combat package

  • Please log in to reply
1 reply to this topic

#1
RocketBun

RocketBun

    Enthusiast

  • Premium Member
  • 133 posts

Hey! I'm trying to make a mod that can attach a quest alias to any NPC, and i want to make it so those NPCs fight enemies alongside me. I tried using the setPlayerTeammate() function, but for example, when i attach the alias to Carlotta Valentia, she draws her weapon and just follows me around in combat without attacking anyone. How do I make her actually fight? I even tried swapping the confidence and aggression values of the aliased NPC, but it doesn't seem to do anything either. I also tried setting the alias combat override to a package list containing UseWeapon and UseWeaponDrawn packages, and that didn't seem to work either. What am I missing here?

 

I don't want to be forced to directly edit NPCs, because I want the mod to apply to any NPC, even ones from arbitrary mods. Any help is appreciated.

 



#2
cumbrianlad

cumbrianlad

    We demand... a shrubbery!

  • Premium Member
  • 1,451 posts

Interesting question.

 

You could try adding the alias to the 'Player Faction' aswell. That way anything in the 'Player Enemy Factions' will also be their enemy. You'll need to set up the aggression, as you stated as well. Carlotta is unaggressive, helps allies, confidence average. Set her to aggressive or very aggressive... not 'Frenzied'! Unaggressive should still work if the player is her ally and the enemies aren't. Set her confidence to 'Brave' or 'Foolhardy'. As things stand, Carlotta will try to avoid combat if she is outmatched because she is only 'average' confidence. Any guard in Whiterun is likely to 'outmatch' her, as will many other NPCs. As a result, she'll not attack them, even if she is your ally.

 

It may be complicated for Carlotta too, because she's in the 'Town Whiterun Faction'. Where have you tested her? I'm unsure how she will react if you are attacking anyone else in that faction... that's basically the whole of Whiterun.

 

I think you're right to avoid editing vanilla NPCs... that's a big no-no in my book.

 

You could also try Alias_MyAliasName.SetRelationshipRank(PlayerRef, 3) in a stage papyrus fragment to make sure they are an ally. Setting it to 3 will make them an ally of the PlayerRef*. None of this will work unless the NPC helps 'Friends And Allies'. Carlotta does, though. If the NPC is 'Helps Nobody' in their assistance value they may still refuse to fight. This shouldn't be what's stopping Carlotta, though, but even if you get Carlotta to fight for you, other NPCs may not do so, unless their assistance value is set in the quest too. I don't know the script to alter this AI value.

 

Factions can be tricky. So can AI data.

 

* Game.GetPlayer() will also work but it's slow, especially if you are calling it on several NPCs at a time. Set up a property in the quest Actor Property PlayerRef Auto. It will automatically fill and is much quicker for the game.







Also tagged with one or more of these keywords: alias, combat, package

IPB skins by Skinbox
Page loaded in: 1.106 seconds