Jump to content

Help with getting name of actor


Recommended Posts

So far I've been running into dead ends for simple things with papyrus.

 

Currently I'm working on a small mod that basically lets you command all of your active followers.

 

Right now I'm able to issue an all wait and all follow command by looping through activefollowers.

 

I am trying now to be able to command a follower, set them to do favor.

 

My problem is, is I'm not sure how to get actors ID/Name etc... in papyrus

 

https://www.creationkit.com/fallout4/index.php?title=GetName_-_Form

 

I've imported f4se into the source folder but still get an error with the get name function... and I can't find it any of the f4se scripts I've looked through...

 

fallout 4 modding but have a background in coding... just need a little direction as the wiki has not been helpful.

Link to comment
Share on other sites

I found my issue... I didn't have the f4se source files in the user directory.

 

 

The mod im working on tweaks idea from companion command mod...

 

I'm using voice attack as well... Basically in MCM, I have it to where you can set a hot key and then set that hotkey up in voice attack.

 

My script checks your currentactivefollowers and then checks the name of each. If that follower has the name piper and you use the piper hot key or say piper she will be in command mode.

 

Right now I can say Piper or Deacon, in my mic, and I will get their favor window for 3 seconds... I then can point at a target and say attack or go or do(all set to the activate K in voice attack)...

 

I'm trying to expand on this.

Link to comment
Share on other sites

I advise against using the GetName() F4SE function to determine who you're referencing. What happens if the user has changed Piper's name via mods? What happens if the user isn't using an English version of the game? I'd instead assign Piper to a property. That would be quicker in-game as well, as that's one less function you have to call.

Link to comment
Share on other sites

Ah Iâm not exactly sure how that works... Iâve been trying to figure out how to get info from other mods... I have a mod that sets all companions to an alias ref how would I go about piggybacking off of that mod to use itâs functions and get the alias references?
Link to comment
Share on other sites

All I'm saying is that it sounds like you're using the name of your companion (e.g. Piper, Nick, etc.) to determine which companion you want to command. There are a number of drawbacks to this implementation. I'm not sure in what context you're obtaining info from other mods.

 

If you have a hotkey that is specific to a given companion, then assign that companion to a property as such:

Actor Property CompanionPiper Auto Const Mandatory

Then if this property can be found in your list of current followers, issue the command.

Link to comment
Share on other sites

Still a bit lost on properties... I get what you are saying but not how to implement.

 

The script I'm accessing already has these properties for CompanionPiper etc....

 

Is there a quick an easy way to get those properties to my script?

 

I put the properties below my script name

 

Later I use a global function that uses the property

 

I get a compile error saying that it is not defined...

 

I'm a bit lost on how to define and use properties and variables without it blowing up.

 

For example I am getting the form from the other script, currently in each global command I am calling copying and pasting the same lines. How do I just define this The Form as a property such as

 

Quest someform = Game.GetFormFromFile(0x0, "mod.esp") as Quest

ScriptObject remotescript = someform.CastAs("Script")

and then later be able to use

 

Function UseForm() Global

{

remotescript.DoTheThing()

}

 

or how would you easily access the properties of the remotescript?

 

I've looked at the wiki and still confused

 

Still a noob and just trying to not hack around the coding structure. Any help is appreciated.

 

 

 

Link to comment
Share on other sites

It looks like this was covered in your other thread, I'd work through that step-by-step. If you don't want to use the CallFunction() function, etc. you can also more directly access the function. This is an excerpt from my Workshop Control Panel mod:

WCP_QUST_WorkshopControlPanel Property WorkshopControlPanelScript Auto Hidden

Event OnInit()
	GetWorkshopControlPanelScript()
	
	Self.RegisterForRemoteEvent(akEventSource = PlayerRef, asEventName = "OnPlayerLoadGame")
EndEvent

Event Actor.OnPlayerLoadGame(Actor akSender)
	GetWorkshopControlPanelScript()
EndEvent

Function GetWorkshopControlPanelScript()
	If (Game.IsPluginInstalled(asName = "WCP.esp"))
		WorkshopControlPanelScript = Game.GetFormFromFile(aiFormID = 0x00000F9A, asFilename = "WCP.esp") As WCP_QUST_WorkshopControlPanel
	EndIf
EndFunction

Function QuickScrap()
	Workbench = WorkshopControlPanelScript.Workshop.GetContainer()
EndFunction

For context, Workshop is a property of the WCP_QUST_WorkshopControlPanel quest script.

 

You can extract the source files to my mods from the BA2 file using a tool like BAE if you want to look into it more. I'll be looking at implementing the method that SKK50 covers tomorrow, as my method requires these referenced scripts to be in the data folder. That gets to be a bit of a pain when you have 5 scripts that are interconnected.

 

Given that you come across as fairly new to scripting, you might want to check out some YouTube tutorials, like Arron Dominion. You can also read some of the pages linked on the CK wiki.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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