Jump to content

Mod: trying to replicate doppelganging


Recommended Posts

I am trying to replicate the doppelgang function in order for the player to be able to use a furniture which has a custom animation with an unusable camera (probably a 3DSMax issue with the animation, I don't know)

 

In the script declaration section I've added 

 

import AAF:AAF_MainQuestScript

Problem is that I don't seem to be able to call other AAF functions, all the calls to AAF function return "cannot call..." on compile

 

image.thumb.png.591ce1e9c39ed8165b7e0e51e8200ca2.png

 

Please help :) 

Link to comment
57 minutes ago, SAC said:

I am trying to replicate the doppelgang function in order for the player to be able to use a furniture which has a custom animation with an unusable camera (probably a 3DSMax issue with the animation, I don't know)

 

In the script declaration section I've added 

 


import AAF:AAF_MainQuestScript

Problem is that I don't seem to be able to call other AAF functions, all the calls to AAF function return "cannot call..." on compile

 

image.thumb.png.591ce1e9c39ed8165b7e0e51e8200ca2.png

 

Please help :) 

Mad uneducated punt! Do you not need to compile it with AAF source files as it is not native to fallout??

Link to comment
3 hours ago, mashup47 said:

Mad uneducated punt! Do you not need to compile it with AAF source files as it is not native to fallout??

 

The AAF source files are installed, otherwise the import gives an error (I know because first I've tried without "AAF:", which I presume denotes the subfolder, and it gave an error)

Link to comment
5 hours ago, SAC said:

 

The AAF source files are installed, otherwise the import gives an error (I know because first I've tried without "AAF:", which I presume denotes the subfolder, and it gave an error)

Have you tried putting the source files in Fallout\Data\Scripts\Source folder. rather then leaving them in Fallout\Data\Scripts\AAF

 

I remember when I did try scripting SKSE Skyrim This fried my brain as I could not get it to work until I was told about having it in the wrong folder. but by that time I had lost the willpower to carry on that and having a kid which just turns your world upside down and back to front.....

Link to comment
12 hours ago, mashup47 said:

Problem is that I don't seem to be able to call other AAF functions, all the calls to AAF function return "cannot call..." on compile

This is kind of unrelated to your doppelganger issue, but here is the proper way to call functions on the AAF main quest:

AAF:AAF_MainQuestScript mainQuestScript
mainQuestScript = Game.GetFormFromFile(0x00000F99, "AAF.esm") as AAF:AAF_MainQuestScript
...
mainQuestScript.addActiveActor(PlayerRef)

 

But if you want to create a new Doppelganger and plop it into a furniture, this will do it:

AAF:AAF_MainQuestScript mainQuestScript
mainQuestScript = Game.GetFormFromFile(0x00000F99, "AAF.esm") as AAF:AAF_MainQuestScript
ActorBase AAF_Doppelganger = Game.GetFormFromFile(0x0072E2, "AAF.esm") as ActorBase

Actor tempActor = PlayerRef.PlaceAtMe(akFormToPlace=AAF_Doppelganger, abInitiallyDisabled = true) as Actor
tempActor.enable()
tempActor.SetAlpha(0)

mainQuestScript.copyClothes(PlayerRef, tempActor)
mainQuestScript.copyOverlays(PlayerRef, tempActor)
mainQuestScript.copyMorphs(PlayerRef, tempActor)
mainQuestScript.copyFacelight(PlayerRef, tempActor)
mainQuestScript.copyMFG(PlayerRef, tempActor)

tempActor.snapIntoInteraction(furnitureReference)
tempActor.SetAlpha(1)

 

Note that the CopyXYZ functions are kind of expensive, so only call the ones you need - don't call copyClothes if the player is supposed to be naked.

 

Link to comment
2 hours ago, EgoBallistic said:

This is kind of unrelated to your doppelganger issue, but here is the proper way to call functions on the AAF main quest:


AAF:AAF_MainQuestScript mainQuestScript
mainQuestScript = Game.GetFormFromFile(0x00000F99, "AAF.esm") as AAF:AAF_MainQuestScript
...
mainQuestScript.addActiveActor(PlayerRef)

 

But if you want to create a new Doppelganger and plop it into a furniture, this will do it:


AAF:AAF_MainQuestScript mainQuestScript
mainQuestScript = Game.GetFormFromFile(0x00000F99, "AAF.esm") as AAF:AAF_MainQuestScript
ActorBase AAF_Doppelganger = Game.GetFormFromFile(0x0072E2, "AAF.esm") as ActorBase

Actor tempActor = PlayerRef.PlaceAtMe(akFormToPlace=AAF_Doppelganger, abInitiallyDisabled = true) as Actor
tempActor.enable()
tempActor.SetAlpha(0)

mainQuestScript.copyClothes(PlayerRef, tempActor)
mainQuestScript.copyOverlays(PlayerRef, tempActor)
mainQuestScript.copyMorphs(PlayerRef, tempActor)
mainQuestScript.copyFacelight(PlayerRef, tempActor)
mainQuestScript.copyMFG(PlayerRef, tempActor)

tempActor.snapIntoInteraction(furnitureReference)
tempActor.SetAlpha(1)

 

Note that the CopyXYZ functions are kind of expensive, so only call the ones you need - don't call copyClothes if the player is supposed to be naked.

 

Fantastic @EgoBallistic . I keep thinking it needed someone who knows his sh1t. @SAC.will be pleased!  (nice to know I was close but with scripting language that could mean a mile and a bit away from were you want to be.)?

Link to comment

Thank you very much! Away from computer for a couple of days but looking forward to testing this as soon as I get back

 

At some point I hope I’ll figure out how to reference inter-mod stuff properly, this example surely helps a lot 
 

Link to comment
1 hour ago, SAC said:

Thank you very much! Away from computer for a couple of days but looking forward to testing this as soon as I get back

 

At some point I hope I’ll figure out how to reference inter-mod stuff properly, this example surely helps a lot 
 

You're welcome.  I forgot to explain why the code you pasted wouldn't work. 

 

Simply calling Scriptname.Function(), or doing Import Scriptname and then calling Function(), only allows you to call global functions in Scriptname.  A global function is one that can be called from any script, without having to define a property or variable cast to the script the function is in.  Global functions also don't know anything about the in-game object they are attached to, so the in-game object doesn't have to be active -- for example a global function in a quest script can be called even if that quest is not running.

 

You were trying to use that calling method on non-global functions in the AAF_MainQuest script.  That is not allowed.  In order to access those functions, that object must exist in the game, and you have to access those functions on the in-game object itself, not on the script.  Otherwise you will get the "cannot call the member function XYZ alone or on a type, must call it on a variable" error.  So you have to declare the quest as a property, or declare it as a variable and do a GetFormFromFile(), and then call the functions on the quest cast as a ScriptObject.  And that's what this does:

AAF:AAF_MainQuestScript mainQuestScript
mainQuestScript = Game.GetFormFromFile(0x00000F99, "AAF.esm") as AAF:AAF_MainQuestScript
...
mainQuestScript.addActiveActor(PlayerRef)

The object must also exist in game when you call the functions at run-time, which in this case means that AAF_MainQuest must be running.  That's a safe assumption with AAF, but it's something to keep in mind.

Link to comment
On 11/28/2019 at 11:14 PM, EgoBallistic said:

But if you want to create a new Doppelganger and plop it into a furniture, this will do it:

 

Note that the CopyXYZ functions are kind of expensive, so only call the ones you need - don't call copyClothes if the player is supposed to be naked.

 

 

Back from a short break, tested this, works beautifully. Thank you again!

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use