Henrydatdao Posted June 21, 2021 Share Posted June 21, 2021 Guys, may I ask about how to script the following situation by Creation kit: When I kill an NPC, another NPC is spawned at the dead NPCâs location. Its similar to the mod Judgemental Wenches (when a Dwemer automation dies a Wench NPC is spawn, and if the Wench NPC is dead another NPC is spawn too) I know the basic of putting a script into creation kit but I donât know the actual script. Thanks a lot Link to comment Share on other sites More sharing options...
dylbill Posted June 21, 2021 Share Posted June 21, 2021 You can just attach a script like this to your actor in the creation kit: Event OnDeath(Actor akKiller) Self.PlaceActorAtMe(Self.GetActorBase()) EndEventThis will place the same NPC that died at its location. To place another NPC you can do: ActorBase Property MyActorBase Auto Event OnDeath(Actor akKiller) Self.PlaceActorAtMe(MyActorBase) EndEventIf doing it this way, to forget to fill the MyActorBase property in the creation kit after attaching the script. Link to comment Share on other sites More sharing options...
Henrydatdao Posted June 21, 2021 Author Share Posted June 21, 2021 You can just attach a script like this to your actor in the creation kit:Â Event OnDeath(Actor akKiller)Â Â Â Self.PlaceActorAtMe(Self.GetActorBase())Â EndEventThis will place the same NPC that died at its location. To place another NPC you can do:Â ActorBase Property MyActorBase Auto Event OnDeath(Actor akKiller)Â Â Â Self.PlaceActorAtMe(MyActorBase)Â EndEventIf doing it this way, to forget to fill the MyActorBase property in the creation kit after attaching the script. Link to comment Share on other sites More sharing options...
Henrydatdao Posted June 21, 2021 Author Share Posted June 21, 2021 You can just attach a script like this to your actor in the creation kit:Â Event OnDeath(Actor akKiller)Â Â Â Self.PlaceActorAtMe(Self.GetActorBase())Â EndEventThis will place the same NPC that died at its location. To place another NPC you can do:Â ActorBase Property MyActorBase Auto Event OnDeath(Actor akKiller)Â Â Â Self.PlaceActorAtMe(MyActorBase)Â EndEventIf doing it this way, to forget to fill the MyActorBase property in the creation kit after attaching the script.Thanks alot!! Do I need to create a quest with this script or just attach this script directly to this actor? Also this dead actor is spawn actor aswell, so its not placed in the world until certain time. Does this affect the script? Thanks! Link to comment Share on other sites More sharing options...
dylbill Posted June 21, 2021 Share Posted June 21, 2021 Hey, you would just attach it directly to the actor. It shouldn't matter if it's spawned with PlaceActorAtMe. If the actor starts dead though, the OnDeath event will never fire, as it's already dead. Link to comment Share on other sites More sharing options...
Recommended Posts