SAC Posted November 28, 2019 Posted November 28, 2019 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 Please help
mashup47 Posted November 28, 2019 Posted November 28, 2019 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 Please help Mad uneducated punt! Do you not need to compile it with AAF source files as it is not native to fallout??
SAC Posted November 28, 2019 Author Posted November 28, 2019 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)
mashup47 Posted November 28, 2019 Posted November 28, 2019 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.....
SAC Posted November 28, 2019 Author Posted November 28, 2019 42 minutes ago, mashup47 said: Have you tried putting the source files in Fallout\Data\Scripts\Source folder. rather then leaving them in Fallout\Data\Scripts\AAF This is what happens if I copy it into source
mashup47 Posted November 28, 2019 Posted November 28, 2019 35 minutes ago, SAC said: This is what happens if I copy it into source On my limit's here? set each -import directory instead of just setting the parent ?? sorry
mashup47 Posted November 28, 2019 Posted November 28, 2019 I think if I get time this weekend I'll do a much needed refresh and start again.
EgoBallistic Posted November 28, 2019 Posted November 28, 2019 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.
mashup47 Posted November 28, 2019 Posted November 28, 2019 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.)?
SAC Posted November 29, 2019 Author Posted November 29, 2019 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
EgoBallistic Posted November 29, 2019 Posted November 29, 2019 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.
SAC Posted November 29, 2019 Author Posted November 29, 2019 Crystal clear. Thank you very much indeed!
mashup47 Posted November 29, 2019 Posted November 29, 2019 Now I have learned something new. Just need to remember it. Hell I'll take a snap shot and put it in my scrap book. Thank you. @EgoBallistic. And Thank you @SAC For sparking this.
SAC Posted December 2, 2019 Author Posted December 2, 2019 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!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.