For a mod I'm making, the player needs to activate a cart to start the quest, and then the cart begins moving. The cart moving works fine, but the problem comes when I try to get the player to enter the cart. Here is my current script that is attached to the cart:
Scriptname ZZCartPassengerScript extends ObjectReference Idle Property IdleCartPlayerIdle AutoIdle Property IdleCartDriverExit AutoEvent OnActivate(ObjectReference akActionRef)function AttachToCart(bool bDoAttach)if bDoAttach; attach me to my cart and make me the driverGame.GetPlayer().SetVehicle(self)Game.GetPlayer().PlayIdle(IdleCartPrisonerCIdle)else; unattach me from cartGame.GetPlayer().SetVehicle(none)Game.GetPlayer().PlayIdle(IdleCartDriverExit)endifendFunctionendEventIdle Property IdleCartPrisonerCIdle Auto ObjectReference Property Player AutoThe problem is, when I try to compile, I get the following errors:
Starting 1 compile threads for 1 files...Compiling "ZZCartPassengerScript"...f:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ZZCartPassengerScript.psc(7,0): no viable alternative at input 'function'f:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ZZCartPassengerScript.psc(18,0): missing EOF at 'endEvent'No output generated for ZZCartPassengerScript, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on ZZCartPassengerScript
If I comment out both the function, the if, else and endif, and then the part of the script to unattach the player from the cart, when I go ingame and activate, the player mounts the cart fine, but then obviusely can't dismount. Anyone have any ideas?
Thanks


The thing is, since the player has to activate the cart, I'm assuming I need the Event OnActivate, but I'm not sure what to do with the function :/ Any ideas?