Jump to content

How do you spawn an NPC using a holotape?


Tren909

Recommended Posts

Hi, everyone, so I actually made a post a while ago about how I was making a holotape that can spawn NPCs and I wanted to make it like braden's mod. I contacted him, but he doesn't reply, so I am kind of on my own over here. I apologize if it might seem obvious, but I do not how to make a papyrus fragment that would make the NPC spawn at the player. Kind of like Player.placeatme 0000007 (this would spawn a player clone at you). I searched throughout the Creation Kit for scripts, but I came out empty-handed as it just says (0 succeeded, 1 failed). The goal is to spawn a custom NPC I made (I spawned him using console commands in the game), using a holotape, and the reason it is for the holotape is so that I can soon upload it to the Xbox One. So in the holotape (the menu works fine, as I tested the holotape in the game, so I just need to make a papyrus fragment that spawns the NPC I want once the person clicks on it). I used actorbase, but I also hear that to spawn an NPC, you need to set the conditions to ObjectReference. I made a property to ObjectReference, but my NPC or any NPCs do not pop up in the menu. I used an ActorBase and I found my NPC that way. Maybe I am also wrong on the conditions part? Again, I apologize if the answers are easy, but I used a lot of player.placeatme scripts that I found on the Creation Kit reference.

 

Thank you for reading and for any assistance on this! I really do appreciate it.

Link to comment
Share on other sites

Basic info:

Scripts attached to a holotape that is put into the PiPboy can only be used in an limited way.

The script must be attached to the holotape item itself and fires only after

-you've loaded the holotape into your pipboy

-you put your PiPboy down afterwards

 

So complex decisions and menus can only be made via a message box

 

A very basic script for your holotape item then would be:

Actor Property PlayerRef Auto
Actor Property TheNPC Auto

Event OnEquipped(Actor akActor)
  if akActor == Game.GetPlayer()
PlayerRef.Placeatme(The NPC)
Endif
EndEvent

However let's say you want to make it so two kinds of NPCs would spawn then the script could look like this

Actor Property PlayerRef Auto
Actor Property TheNPC1 Auto
Message Property TheMenu

Event OnEquipped(Actor akActor)
  if akActor == Game.GetPlayer()
Int iButton = MRMainMenu.Show()
    If IButton == 0
PlayerRef.Placeatme(TheNPC1)
Elseif IButton == 1
PlayerRef.Placeatme(TheNPC2)
Endif
Endif
EndEvent

In the latter case you'd need to create a message box with at least two options

Link to comment
Share on other sites

If your actor is not UNIQUE:

 

In the terminal select the spawn actor menu item

Press the little down arrow next to the PROPERTIES button below it.

Select [ Create using form ]

Paste in the form name of your actor like [ lvlDeathclaw ]

It should add the letter P in front to remind that it is a PROPERTY

 

In the fragment box enter:

ObjectReference ThisREF = Game.GetPlayer().PlaceActorAtMe( plvlDeathclaw )

 

But, if your actor is UNIQUE apparently it is better to place them in the world in creation kit disabled rather than spawn due to persietent editor locations or such. Then move to an active location and enable for use.

Link to comment
Share on other sites

Basic info:

Scripts attached to a holotape that is put into the PiPboy can only be used in an limited way.

The script must be attached to the holotape item itself and fires only after

-you've loaded the holotape into your pipboy

-you put your PiPboy down afterwards

 

So complex decisions and menus can only be made via a message box

 

A very basic script for your holotape item then would be:

Actor Property PlayerRef Auto
Actor Property TheNPC Auto

Event OnEquipped(Actor akActor)
  if akActor == Game.GetPlayer()
PlayerRef.Placeatme(The NPC)
Endif
EndEvent

However let's say you want to make it so two kinds of NPCs would spawn then the script could look like this

Actor Property PlayerRef Auto
Actor Property TheNPC1 Auto
Message Property TheMenu

Event OnEquipped(Actor akActor)
  if akActor == Game.GetPlayer()
Int iButton = MRMainMenu.Show()
    If IButton == 0
PlayerRef.Placeatme(TheNPC1)
Elseif IButton == 1
PlayerRef.Placeatme(TheNPC2)
Endif
Endif
EndEvent

In the latter case you'd need to create a message box with at least two options

 

Hello, thank you for your response! I was actually looking for a papyrus fragment, but I will keep this noted for future reference. One last thing, can you tell me how you would know what to look for in the Creation Kit? Like for information like that, as I get confused if I need to look for an ObjectReference or an ActorBase. Sorry if that doesn't make sense! Haha!

 

Thank you!

Link to comment
Share on other sites

If your actor is not UNIQUE:

 

In the terminal select the spawn actor menu item

Press the little down arrow next to the PROPERTIES button below it.

Select [ Create using form ]

Paste in the form name of your actor like [ lvlDeathclaw ]

It should add the letter P in front to remind that it is a PROPERTY

 

In the fragment box enter:

ObjectReference ThisREF = Game.GetPlayer().PlaceActorAtMe( plvlDeathclaw )

 

But, if your actor is UNIQUE apparently it is better to place them in the world in creation kit disabled rather than spawn due to persietent editor locations or such. Then move to an active location and enable for use.

Interesting! This one worked for me! Thank you so much because this finally resolved an issue that I had for almost a year already! Just like Zorkaz, I'd like to request if you could tell me how you find your information as when I look on the Creation Kit website looking for something, I get confused on if I need to find the ObjectReference or the Actorbase. I'd also like to know how you got educated on modding as I look on YouTube tutorials and not all of them have what I am looking for.

 

Thank you so much!

Link to comment
Share on other sites

I learnt by looking at how the base game delivers specific capability.

 

Youtube videos mostly are monkey-see-monkey-do button pushing with no explanation of WHY you are pushing the buttons and what the consdierations are. Good for some, not me.

 

To understand papyrus scripting you need to understand the object and inheretance model Form > Class > Object. If you are not a developer thats just some words and its hard to "teach".

Link to comment
Share on other sites

I learnt by looking at how the base game delivers specific capability.

 

Youtube videos mostly are monkey-see-monkey-do button pushing with no explanation of WHY you are pushing the buttons and what the consdierations are. Good for some, not me.

 

To understand papyrus scripting you need to understand the object and inheretance model Form > Class > Object. If you are not a developer thats just some words and its hard to "teach".

Oh, I see! So you look at the vanilla game's events and such and how they work? Like vanilla quests, how caps are given, etc...

Link to comment
Share on other sites

Yes, there is a bit of a learning curve with Papyrus. If you want to attach a script to your holotape, it should look like this:

 

Actor Property PlayerRef Auto
ActorBase Property TheNPC Auto

Event OnEquipped(Actor akActor)
  if akActor == Game.GetPlayer()
     PlayerRef.PlaceActorAtMe(TheNPC)
  Endif
EndEvent

Your script should extend Holotape. Using PlaceAtMe is for non actors, for actors you need PlaceActorAtMe.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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