LeianneH Posted April 28, 2018 Share Posted April 28, 2018 (edited) ;This is the PARENT Script Script myParent extends ObjectReference String PlayerChair ; whole bunch more variables declared Event OnTriggerEnter(ObjectReference akActionRef) if akActionRef == PlayerREF Utility.Wait(2.5) ;calling external script above, using function - no problem! ;NOW need to call Child script function myChild.myFunction(PlayerChair) ;does not work endif EndEvent ;This is the CHILD Script Script myChild extends myParent String Function myFunction(String akString) ;do something and return to parent script EndFunction I'm having trouble with my scripts and was hoping someone might be able to help me with this bit ... I have a Parent script and I've made a Child script that extends the Parent I can use the external script Utility and access it's Wait Function just fine .... but when I try to access myFunction from the myParent script I have, I get the error; Cannot call the member function myFunction alone or on a type, must call it on a variable Anyone have any idea why it will not allow me to access the function in the child script?Have tried; myFunction() ; using import myChild ... and myChild.myFunction() .... not working. sigh. EDIT: The ONLY reason I am trying to make a CHILD script holding functions to be accessed by my PARENT script is .... I am at line 912 in my script (which works perfectly with the functions inside of it) - BUT my script will NOT ALLOW ME TO ADD A SINGLE CHARACTER MORE!!!! Is there some OTHER way to overcome this restriction? Edited April 28, 2018 by LeianneG Link to comment Share on other sites More sharing options...
Deleted3897072User Posted April 28, 2018 Share Posted April 28, 2018 (edited) You've got the parent/child thing backwards conceptually. Child scripts inherit functions from their parents but not the other way around. What object is the child script attached to? If it's the same ObjectReference as the parent script, your child script could extend ObjectReference and then your parent could call (Self as myChild).myFunction( .. ) but that's not using inheritance. Essentially, the two scripts become siblings. What you could also do, is to attach the child script to the base object and the parent script to the placed instance. Then the inheritance would work. Just the names would be misleading. Edited April 28, 2018 by OldMansBeard Link to comment Share on other sites More sharing options...
LeianneH Posted April 28, 2018 Author Share Posted April 28, 2018 (edited) Yeah, saw that my inheritance is backwards .. sigh, inherits UP not down - also the reason I can call Utility.Wait() - or just Wait() is because the function is compartmentalized and is declared as a global. The function in the 'Child' that I need to access from the 'Parent' requires variables from the 'Parent' ... so can't make the function global. Arrghhh ... my head is starting to hurt! Is there ANY way that I can 'bypass' this apparent character/line restriction on the script? It's just SO darn handy having all my functions in the ONE script! Edit: They are both attached to the same ObjectReference (DefaultTrigger) so making them siblings would probably be the most efficient, if not the most elegant option. Because it's a default trigger, can't add the 'child' to the base object unless I copy it and make a 'myDefaultTrigger' ... which isn't really an issue. But I never thought of the sibling - appreciate you suggesting it Edited April 28, 2018 by LeianneG Link to comment Share on other sites More sharing options...
cdcooley Posted April 29, 2018 Share Posted April 29, 2018 There's no script length limit if you use an external text editor instead of the Creation Kit editor. So if your only problem is script length I recommend just editing that script externally and compiling outside of the CK. You can still use the CK to attach the script to objects and fill properties, you just won't be able to edit it after it gets too large. The CK Wiki has info about setting up an external editor. Link to comment Share on other sites More sharing options...
Deleted3897072User Posted April 29, 2018 Share Posted April 29, 2018 To add to what cdcooley has said - the Papyrus compiler can be run from a DOS command line. There's a bat file that gets installed with the CK but you need to edit the paths. Or, in the CK, look under Gameplay > Papyrus Script Manager and try right-click. It's all there once you know where to look. Link to comment Share on other sites More sharing options...
LeianneH Posted April 29, 2018 Author Share Posted April 29, 2018 Thank you so much! Both you, OldMansBeard and you, Cdcooley - I will keep the larger file because it works flawlessly, and I'm only introducing errors by trying to farm out my functions :) Link to comment Share on other sites More sharing options...
Recommended Posts