Jump to content

Papyrus help - type mismatch on parameter 1


Otellino

Recommended Posts

Hey all,

I'm still learning Papyrus and I feel I'm making headway with it. However, there's something that's got me stumped. I'm working on a cart-riding segment in a mod, and I got it working the way I wanted.
However I've decided to try and neaten up my code by unifying most of it under a single quest code. A problem I'm running into though is with the "SetMotionType" function.

Previously on the cart's script itself, I had:

self.setMotionType(Motion_Keyframed)
This worked fine.

Now, I've tried moving it (and other things) into it's own function on a quest script, which is:

Function RideCart(bool DoRide, actor myHorse, actor myDriver, ObjectReference myCart)

	if DoRide == true

	elseif DoRide == false

		myDriver.say(ZZNCCCarriageSystemWaitBark)
		StopHorse(true, myHorse)
		myCart.setMotionType(Motion_Keyframed)	
		Game.GetPlayer().PlayIdle(CartTravelPlayerExit)
		CartCameraStop(false)
		PlayerInCart = 0
		CartState = 2

	endif

endFunction

Now, the only error messages I'm getting are related to the "setMotionType" function. I get:
variable Motion_Keyframed is undefined
type mismatch on parameter 1 (did you forget a cast?)

And I can't figure out why. Looking on the wiki didn't help me. Any ideas? :smile:
Thanks!

Edited by Otellino
Link to comment
Share on other sites

How would this work?

myCart.setMotionType(myCart.Motion_Keyframed)

It is listed as an example on the SetMotionType page --> http://www.creationkit.com/index.php?title=SetMotionType_-_ObjectReference

 

Hopefully that helps. Maybe even

myCart.setMotionType(ObjectReference.Motion_Keyframed)

would work? Or would not? I would love to test it, see if the properties work like that, if they are already defined in the script.

Link to comment
Share on other sites

Aha! the first one worked! See, I looked at that page but I never even noticed that. Now I feel stupid... Thank you very much! :)
I tried the second one too for your benefit but nah, that gives a "A property cannot be used directly on a type, it must be used on a variable"

I come from modding Oblivion and New Vegas, so all this function and property business is a whole new world to me but it's super cool. Thank you again for your time! :)

Link to comment
Share on other sites

No problem, happy to help. :thumbsup:

 

I actually started with Oblivion myself, too, and am planning to return back to Oblivion when I have updated a (normal) Skyrim mod of mine. Oblivion feels like home, so to speak, especially with OBSE. The jump from Oblivion to Skyrim is huge, I never expected it to be like that. Once you get the basic idea of how things work - which it seems you have - then it should not be too difficult to pick up as you go the rest of any small pieces of information that may be left.

 

Also thank you for testing that. Odd. Well. At least the first one worked. And you would (or would not) be surprised to hear how many things I miss myself, too, when reading things. I literally spent two days trying to figure out why something did not work, when the solution was right there in the book, but I did not see it for some reason. :P

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...