Darkvalkyr Posted February 18, 2012 Share Posted February 18, 2012 Hey everyone, I'm just wondering if anyone's figured out how to use Papyrus to change an NPC's Class or AI. The Bethesda CK wiki has given some hint that it's possible but the script editor doesn't acknowledge GetClass or SetClass as a valid function even if extended onto the script ActorBase. Is there something I'm doing wrong? This is the command line I use: ActorAlias.GetReference().GetClass() Which is according to this page in Bethesda: http://www.creationkit.com/GetClass_-_ActorBase Link to comment Share on other sites More sharing options...
ScarabMonkey Posted February 18, 2012 Share Posted February 18, 2012 I think you need .GetBaseObject() after GetReference() Not in front of the PC at the moment, so can't confirm Link to comment Share on other sites More sharing options...
Darkvalkyr Posted February 18, 2012 Author Share Posted February 18, 2012 Hmm, interesting, I'll look things over! Thanks! Link to comment Share on other sites More sharing options...
Darkvalkyr Posted February 18, 2012 Author Share Posted February 18, 2012 OK, after a look through, the GetClass command does indeed work, however there is no mention at all of a SetClass function. It works in the consoles, but alas if I try to put in SetClass in Papyrus script editor, I get a 'function does not exist error'. Anyone have suggestions to how it could be done? Maybe a roundabout way to change an Actor's pre-set class? There has to be, somehow but I'm not terribly sure on which set of commands could emulate that function. Link to comment Share on other sites More sharing options...
porroone Posted February 18, 2012 Share Posted February 18, 2012 You can always try to define the function yourself if you say it works as a console command I dont see why wouldnt it in papyrus, basically go to the ActorBase script and type the following: Class Function SetClass() native Then compile and tell me if it works, I tried this myself yet, but with a different kind of function, if you do it this way and import ActorBase into your script, it will compile the function as a valid one. Link to comment Share on other sites More sharing options...
Darkvalkyr Posted February 18, 2012 Author Share Posted February 18, 2012 (edited) Sadly that didn't work. I edited the ActorBase script via CK, saved it in Notepad++ and compiled it using the Papyrus Compiler from the CK. I did it twice in two different ways, one using the line you posted, and the other with: Function SetClass(Class akClass) native In both cases the ActorBase script compiled. But it didn't seem to work regardless when I put in SetClass in my script. I must be doing something wrong because when I tried to compile the script, it still said function SetClass doesn't exist. This is what I got right now, in case anyone wants to take a look at it. Right now I got the classes and aliases defined, and managed to do a GetClass on the ActorBase. Now I just need to know what on earth triggers the same effect as it does on the Console when you type SetClass. Funny that this function is missing in the CK's scripts entirely (a search through the wiki was no dice, and it was absent in the ActorBase script), and yet we can still do this via console, so there must be a function there that does this in a roundabout way. If not, we could be able to create our own function that essentially does this. Scriptname FKRestScript extends ActorBase Alias Property Feres Auto ActorBase Property FKFeresBase Auto Class Property FKVoyagerJack Auto Class Property FKVoyagerHealer Auto Class Property FKVoyagerGuard Auto Class Property FKVoyagerMule Auto Class FKFeresClass Function LetsRest (Actor FKFeres) FKFeresBase = FKFeres.GetBaseObject() as ActorBase FKFeresClass = FKFeresBase.GetClass() endfunction Edited February 18, 2012 by Darkvalkyr Link to comment Share on other sites More sharing options...
porroone Posted February 18, 2012 Share Posted February 18, 2012 I think I know why it doesnt compile the function, when you extend I think it takes the default script on the bsa try to import it instead:Import ActorBaseI got my functions to compile right, problem was they didnt return the value I wanted, maybe its different in your case, its worth trying. Link to comment Share on other sites More sharing options...
Darkvalkyr Posted February 18, 2012 Author Share Posted February 18, 2012 Alright, I'll try Import ActorBase and see if it works out. Link to comment Share on other sites More sharing options...
Darkvalkyr Posted February 19, 2012 Author Share Posted February 19, 2012 Still no dice, even with using import ActorBase. Still says function doesn't exist despite ActorBase when edited compiling nicely. Must be something I'm missing, and even then I'm not so sure if Papyrus will even register what to do with the SetClass function even if I create one, because these base functions must be hardcoded into the CK/main script. Understandable since all functions we make are just extensions or a string of functions from this base script. I wonder how we can get the SetClass from console into CK, there should be a way. Maybe SKSE can do so in the future? Heck, in the meantime I'm just wondering ways on how we can manipulate what we do have access to... Link to comment Share on other sites More sharing options...
porroone Posted February 19, 2012 Share Posted February 19, 2012 Yea I think sadly, we all contemplate the limitations of papyrus, I am kind of dissapointed, i really expected more and i know they could had added a shitload more of functions, probably they want to limit what we develope so they can release stuff like flying mounts and s*** in the form of DLC, and then we will get the cool s***. Link to comment Share on other sites More sharing options...
Recommended Posts