Jump to content

[LE] Is there a way to add keywords to npcs through script?


Recommended Posts

Hello. I'm working on a mod that takes into account whenever the player loots the body of a guard and adds a crime bounty to him. This works so far but i want to add a keyword to the corpse of the guard so the option to loot appears only a first time when the player interacts with the corpse. I used a perk with an entry point replacing the regular looting for a little window that says "loot". Once the player clicks that button the body can be looted as usual and the bounty is added as expected but i need to add a keyword to the corpse so the entry option appears just once and doesn't appear again on that corpse.

 

This is for Skyrim Special Edition by the way.

Link to comment
Share on other sites

Little update: Forgot to show the result. Works great, if no one sees you guards won't arrest you. Here it is in case it might be useful for someone.

 

Code:

int aiButton = 0
	aiButton = rep_LootingMessage.Show()
Actor Corpse = akTargetRef as Actor
If aiButton == 0
	If (Corpse.IsInFaction(CrimeFactionPale))
	CrimeFactionPale.modcrimegold(500)

	ElseIf (Corpse.IsInFaction(CrimeFactionFalkreath))
	CrimeFactionFalkreath.modcrimegold(500)

	ElseIf (Corpse.IsInFaction(CrimeFactionHaafingar))
	CrimeFactionHaafingar.modcrimegold(500)

	ElseIf (Corpse.IsInFaction(CrimeFactionReach))
	CrimeFactionReach.modcrimegold(500)

	ElseIf (Corpse.IsInFaction(CrimeFactionRift))
	CrimeFactionRift.modcrimegold(500)

	ElseIf (Corpse.IsInFaction(CrimeFactionWhiterun))
	CrimeFactionWhiterun.modcrimegold(500)

	ElseIf (Corpse.IsInFaction(CrimeFactionEastmarch))
	CrimeFactionEastmarch.modcrimegold(500)

	ElseIf (Corpse.IsInFaction(CrimeFactionSons))
	CrimeFactionSons.modcrimegold(500)

	ElseIf (Corpse.IsInFaction(CrimeFactionImperial))
	CrimeFactionImperial.modcrimegold(500)
	
	ElseIf (Corpse.IsInFaction(WIGenericCrimeFaction))
	WIGenericCrimeFaction.modcrimegold(500)

	ElseIf (Corpse.IsInFaction(DLC1VampireCrimeFaction))
	DLC1VampireCrimeFaction.modcrimegold(500)

	ElseIf (Corpse.IsInFaction(DLC2SV02ThalmorCrimeFaction))
	DLC2SV02ThalmorCrimeFaction.modcrimegold(500)
	
	EndIf
	Corpse.Activate(PlayerRef as objectreference, true)
ElseIf aiButton == 1
		
EndIf

How it looks ingame:

uSR3Bf3.jpg

Link to comment
Share on other sites

  • Recently Browsing   0 members

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