Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

[SKY] GetFormFromFile


TigerCubofPNW
 Share

Recommended Posts

Okay, I've researched, I've tested, I've hammered and I give up.

I need to use GetFormFromFile to grab an Actor reference from another mod. The code is not complex, and yet it refuses to work. I thought maybe it just doesn't work on Actors, but this page in the Wiki specifically uses it to get an Actor reference.

So I went waaaay back to basics and tried to get the code to recognize an Actor from the vanilla game and still nothing.

here is the very very basic line of code:
 

Actor newCompanion = Game.GetFormFromFile(0x00013478", "Skyrim.esm") as Actor

Actor newCompanion comes back as None no matter what I do. I've tried every combination and sequence of 0x0000(FormID) all with no success.

The code is straightforward, simple and easy. It's not the Form ID since I get the same results no matter if it's a vanilla NPC or one from a mod. It's not that I'm referring to an Actor as the Wiki itself says to do that.

I have no idea what else to even try. According to everything I see on the interwebs, it should just work. But of course, this is CK so the laws of reality tend to take a vacation.

 

Edited by TigerCubofPNW
Link to comment
Share on other sites

2 hours ago, Hanaisse said:

That link leads to the Fallout4 wiki, you probably want this page.

Uh, yeah, I read that page, but it was the one I linked to that actually used Actor. Before seeing that, I thought the issue might be that Actor was not a viable option for GetFormFromFile

2 hours ago, ladyonthemoon said:

Um... Okay? I don't see why, in this context, that could help you, since there are no properties involved but here it is...

Scriptname TIGFollowerSearch extends Quest  

Function FindFriend()
Actor  DelphineRef = Game.GetFormFromFile(0x00013478, "Skyrim.Esm") as Actor
If DelphineRef
      string name = DelphineRef.GetLeveledActorBase().GetName()
      Debug.messageBox("Your friend's name is now" + name)
else
	debug.messagebox("CK still hates you")

Endif
EndFunction

CK still hates me, all the time. The Actor, in this case DelphineRef, doesn't ever ever fill.

Things I've tried

Using

If ( DelphineRef )

Using

0x13478

0x013478

0x0013478

0x00013478

 

 

Link to comment
Share on other sites

3 hours ago, ladyonthemoon said:

Why do you use Game.GetFormFromFile for an npc that belongs to the base game? It's there already. For what I understand you must use it for a npc that belongs to a mod, in case the users of your mod are also using that mod. :)

As I said in the original post, I need to get an Actor from another mod, but when that failed I went back to basics and just tested the code on a vanilla NPC with the same results. This way, people can look at the code and even test it if they so desire with the entanglements of downloading other mods.

Link to comment
Share on other sites

59 minutes ago, ladyonthemoon said:

It probably doesn't work with vanilla npcs. How are you supposed to get the references of the npcs the "0x000000"?

Okay. Fine. But that does nothing to address the code. which as I said fails in the same way when I try it on NPCs in mods. It's teh code that I'm asking about

Link to comment
Share on other sites

16 hours ago, ladyonthemoon said:

Okay but where do you find the "0x000000" that you put in the code? If that reference is wrong, the code won't work.

Yeah, that was my assumption, but I verified, re-verified, triple and quadruple verified that all my numbers and letters are correct. That's also why I tried using different NPCs. I figure I can't get ALL the FormIDs wrong

7 hours ago, Hanaisse said:

Have you tried Actor Delphine and not DelphineRef?

I could name her "Sasquatch" and it wouldn't matter. There is no property for Delphine. As in, there is no line in the script

Actor Property Delphine Auto

Actor DelphineRef is just an Actor reference, much like when you create a Function "Function SomeFunction (Actor ActorRef)" It doesn't matter what you call it. So there is nothing for the script to go looking for an Actor named Delphine anywhere.

So, it looks like you're all as stumped as I am. Okay, anyone know any code I can use to search the list of NPCs? Like, a line of code I can put in an OnGameLoad Event that will search through all the NPCs in the game? Because I can use a String Property to match the character name I'm looking for. But I just have never found any code that searches all NPCs in the game. In a cell? Sure, but that would be a cumbersome, script-heavy way of doing something that should be simple.

 

Link to comment
Share on other sites

Have you tried printing the contents of the Actor variable itself? It is the way I have been debugging errors when getting data dynamically. What do the MessageBoxes in the following say in-game to you (first for Actor, then for ActorBase)?

Function FindFriend()

    Actor Sasquatch = Game.GetFormFromFile(0x00013478, "Skyrim.esm") as Actor
    Debug.MessageBox("Delhine as Actor -> " + Sasquatch)

    ActorBase SasquatchBase = Game.GetFormFromFile(0x00013478, "Skyrim.esm") as ActorBase
    Debug.MessageBox("Delhine as ActorBASE -> " + SasquatchBase)

EndFunction

If the Form ID "00013478" from Skyrim.esm is the in-game placed actor reference (in the editor window), then Actor should probably work? I think. Or if it is the actor base record (NPC, in the object view window listed under Actor), then the ActorBase might work.

Just my thoughts. When I have the time to boot up my desktop (I have a horrible assignment that has taken a week already), then I can check myself. For now, just some ideas. Well. Others have already sort of presented them, but for clarification. :P If it helps. If not, send the hatemail to my address. Game.GetFormFromFile should work on everything as far as I know. I have not seen any mentiones of restrictions anywhere, at least (excluding a too large load order index that is mentioned on the regular GetForm page but that one is probably just for GetForm).

Edit: Also, one handy way to make sure the eight character hexadecimal thing is right is to just copy-paste it from TES5Edit (or the Creation Kit, but that one probably does not work with copy-paste), change the first two characters to 00 and add "0x" before it. Like (a fictive example):

  • from TES5Edit --> 05014B9G --> change first two (the plugin ID) --> 00014B9G --> add 0x --> 0x00014B9G

It definitely should work that way.

 

Edited by Contrathetix
corrected a bit
Link to comment
Share on other sites

On 11/2/2016 at 6:29 AM, Contrathetix said:

Have you tried printing the contents of the Actor variable itself? It is the way I have been debugging errors when getting data dynamically. What do the MessageBoxes in the following say in-game to you (first for Actor, then for ActorBase)?


Function FindFriend()

    Actor Sasquatch = Game.GetFormFromFile(0x00013478, "Skyrim.esm") as Actor
    Debug.MessageBox("Delhine as Actor -> " + Sasquatch)

    ActorBase SasquatchBase = Game.GetFormFromFile(0x00013478, "Skyrim.esm") as ActorBase
    Debug.MessageBox("Delhine as ActorBASE -> " + SasquatchBase)

EndFunction

<Snip>

 

Printing the contents of the Actor variable? Not sure what you mean. I went down the rabbit hole of using GetFormID which returned a FormID that in no way resembled the FormID as seen in CK and in Tes5Edit. That disturbed and confused me, but I decided to stick with the FormID that show in both CK and Tes5Edit. And your comment suggests that was the right thing to do.

I did copy and paste the FormID from TesEdit. I replaced the first two numbers with 0x. No love. I deleted all the 0's after x, making it 0x13478. No love. I tried all manner of different variations. Nothing.

 

ETA: Well, that's curious. The BaseID works fine for most objects, but an Actor, or at least a Unique actor, seems to require the RefID.

 

Edited by TigerCubofPNW
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...