Jump to content

Start Scene through Dialogue


GornoDD

Recommended Posts

Posted

Hi

 

I have set up a scene and I just need to a dialogue option that the player can click to start the according scene.

I Have tryed to get it done like described in this tutorial, but I cant really follow the explanation and I get compilation errors

 

Can someone please give me a fool proof rundown how to accomplish this?

 

Thanks in advance

Posted

Easy enough.

 

Lets say in your scene you have two actors, the player and the NPC that speaks in the dialogue.

Now, a few IDs for the diffrent items (you can use the ones you want):

myScene -> ID of the Scene you want to play

refActor1 -> One of the two actor aliases that will play the scene

refActor2 -> The other actor aliases that will play the scene

 
And now the code to be put in the TopicInfo of the dialogue.
Keep in mind that you have to add 4 properties (at least) and the properties do not go inside the edit cell, you have to click on "properties" or edit the whole attached script.
 
-- Topic Info --
refActor1.forceRefTo(akSpeaker)
refActor2.forceRefTo(playerRef)
myScene.forceStart()
 
 
-- Properties --
ReferenceAlias Property refActor1 Auto
ReferenceAlias Property refActor2 Auto
Actor Property PlayerRef Auto
Scene Property myScene Auto
 
 
 
 
Posted

 

Easy enough.

 

Lets say in your scene you have two actors, the player and the NPC that speaks in the dialogue.

Now, a few IDs for the diffrent items (you can use the ones you want):

myScene -> ID of the Scene you want to play

refActor1 -> One of the two actor aliases that will play the scene

refActor2 -> The other actor aliases that will play the scene

 
And now the code to be put in the TopicInfo of the dialogue.
Keep in mind that you have to add 4 properties (at least) and the properties do not go inside the edit cell, you have to click on "properties" or edit the whole attached script.
 
-- Topic Info --
refActor1.forceRefTo(akSpeaker)
refActor2.forceRefTo(playerRef)
myScene.forceStart()
 
 
-- Properties --
ReferenceAlias Property refActor1 Auto
ReferenceAlias Property refActor2 Auto
Actor Property PlayerRef Auto
Scene Property myScene Auto
 

 

 

You mean I add the code as it is? Where exaclty? There is Papyrus Fragment Begin and End

When I add it as it is into the Papyrus Begin, I get a lot of compiling errors.

 

I know I might seem a bit stupid but im really trying to get myself going in the creation kit.

Posted

Ok.

A little bit of guidance then.

 

Crate your Topic Info (probably you have it already.)

 

In the begin (or End) fragment, just put a semnicolon (;) then save.

Then re-open the topic info, you should see in the rightmost place that a script has been generated.

>>[in case you have errors, post the errors here.]

After this edit the script that has been created, and add the properties to the very bottom. Save & Compile.

>>[in case you have errors, post the errors here.]

After this copy/paste the code for the fragment in the begin (or end) field.
And then edit the properties with the "Properties" button, to fill them with some value.
Close the topic info (for the final compile)...
 
...and you should be all set.
 
Posted

Ok, I describe what I did.

 

Added new Topic > did the semicolon > saved > script was there > right klicked it > Edit Source > added the properties at the very bottom > got this!

 

post-771294-0-87068000-1440344908_thumb.jpg

Posted

Just remove the line:

--- Properties ---

 

it was my "comment" to identify the two parts.

And do the same for the actual script. Do not put the line: -- Topic Info --

 

My bad, sorry. I was not clear enough.

 

P.S. did you get my Papyrus guide? It has a lot of examples for coding.

 

 

Posted

Just remove the line:

--- Properties ---

 

it was my "comment" to identify the two parts.

And do the same for the actual script. Do not put the line: -- Topic Info --

 

My bad, sorry. I was not clear enough.

 

P.S. did you get my Papyrus guide? It has a lot of examples for coding.

 

Thanks man! It worked for the first time. The Scene ran almost perfectly.

 

Yet Im facing a new problem. Its a whipping scene and for now I have created a new Actor to serve as the whipping Actor.

I have given him the Whip-Item and so the scene runs properly.

 

If I want to run the Scene for a non specific Actor (everyone in Skyrim) I got the problem that they alll dont have the whip item and the scene cant run.

 

Is there a way to add the whip to those person through the same dialogue method and remove it after the scene is done?

Posted

At the begin of the scene, considering that the Actor variable will be called "theWhipper" (of course use the name you want, you just have to identify it in some way):

 

if theWipper.getItemCount(zazwhip)<1

  theWipper.addItem(zazwhip, 1, false)

endIf

 

And at the end of the scene

 

theWipper.addItem(zazwhip, theWipper.getItemCount(zazwhip), false)

 

 

And add the property zazwhip to point to the correct Weapon.

Posted

At the begin of the scene, considering that the Actor variable will be called "theWhipper" (of course use the name you want, you just have to identify it in some way):

 

if theWipper.getItemCount(zazwhip)<1

  theWipper.addItem(zazwhip, 1, false)

endIf

 

And at the end of the scene

 

theWipper.addItem(zazwhip, theWipper.getItemCount(zazwhip), false)

 

 

And add the property zazwhip to point to the correct Weapon.

 

Got alot of new Errors with that. Heres what I did

 

Under Scene > klicked Data > At Begin: Papyrus Fragment > added this (my Alias is called FM_Whipper and my Item FM_Whipstick

 

if FM_Whipper.getItemCount(FM_Whipstick)<1
  FM_Whipper.addItem(FM_Whipstick, 1, false)
endIf
 
> klicked compile > got this ....
 

 

Starting 1 compile threads for 1 files...
Compiling "SF_1FM_WhippingScene_04002851"...
D:\Games_Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SF_1FM_WhippingScene_04002851.psc(8,3): variable FM_Whipper is undefined
D:\Games_Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SF_1FM_WhippingScene_04002851.psc(8,27): variable FM_Whipstick is undefined
D:\Games_Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SF_1FM_WhippingScene_04002851.psc(8,14): none is not a known user-defined type
D:\Games_Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SF_1FM_WhippingScene_04002851.psc(8,40): cannot compare a none to a int (cast missing or types unrelated)
D:\Games_Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SF_1FM_WhippingScene_04002851.psc(8,40): cannot relatively compare variables to None
D:\Games_Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SF_1FM_WhippingScene_04002851.psc(9,2): variable FM_Whipper is undefined
D:\Games_Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SF_1FM_WhippingScene_04002851.psc(9,21): variable FM_Whipstick is undefined
D:\Games_Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SF_1FM_WhippingScene_04002851.psc(9,13): none is not a known user-defined type
No output generated for SF_1FM_WhippingScene_04002851, compilation failed.
 
 
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on SF_1FM_WhippingScene_04002851
 

 
Let me guess. I need to define properties first. Do I do this like in the scene start?
Posted

You did not specified what the variable are:

 

FM_Whipper should be an actor.

Pretty sure your code is in a Scene Fragment.

So probably you have one or more ReferenceAliases that will point to the actor.

So use a property like this:

ReferenceAlias Property FM_Whipper Auto

Set it to the reference alias that will contain the whipper

And then change in your code FM_Whipper with FM_Whipper.getActorRef()

 

About FM_Whipstick it should be a property too.

Weapon Property FM_Whipstick Auto

 

And then fill it with the actual whipper weapon.

 

Posted

You did not specified what the variable are:

 

FM_Whipper should be an actor.

Pretty sure your code is in a Scene Fragment.

So probably you have one or more ReferenceAliases that will point to the actor.

So use a property like this:

ReferenceAlias Property FM_Whipper Auto

Set it to the reference alias that will contain the whipper

And then change in your code FM_Whipper with FM_Whipper.getActorRef()

 

About FM_Whipstick it should be a property too.

Weapon Property FM_Whipstick Auto

 

And then fill it with the actual whipper weapon.

 

Ok did that and it worked for the related errors. But there are new ones popping up. Ill screenshot what I did to so you maybe can pinpoint the problem.

 

post-771294-0-08006600-1440690905_thumb.jpg

 

Btw I highly appretiate your help and am very grateful. I also started reading your scripting tutorial. Yet some things are still pretty mysterious to me. :D

 

The script code looks like this:

 

 

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 2
Scriptname SF_1FM_WhippingScene_04002851 Extends Scene Hidden
 
;BEGIN FRAGMENT Fragment_1
Function Fragment_1()
;BEGIN CODE
FM_Whipper.getActorRef()
if FM_Whipper.getItemCount(FM_Whipstick)<1
FM_Whipper.addItem(FM_Whipstick, 1, false)
endIf
;END CODE
EndFunction
;END FRAGMENT
 
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
 
ReferenceAlias Property FM_Whipper Auto
Weapon Property FM_Whipstick Auto
 

Posted

If you don't mind, please open the full script source for the scene fragment (SF_1FM_WhippingScene_04002851), copy it, and paste here, inside a:

 

 

[spoiler][code]
...your code...
[/code][/spoiler]

 

Posted

 

If you don't mind, please open the full script source for the scene fragment (SF_1FM_WhippingScene_04002851), copy it, and paste here, inside a:

[spoiler][code]
...your code...
[/code][/spoiler]

 

Here it is

 

 

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 2
Scriptname SF_1FM_WhippingScene_04002851 Extends Scene Hidden
 
;BEGIN FRAGMENT Fragment_1
Function Fragment_1()
;BEGIN CODE
FM_Whipper.getActorRef()
if FM_Whipper.getItemCount(FM_Whipstick)<1
FM_Whipper.addItem(FM_Whipstick, 1, false)
endIf
;END CODE
EndFunction
;END FRAGMENT
 
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
 
ReferenceAlias Property FM_Whipper Auto
Weapon Property FM_Whipstick Auto
 

Posted

Voila':

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 2
Scriptname SF_1FM_WhippingScene_04002851 Extends Scene Hidden
 
;BEGIN FRAGMENT Fragment_1
Function Fragment_1()
;BEGIN CODE
if FM_Whipper.getActorRef().getItemCount(FM_Whipstick)<1
  FM_Whipper.getActorRef().addItem(FM_Whipstick, 1, false)
endIf
;END CODE
EndFunction
;END FRAGMENT
 
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
 
ReferenceAlias Property FM_Whipper Auto
Weapon Property FM_Whipstick Auto
Posted

 

Voila':

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 2
Scriptname SF_1FM_WhippingScene_04002851 Extends Scene Hidden
 
;BEGIN FRAGMENT Fragment_1
Function Fragment_1()
;BEGIN CODE
if FM_Whipper.getActorRef().getItemCount(FM_Whipstick)<1
  FM_Whipper.getActorRef().addItem(FM_Whipstick, 1, false)
endIf
;END CODE
EndFunction
;END FRAGMENT
 
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
 
ReferenceAlias Property FM_Whipper Auto
Weapon Property FM_Whipstick Auto

 

Fantastic! It works perfectly now. Im actually starting to understand this code now

Posted

Well Thanks for everything so far. Now I have tryed to script a Idle Position the player takes at the start of the scene like this

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 5
Scriptname SF_1FM_WhippingScene_04002851 Extends Scene Hidden
 
;BEGIN FRAGMENT Fragment_4
Function Fragment_4()
;BEGIN CODE
if FM_Player.PlayIdle(ZazAPC212)
  Debug.Trace("TestText")
endif
if FM_Whipper.getActorRef().getItemCount(FM_Whipstick)<1
  FM_Whipper.getActorRef().addItem(FM_Whipstick, 1, false)
endIf
;END CODE
EndFunction
;END FRAGMENT
 
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
 
ReferenceAlias Property FM_Whipper Auto
ReferenceAlias Property FM_Player Auto
Weapon Property FM_Whipstick Auto

 

 

 

But Im getting undefined properties errors again. I thaught these errors arent applied to Functions like "Playidle". Must I  define properties for these as well? 

Errors:

 

 

Starting 1 compile threads for 1 files...
Compiling "SF_1FM_WhippingScene_04002851"...
D:\Games_Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SF_1FM_WhippingScene_04002851.psc(8,22): variable ZazAPC212 is undefined
D:\Games_Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SF_1FM_WhippingScene_04002851.psc(8,13): PlayIdle is not a function or does not exist
No output generated for SF_1FM_WhippingScene_04002851, compilation failed.
 
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on SF_1FM_WhippingScene_04002851

Posted

Hi.

 

You have to define your variables. You cannot just type names and expect the compiler to do some magic.

The compile error you have: variable ZazAPC212 is undefined

Means that you did not define the variable ZazAPC212, is it too obscure as message?

 

You should try to learn a little bit better how to program (lear a different language, Papyrus is complex because of its environment.)

When you will be familiar with variables and functions, then continue your mod with Papyrus.

 

And, just for the record, ZazAPC212 is not an idle. Is an anim event.

You should use something like:

 

Debug.SendAnimationEvent(FM_Player.getActorRef(), "ZazAPC212")

 

But it will not be visible, because the player in normal mode will just ignore the animations event.

 

 

 

Posted

Hi.

 

You have to define your variables. You cannot just type names and expect the compiler to do some magic.

The compile error you have: variable ZazAPC212 is undefined

Means that you did not define the variable ZazAPC212, is it too obscure as message?

 

You should try to learn a little bit better how to program (lear a different language, Papyrus is complex because of its environment.)

When you will be familiar with variables and functions, then continue your mod with Papyrus.

 

And, just for the record, ZazAPC212 is not an idle. Is an anim event.

You should use something like:

 

Debug.SendAnimationEvent(FM_Player.getActorRef(), "ZazAPC212")

 

But it will not be visible, because the player in normal mode will just ignore the animations event.

 

Yeah Im really trying to get to get a brief understanding of these. So far I actually understand what functions and variables are. What confuses me is the many interactions with the creation kit.

 

Also are you 100% certain that ZazAPC212 is a Anim? When I played it ingame via console it was listed as "IDLE" not as "ANIO"?

Posted

Actually I got it working myself this time ^^

 

This was the solution. I simply forgot to call getActorRef and to register a property for the idle. I somehow thaught that Idles are public for all scripts.

What I really dont get is the "Papyrus Fragment" stuff. Why are my scripts getting new Fragment Numbers all the time? Is there more than one version of my existing code? Also What are all these Begin/End Fragment Boxes in the creation kit? Cant I just write my code in the script file?

 

Working Version:

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 5
Scriptname SF_1FM_WhippingScene_04002851 Extends Scene Hidden
 
;BEGIN FRAGMENT Fragment_4
Function Fragment_4()
;BEGIN CODE
if FM_Player.GetActorRef().PlayIdle(ZazAPC212)
  Debug.Trace("TestText")
endif
if FM_Whipper.getActorRef().getItemCount(FM_Whipstick)<1
  FM_Whipper.getActorRef().addItem(FM_Whipstick, 1, false)
endIf
;END CODE
EndFunction
;END FRAGMENT
 
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
 
ReferenceAlias Property FM_Whipper Auto
ReferenceAlias Property FM_Player Auto
Weapon Property FM_Whipstick Auto
Idle Property ZAZAPC212 Auto

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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