Move player to furniture script help

Post » Tue Feb 04, 2014 8:20 pm

I am trying to make a trigger box that moves the player to a piece of furniture via script:

Scriptname HellScript01 extends ObjectReference  Int Property RunOnce  Auto  Furniture Property PHShack  Auto  Event OnTriggerEnter(ObjectReference akActionRef)	If(akActionRef == Game.GetPlayer())	If RunOnce == 0	Game.DisablePlayerControls()	Actor PlayerRef = Game.GetPlayer()	PlayerRef.MoveTo(PHShack)	Game.EnablePlayerControls()	RunOnce = 1	EndIf	EndIfEndEvent

But I keep getting this error:

Starting 1 compile threads for 1 files...Compiling "HellScript01"...C:\Program Files\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\HellScript01.psc(12,11): type mismatch on parameter 1 (did you forget a cast?)No output generated for HellScript01, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on HellScript01

Any help please???

User avatar
Chris Ellis
 
Posts: 3447
Joined: Thu Jul 26, 2007 10:00 am

Post » Wed Feb 05, 2014 8:09 am

which line is it complaining about?

User avatar
Neko Jenny
 
Posts: 3409
Joined: Thu Jun 22, 2006 4:29 am

Post » Wed Feb 05, 2014 7:27 am

this one:

PlayerRef.MoveTo(PHShack)

Tried Game.GetPlayer().MoveTo(PHShack) but still get same error

User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Tue Feb 04, 2014 10:00 pm

MoveTo is expecting an ObjectReference. So instead set property as ObjectReference instead of Furniture.

Don't try casting, it'll say they are incompatible.

User avatar
ruCkii
 
Posts: 3360
Joined: Mon Mar 26, 2007 9:08 pm

Post » Wed Feb 05, 2014 1:42 am

Thanks it saved with no errors going to test it now!

User avatar
MARLON JOHNSON
 
Posts: 3377
Joined: Sun May 20, 2007 7:12 pm

Post » Tue Feb 04, 2014 7:29 pm

If it's still no go, you may have to reset the property in the CK to point to the reference. Changing the type I think resets its back to .

User avatar
Michelle Chau
 
Posts: 3308
Joined: Sat Aug 26, 2006 4:24 am


Return to V - Skyrim