Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Scripting help? Moving npc to player after sleep


Nyx
 Share

Recommended Posts

Hi, I'm new to scripting and have been trying to work this out for hours, but seems no matter what combinations I use, I can't get this script to compile. I'm trying to enable then teleport a custom character to the player after they sleep, but I keep getting errors with the MoveTo function. Any help would be greatly appreciated. My script is currently:

 

 

Scriptname Sin06PlayerScript extends ReferenceAlias   

event OnSleepStart(float atSleepStartTime, float atDesiredSleepEndTime)

    Sin.getRef().Enable()    
    Sin.MoveTo(Game.Getplayer()( 200, 0, 0)
    UnregisterForSleep()
endevent

 

 

I have an alias set up for Sin and the player, but still receive these error messages:

Starting 1 compile threads for 1 files...

Compiling "Sin06PlayerScript"...
X:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\Sin06PlayerScript.psc(6,28): mismatched input '(' expecting RPAREN
X:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\Sin06PlayerScript.psc(6,32): required (...)+ loop did not match anything at input ','
X:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\Sin06PlayerScript.psc(6,35): required (...)+ loop did not match anything at input ','
X:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\Sin06PlayerScript.psc(6,38): required (...)+ loop did not match anything at input ')'
No output generated for Sin06PlayerScript, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on Sin06PlayerScript

 

I'm guessing perhaps commas and/or brackets are in the wrong place?

Link to comment
Share on other sites

You forgot to register your character for sleep first. And I do not believe you need to unregister for sleep. Also at (Game.Getplayer you put an extra "(" in.

The first line of the error text tells you that. I'll break it down so you can try to understand:

 

 

X:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\Sin06PlayerScript.psc(6,28): mismatched input '(' expecting RPAREN

 

X:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\Sin06PlayerScript.psc <---This is the file your working on

 

X:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\Sin06PlayerScript.psc(6,28): <---This adds the line # and then the character # So you can find the error. in this case, its 6 lines down and 28 characters to the right

 

X:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\Sin06PlayerScript.psc(6,28): mismatched input '(" <---Shows you the issue

 

X:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\Sin06PlayerScript.psc(6,28): mismatched input '(' expecting RPAREN <--- Tells you what it wanted. I do not know what RPAREN means.

 

SECOND THOUGHTS:

 

Duoh!! :doh: Im trying to edit this to work and it keeps throwing different errors. FYI Nyx, there is a list of words YOU CAN NOT USE TO NAME THINGS. One of these is Sin. Every time Skyrim sees "sin" in a script it trys to run math. And if its not worded right, it won't compile. now you know  :thumbsup:

These are some of them:

http://www.creationkit.com/Keyword_Reference

 

This is still wrong. Is this a one time thing? If so, use this script:

Scriptname test extends ObjectReference  
 
ObjectReference Property NPC Auto
ObjectReference Property NPCMarker Auto
Function SomeFunction()
  RegisterForSleep() ; Before we can use OnSleepStart we must register.
EndFunction
 
event OnSleepStart(float atSleepStartTime, float atDesiredSleepEndTime)
NPC.Enable()    
NPC.MoveTo (NPCMarker)
endevent
[/spoiler]

Edited by Walrus
  • Upvote 1
Link to comment
Share on other sites

I was following a tutorial on Youtube (this one here:

) which basically said to registerforsleep on the papyrus entry of the first quest stage 0 which I did add there
Alias_Player.RegisterForSleep()

Unfortunately, most of his quest was focused on making the player wake up to a mysterious note - whereas I want the player to wake up to an intruder in the room, who then talks to her, beginning a quest.
I had no idea calling the script 'Sin' after the character would cause problems, but seems so obvious now lol x.x

 

So now I tried renaming the script, and changing it to:

Scriptname NyxSleepScript extends ReferenceAlias   

event OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime)
    MrMaddox.getActorRef().Enable()  
    MrMaddox.getRef().MoveTo(Game.Getplayer()
endevent

event OnSleepStop(Bool abInterrupted)
    GetOwningQuest().SetStage(10)
    UnregisterForSleep()
endevent

 

It works! Now just to figure out how to make him forcegreet the player :) I think it also wasn't working as I didn't realise that once you set properties on the script, you can change the value to point to the correct alias, before it was simply using default value. Thank you for helping, I never would have realised his name would mess up script!

 

EDIT: I wonder if you know how to specify any dragon as a condition? I want if possible for the player to kill a dragon, go to sleep and then have the sleep interrupted. I've managed to make this work with killing a guard if I use GetFaction and IsGuard, but it seems DragonFaction only includes certain unique dragons - which wouldn't be suitable if the player has already finished the quest line.

 

Ah, found out DragonFaction DOES work for any dragon XD brilliant

Edited by Nyx
Link to comment
Share on other sites

  • 4 months later...

Hi guys, I'm really new to modding and stuff and I was hoping for some assistance in making a mod I'm working on which this page seems really handy coz you seem to be doing nearly what I want to do. I want an NPC to enable upon reading a book I have placed in the world so I made the book and the NPC and set her to be "initially disabled" and I have set up the book to be a trigger in the creation kit and set some scripting up based on your post and another one I found on here but I cannot for the life of me get her to appear when I read the book/puck it up/pocket it or anything so could you please tell me what i'm doing wrong? If i could just see some effect enabling her it's be a start... Thanks for any help you can provide, my script in the activator file of the book is

 

Scriptname SummonFollower extends ObjectReference  
{ScriptName SummonFollower Extends ObjectReference
 
Event OnRead(ObjectReference akActionRef)
             MyFollower.getActorRef().Enable
             MyFollower.getActorRef().MoveTo(Game.Getplayer())
          Endif
EndEvent}
 
So not much to it really, I've tried more complicated methods too but still no avail... :(
I might not be putting the script in the right place or something so any advice on that might also help :)
Link to comment
Share on other sites

http://www.creationkit.com/Bethesda_Tutorial_Papyrus_Events_and_Properties

 

http://www.creationkit.com/Reference

 

Hope that explains things better than me. :)

 

edit: Placing an actor in the render window creates a ref. If you give it a name you can use that name as property and it autofills (Actor Property yourfollowernameinrenderwindow Auto or just add an actor property to the script via right click on the script attached to your book)

Edited by schatten
Link to comment
Share on other sites

Okay. I've taken a look at those pages and changed my code a bit, my script icon now has a pencil with a plus showing the reference to my follower

 

Scriptname summonfollower extends ObjectReference  
{Scriptname summonfollower extends ObjectReference  
 
Actor Property myFollower  Auto
 
Event OnRead(ObjectReference akActionRef)
             Debug.MessageBox("new follower available")
             myFollower.Enable
             myFollower.MoveTo(Game.Getplayer())
Endif
EndEvent
}
 
Could onread be the problem? i tried onactivate but still no joy
Link to comment
Share on other sites

which box? the add properties box? yep I put actor in the drop down and myfollower in the top text box and left the rest of it blank, then i hit ok and then edit and clicked the follower to autofill the rest and then when i exited the icon had changed from a plus to a pencil with a plus

Link to comment
Share on other sites

Okay here we go, the error messages I am getting are

 

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\FollowerEnter.psc(8,17): Enable is not a property on script actor or one of its parents
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\FollowerEnter.psc(6,0): the parameter types of function onread in the empty state on script followerenter do not match the parent script objectreference
No output generated for FollowerEnter, compilation failed.
 
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on FollowerEnter
 
So I suppose my question is how do I make Enable a property on script actor and what does the second error actually mean? Sorry, It's been a long day
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...