pickleplayer Posted December 31, 2016 Share Posted December 31, 2016 Am I wording that right? You know how you can access variables from components really easily? Like if you wanted to get something's run speed from the locomotor component, you would do: inst.components.locomotor.runspeed Can you do something like that with behaviors? They look like they're structured similarly, but I really have no idea how I would go about looking for that kind of info. Wow, this must be a weird question to see me asking after like half a year of not asking any questions. Sometimes I just wonder if there are way easier ways to do things that I just end up missing. Just last month I figured out you can skip to any frame you want in an animation with inst.AnimState:SetTime() which would have been SO useful to know a long time ago. Better yet, is there any way to just list every possible command tied to a class? Like if I wanted to list every existing inst.AnimState:????() function available to use, is there a way I could do that? AnimState specifically is a hard one, because it's not a file we get access to. Link to comment Share on other sites More sharing options...
Mobbstar Posted December 31, 2016 Share Posted December 31, 2016 "inst.brain" or "AddBrainPostInit()" grant you access to the brain of a creature. "brain.bt" is the behaviour tree. "brain.bt.root" is the root node, usually that's what "local root" in the brain's file is. From there on, it's a cascade of behaviour nodes. If they have sub-nodes, those are in the "children" table. Please take the time to investigate "scripts/behaviourtree.lua" for details on behaviour nodes. The API sample mod edits a pig brain, you should check it out! AnimState is written in C++ iirc, which means you can't just use a for loop and print all the functions. It would be utmost helpful to know all available functions, though. Link to comment Share on other sites More sharing options...
Kzisor Posted December 31, 2016 Share Posted December 31, 2016 13 hours ago, Mobbstar said: It would be utmost helpful to know all available functions, though. SetLayer function: 13EA64A0 SetRayTestOnBB function: 13EA6B60 IsCurrentAnimation function: 13EA71C0 SetFinalOffset function: 13EA6890 SetManualBB function: 13EA68F0 SetOrientation function: 13EA6980 GetSymbolPosition function: 13EA67A0 Hide function: 13EA62F0 SetSortOrder function: 13EA6710 ClearOverrideSymbol function: 13EA6740 SetBloomEffectHandle function: 13EA6B30 SetDepthWriteEnabled function: 13EA65F0 SetDepthTestEnabled function: 13EA6260 ClearOverrideBuild function: 13EA68C0 Show function: 13EA6350 PlayAnimation function: 13EA65C0 SetTime function: 13EA6B00 GetTotalTime function: 13EA6380 Pause function: 13EA63E0 GetPercent function: 13EA67D0 Resume function: 13EA6440 SetDeltaTimeMultiplier function: 13EA6860 SetErosionTexture function: 13EA6DA0 PushAnimation function: 13EA6650 GetMultColour function: 13EA6BC0 OverrideSymbol function: 13EA6CB0 SetPercent function: 13EA6C80 SetAddColour function: 13EA6770 ClearBloomEffectHandle function: 13EA69B0 SetScale function: 13EA61D0 SetBank function: 13EA66B0 GetCurrentFacing function: 13EA71F0 SetErosionParams function: 13EA6FB0 PutOnGround function: 13EA6140 SetBuild function: 13EA6320 LoadAnimation function: 13EA6C50 OverrideShade function: 13EA6BF0 GetAddColour function: 13EA6800 SetLightOverride function: 13EA6AA0 SetDepthBias function: 13EA6C20 AddOverrideBuild function: 13EA6AD0 AnimDone function: 13EA6290 SetMultColour function: 13EA6920 Something like this list? 20 hours ago, pickleplayer said: Like if I wanted to list every existing inst.AnimState:????() function available to use, is there a way I could do that? for k, v in pairs(getmetatable(GetPlayer().AnimState).__index) do print(k, v) end With this command you can get any C++ function for any C++ entity. Link to comment Share on other sites More sharing options...
Mobbstar Posted December 31, 2016 Share Posted December 31, 2016 12 minutes ago, Kzisor said: getmetatable().__index For some reason I feel like twenty minutes of research would have supplied me with these two very useful things. I should write them down, thank you! Link to comment Share on other sites More sharing options...
Kzisor Posted December 31, 2016 Share Posted December 31, 2016 1 hour ago, Mobbstar said: For some reason I feel like twenty minutes of research would have supplied me with these two very useful things. I should write them down, thank you! I'm working on a method which will actually get all the parameter names of these functions to ensure we can document them correctly. @Mobbstar, I've looked into this further and it looks like there isn't a sure fire way to get the function parameters without the game crashing. I will look into it further because I need to have it for the mod I'm making, but looks like I'm stuck for the moment. Link to comment Share on other sites More sharing options...
pickleplayer Posted January 1, 2017 Author Share Posted January 1, 2017 Ah, yes Perfect! Thank you! Both of you! these will help a lot @Mobbstar, I've been playing around with the brain functions for a long time and was able to get it working for the most part, but I'm having some strange issues. I'm not sure if you'd actually know any more about this subject than me, but I'll just ask. I can access all the behavior nodes, including their names and all the variables in them, just fine, EXCEPT any children within parallel nodes. But the weird thing is that I can still get their names just fine, but not any of the variables within them. For example the "OnFire" node that exists within a parallel node in almost every brain, you can print the name with "node.children[1].name" and it returns the name (Panic). But "node.children[1].waittime" (which is 0 by default) will not print out anything at all. However, if I just throw the Panic behavior into the brain by itself and print "node.waittime" it will print 0 like it's supposed to. Am I doing something wrong here? How come I can get the node's name just fine, but not anything else? I don't know how much the modding community knows about brains, so I might have to figure this one out on my own. Link to comment Share on other sites More sharing options...
Mobbstar Posted January 2, 2017 Share Posted January 2, 2017 @pickleplayer a WhileNode is a ParallelNode with its first child being a IfNode (check behaviourtree.lua for details). As such, node.children[1] is the if node and obviously has no waittime. Next time, tag be properly or quote me to get a faster response. Link to comment Share on other sites More sharing options...
pickleplayer Posted January 2, 2017 Author Share Posted January 2, 2017 5 hours ago, Mobbstar said: @pickleplayer a WhileNode is a ParallelNode with its first child being a IfNode (check behaviourtree.lua for details). As such, node.children[1] is the if node and obviously has no waittime. Ahhhhh, okay, I see! Thank you so much! So then it's actually the second child that I needed. If I had payed attention to the GetBrainString() output, I probably would have noticed that. But it works now and Harold's defensive stance is better than ever. He actually just 2-0'd me, oh boy he's getting too smart. Thanks again! And now to disappear for another couple months. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.