Qairon Posted July 26, 2014 Share Posted July 26, 2014 Hi, and thanks so much for looking.I'm actually looking to pay someone a little bit of money just to cover their time spent helping me. If someone can get this working for me, I'll send them some cash via PayPal. It won't be much, mind, but just a little something to say thanks for their time. I make Tanback, a Sabrecat follower with custom sounds and subtitled dialogue. He has full follower functionality, but I also want him to be a mount.He can be found on the Nexus and Steam Workshops. I'm a 3D modeller and 2D artist primarily; my experience with scripting is basically next to nothing, but I'm trying really hard to learn by poring over resources and looking at others' code. What I Want to Make Happen: A dialogue option that allows the player to climb up on Tanback.For the player to dismount upon pressing the Activate button, as is normal procedure for dismounting a horse.For the rest of Tanback's dialogue functions to be left as they are.What I have Done Already: Tanback has a custom skeleton with a saddle bone in place.Added the actortypehorse keyword to the actor in the CK.Got the Compiler working via Notepad++ and the Papyrus language definitions going on.Compiled my trainwreck of a script. By compiled, I mean attempted. It was full of errors.What Happens Right Now: Tanback moves correctly and all animations function as normal.His 'Talk to Tanback' activator prompt has changed to 'Ride Tanback.'His dialogue tree comes up after the player mounts.Cancelling out of it successfully transfers control to Tanback and he can be moved aroundThis means that every time the player wants to talk to him, they will get on his back. This is undesirable.The errors: 0, 0: Unable to locate script input8, 32: unknown type tanbackdialoguegeneric ***14, 4: variable Player is undefined14, 11: none is not a known user-defined type14, 21: none is not a known user-defined type14, 35: cannot compare a none to an int (cast missing or types unrelated)15,12: dIsRiding is not a function or does not exist15, 24: cannot compare a none to an int (cast missing or types unrelated)20, 1: variable counter is undefined20,1: variable counter is undefined20,9: cannot compare a none to an int (cast missing or types unrelated)21,4: IsKeyPressed is not a function or does not exist21,19: cannot compare a none to an int (cast missing or types unrelated)23, 33: cannot call the member function Dismount alone or on a type, must call it on a variableNo output generated for TanBackRiderScript.psc, compilation failed. *** TanBackDialogueGeneric is the quest that contains all of the actor's dialogue and scripts. it is where the line of dialogue will be to trigger this. Code: Scriptname TanBackRiderScript extends ObjectReference {TanBackActor} import utility import game import input TanBackDialogueGeneric Property TanBackDialogueGeneric Auto ;Actor property horse auto auto state Waiting event onActivate(objectReference AkActivator) ;if player is not riding an animal, make them ride If Player.IsOnMount.GetValueInt() == 0 AkActivator.dIsRiding() == 1 EndIF endEvent Event OnUpdate() counter += 1 if IsKeyPressed() == 1 ; Make Player dismount. bool dismountInitiated = Actor.Dismount() endif endEvent endstate Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 26, 2014 Share Posted July 26, 2014 My thoughts on your errors based solely on the code you've put up. 0, 0: Unable to locate script input Input is an SKSE script. SKSE needs to be installed otherwise it will not exist and any functions/events on it will fail.8, 32: unknown type tanbackdialoguegeneric ***I don't think assigning the quest as a property is necessary here. But I suppose it depends on what other code you have in place.14, 4: variable Player is undefined14, 11: none is not a known user-defined type14, 21: none is not a known user-defined type14, 35: cannot compare a none to an int (cast missing or types unrelated)Change Player to GetPlayer()15,12: dIsRiding is not a function or does not exist15, 24: cannot compare a none to an int (cast missing or types unrelated)Typo. change dIsRiding() to IsRiding()20, 1: variable counter is undefined20,1: variable counter is undefined20,9: cannot compare a none to an int (cast missing or types unrelated)Why is the variable counter there to begin with? it is not being used anywhere else that I can see, remove it if not needed else add Int counter outside the event.21,4: IsKeyPressed is not a function or does not exist21,19: cannot compare a none to an int (cast missing or types unrelated)IsKeyPressed is an SKSE function. You need SKSE to be properly installed (including source scripts) otherwise it will not exist. Also the usage is incorrect.23, 33: cannot call the member function Dismount alone or on a type, must call it on a variableYou are using Actor to call Dismount, you need to use a variable that references an actual NPC. GetPlayer() is probably what you want instead of Actor. Thus you would have GetPlayer().Dismount() Link to comment Share on other sites More sharing options...
Qairon Posted July 26, 2014 Author Share Posted July 26, 2014 Thank you very much for your response, I really appreciate your having taken the time to assist!I do have SKSE installed, however I did save this .psc file outside of the CK, so maybe it's just complaining because of that? I'm OK with making this mod dependent upon SKSE, lots of mods are. :) Utilising your suggestions and some small variants, I am now only getting one error that I do not understand: 13,17: argument abnewvalue is not specified and has no default value.(Line 13 is the setanimationvariablebool line.) Here is the (now much smaller) code: Scriptname TanBackRiderScript extends ObjectReference {TanBackActor} import utility import game Actor property PlayerREF auto auto state Waiting event onActivate(objectReference AkActivator) ;If the player activated this script, make player perform mount If akActivator == PlayerREF Game.GetPlayer().SetAnimationVariableBool("IsRiding") endif EndEvent Event OnUpdate() ; Make Player dismount. bool dismountInitiated = GetPlayer().Dismount() endEvent endstate Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 26, 2014 Share Posted July 26, 2014 SetAnimationVariableBool requires two inputs. You only have one. The second input is called abNewValue hence that is what the compiler is complaining about. If you are going to have a property that points to the player, you can replace all the Game.GetPlayer() with said property variable. I do have SKSE installed, however I did save this .psc file outside of the CK, so maybe it's just complaining because of that? I'm OK with making this mod dependent upon SKSE, lots of mods are.It could be complaining because the PSC file is not in a directory that the CK knows about, but if that were the case then it would complain about other things too most likely. Just double check that you have the PSC files from SKSE installed as well (in the source directory that you use for your papyrus compiler). Making a mod dependent upon SKSE is totally your call. If you need functions from it, use it. If you don't, then don't. Link to comment Share on other sites More sharing options...
Qairon Posted July 27, 2014 Author Share Posted July 27, 2014 (edited) I think I'm closer to it now... It turns out the Compiler bat doesn't know where my SKSE scripts are so that's why SKSE dependent functions aren't allowing it to compile. My install is in a non-standard location (My D drive as C is full with other stuff) so I had to manually change it all already... I'll fiddle with that some more. Until then, this seems to compile for everything but RegisterForKey and OnKeyUp, but that's because they're SKSE dependent functions. edit: In-CK Compiler results: D:\Steam2\steamapps\common\skyrim\Data\Scripts\Source\temp\TanBackRideScript.psc(13,2): RegisterForKey is not a function or does not existNo output generated for TanBackRideScript, compilation failed. edit2: Removing the RegisterForKey resulted in a successful compile. Now to test it... It didn't compile correctly upon trying to set the Actorvalue in.I tried without doing that, and nothing happened ingame. D:\Steam2\steamapps\common\skyrim\Data\Scripts\Source\temp\TanBackRideScript.psc(9,0): mismatched input 'Scriptname' expecting ENDFUNCTIOND:\Steam2\steamapps\common\skyrim\Data\Scripts\Source\temp\TanBackRideScript.psc(28,0): missing EOF at 'EndFunction' Scriptname TanBackRiderScript extends ObjectReference {TanBackActor} import utility import game Actor property PlayerREF auto event onActivate(objectReference AkActionRef) ; If the player activated this script, make player perform mount Game.GetPlayer().SetAnimationVariableBool("bIsRiding", true) EndEvent Event OnKeyUp(int KeyCode) Debug.Trace("Dismounting Tanback...") If KeyCode == 18 ; Make Player dismount. bool dismountInitiated = Game.GetPlayer().Dismount() Debug.Trace("You have dismounted Tanback.") endif endEvent Edited July 27, 2014 by Qairon Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 27, 2014 Share Posted July 27, 2014 You don't want to register for the key in the OnActivate event unless you plan on unregistering for the key at some point before the player activates the script again. No idea what repeated registration calls for the same key will do. Might be better to put it in an OnInit() event. Link to comment Share on other sites More sharing options...
Qairon Posted July 27, 2014 Author Share Posted July 27, 2014 I've ditched the registerforkey line completely, which resulted in a successful compile. If I'm thinking right... It now just looks for if the player presses the Activate key at all to shut down the event.In the CK, it compiled when I chose to 'add script' in the Response Dialogue window, and I picked the Actor Value as being the player and all seemed fine. However it complains with this: D:\Steam2\steamapps\common\skyrim\Data\Scripts\Source\temp\TanBackRideScript.psc(9,0): mismatched input 'Scriptname' expecting ENDFUNCTIOND:\Steam2\steamapps\common\skyrim\Data\Scripts\Source\temp\TanBackRideScript.psc(28,0): missing EOF at 'EndFunction' If I try to put the script in as a fragment in the END section. I'm so confused. If I don't put anything in the END/Fragment box, nothing happens and if I do, it won't compile. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 27, 2014 Share Posted July 27, 2014 So you want to put it on a fragment? The fragment associated with the dialog option to ride the follower animal? You've got a full blown script, you can cut a lot of it out. Just put the stuff you have inside the OnActivate event in the fragment. Then try. Fragments create their own files with their own file names. So you might need to first put in a comment line to create the script file before applying any necessary properties. Link to comment Share on other sites More sharing options...
Qairon Posted July 28, 2014 Author Share Posted July 28, 2014 I thought you had to put it in the end fragment?If I don't have to, then I won't. The script compiles and the dialogue triggers, but nothing happens in-game.Is there a way to specify within the script to target TanBackActor for the mount action? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 29, 2014 Share Posted July 29, 2014 (edited) Your script is written as if the player clicks on the actor and the mounting takes place. But you want it to be triggered by dialog. Those are two different things. You might be better off using the dialog to set a global variable within its fragment then have a script attached to the actor's alias on the same quest as the dialog that contains the mount/dismount script with a check for the global variable to be the value set in dialog before it will allow the mount process. EDIT: Check out how carriages are done. You talk with them and get permission to ride then you have to click on the carriage to actually ride. Edited July 29, 2014 by IsharaMeradin Link to comment Share on other sites More sharing options...
Recommended Posts