egon123 Posted August 11, 2016 Posted August 11, 2016 Hello! In my attempt do expand my dialogue option, I thought it would be nice to start a sex-scene at some options. Since I'm a total noob when it comes to scripts, I thought the easiest way would be to copy an existing script. For that case I choose Sexlab approach, since it has all 3 options (normal, rape, paid) I threw out the approach quest elements and tried to compile it in ck. Just for testing if its all okay. No errors. The original source file I compiled for testing was this: ;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 1Scriptname TIF__self_allow_s Extends TopicInfo Hidden;BEGIN FRAGMENT Fragment_0Function Fragment_0(ObjectReference akSpeakerRef)Actor akSpeaker = akSpeakerRef as Actor;BEGIN CODEActor[] sexActors = new Actor[2]if(PlayerRef.GetActorReference().GetLeveledActorBase().GetSex() == 1)sexActors[0] = PlayerRef.GetActorReference()sexActors[1] = talkingActor.GetActorReference()elsesexActors[0] = talkingActor.GetActorReference()sexActors[1] = PlayerRef.GetActorReference()endifsslBaseAnimation[] animsSexLabUtil.StartSex(sexActors,anims);END CODEEndFunction;END FRAGMENT;END FRAGMENT CODE - Do not edit anything between this and the begin commentReferenceAlias Property PlayerRef AutoReferenceAlias Property talkingActor Auto The trouble starts when I try to attach the script to a dialogue... If I understand the mechanic correct, I have to insert the code in the right Papyrus fragment window (In the dialogue topic) and then compile. Here is the code: Actor[] sexActors = new Actor[2]if(PlayerRef.GetActorReference().GetLeveledActorBase().GetSex() == 1)sexActors[0] = PlayerRef.GetActorReference()sexActors[1] = talkingActor.GetActorReference()elsesexActors[0] = talkingActor.GetActorReference()sexActors[1] = PlayerRef.GetActorReference()endifsslBaseAnimation[] animsSexLabUtil.StartSex(sexActors,anims) And here the error I've got: Starting 1 compile threads for 1 files...Compiling "TIF__0A06C260"...H:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(10,3): variable PlayerRef is undefinedH:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(10,13): none is not a known user-defined typeH:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(10,33): none is not a known user-defined typeH:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(10,55): none is not a known user-defined typeH:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(10,64): cannot compare a none to a int (cast missing or types unrelated)H:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(11,15): variable PlayerRef is undefinedH:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(11,25): none is not a known user-defined typeH:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(12,15): variable talkingActor is undefinedH:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(12,28): none is not a known user-defined typeH:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(14,15): variable talkingActor is undefinedH:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(14,28): none is not a known user-defined typeH:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(15,15): variable PlayerRef is undefinedH:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(15,25): none is not a known user-defined typeNo output generated for TIF__0A06C260, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on TIF__0A06C260 Sooo he can't find something when I insert the code in the dialogue topic, while find it when compiled from a script source? Even the paid code with just: Game.GetPlayer().AddItem(Gold001, 200) don't work with the error: Starting 1 compile threads for 1 files...Compiling "TIF__0A06C260"...H:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0A06C260.psc(9,25): variable Gold001 is undefinedNo output generated for TIF__0A06C260, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on TIF__0A06C260 Soo... any ideas what I'm doing wrong?
Guest Posted August 11, 2016 Posted August 11, 2016 Hi. Yep, you are not defining the properties. Your approach is not bad, but is not complete. Do this: 1) open your topic info (without code) 2) Put just a semicolon ( in your right (or left) Papyrus fragments 3) Click on OK to close the topic info 4) Open it again, there will be a script generated, right click on it and select edit source. Its content will look like: ;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment ;NEXT FRAGMENT INDEX 1 Scriptname TIF__0123456 Extends TopicInfo Hidden ;BEGIN FRAGMENT Fragment_0 Function Fragment_0(ObjectReference akSpeakerRef) Actor akSpeaker = akSpeakerRef as Actor ;BEGIN CODE ; ;END CODE EndFunction ;END FRAGMENT ;END FRAGMENT CODE - Do not edit anything between this and the begin comment 5) Add at the very bottom the following lines: Actor Property PlayerRef Auto 6) Save and close (this will compile)7) Open the properties of the script and fill the playerref (it should auto-fill) 8) Put the following code where there was the semicolon: Actor[] sexActors = new Actor[2] if PlayerRef.getSex()==1 sexActors[0]=playerRef sexActors[1]=akSpeaker else sexActors[0]=akSpeaker sexActors[1]=playerRef endIf sslBaseAnimation[] anims SexLabUtil.StartSex(sexActors,anims) Click on OK and you should be all set.
egon123 Posted August 11, 2016 Author Posted August 11, 2016 Hi. Yep, you are not defining the properties.Your approach is not bad, but is not complete. Do this: 1) open your topic info (without code)2) Put just a semicolon ( in your right (or left) Papyrus fragments3) Click on OK to close the topic info4) Open it again, there will be a script generated, right click on it and select edit source. Its content will look like: ;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment ;NEXT FRAGMENT INDEX 1 Scriptname TIF__0123456 Extends TopicInfo Hidden ;BEGIN FRAGMENT Fragment_0 Function Fragment_0(ObjectReference akSpeakerRef) Actor akSpeaker = akSpeakerRef as Actor ;BEGIN CODE ; ;END CODE EndFunction ;END FRAGMENT ;END FRAGMENT CODE - Do not edit anything between this and the begin comment 5) Add at the very bottom the following lines: Actor Property PlayerRef Auto 6) Save and close (this will compile)7) Open the properties of the script and fill the playerref (it should auto-fill)8) Put the following code where there was the semicolon: Actor[] sexActors = new Actor[2] if PlayerRef.getSex()==1 sexActors[0]=playerRef sexActors[1]=akSpeaker else sexActors[0]=akSpeaker sexActors[1]=playerRef endIf sslBaseAnimation[] anims SexLabUtil.StartSex(sexActors,anims) Click on OK and you should be all set. Ah, thank you for the fast answer! I see how this works. But I still get an error when I replace the semicolon with your code. Starting 1 compile threads for 1 files...Compiling "TIF__0806C25E"...H:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\TIF__0806C25E.psc(10,13): getSex is not a function or does not existH:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\TIF__0806C25E.psc(10,21): cannot compare a none to a int (cast missing or types unrelated)No output generated for TIF__0806C25E, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on TIF__0806C25E
Guest Posted August 11, 2016 Posted August 11, 2016 Sorry, my fault. Change the IF line to: if PlayerRef.getActorBase().getSex()==1
egon123 Posted August 11, 2016 Author Posted August 11, 2016 Sorry, my fault. Change the IF line to: if PlayerRef.getActorBase().getSex()==1 That worked! Thank you very much! Now I have to take a look at the other two scripts and how to mess with the tags. How can I add tell the game what tags to use and how to mark it as rape? I tried it with: (...) endif sslBaseAnimation[] anims anims = SexLab.GetAnimationsByTag(2,"Aggressive") SexLabUtil.StartSex(sexActors,anims, victim=PlayerRef.GetActorReference()) but no luck. Starting 1 compile threads for 1 files... Compiling "TIF__0806E9FB"... H:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0806E9FB.psc(18,8): variable SexLab is undefined H:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0806E9FB.psc(18,15): none is not a known user-defined type H:\Program Files (x86)\The Elder Scrolls V Skyrim\Data\Scripts\Source\temp\TIF__0806E9FB.psc(19,54): GetActorReference is not a function or does not exist No output generated for TIF__0806E9FB, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on TIF__0806E9FB I have to say, the ck is somehow.. strange. I tested two source files. One the copied from approach and one that the dialogue window created. Both contained the same. With the direct compiling in ck, the copied worked, the other failed. Hell, it was the same text..
Guest Posted August 11, 2016 Posted August 11, 2016 Download my Papyrus guide. It is full of examples.
egon123 Posted August 11, 2016 Author Posted August 11, 2016 Download my Papyrus guide. It is full of examples. I will take a look into it. Wasn't aware this exists. Thank you!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.