Jump to content

Need help: Scripting a simple fade-to-black love scene?


Guest Messenjah

Recommended Posts

Guest Messenjah

Okay, so I'm onto the love scene sequence of events for the player's interaction for a mod I'm working on. Yes, it has a bit of adult content. Basically, the player can choose to sleep with 3 different npc's if he/she wishes to. Depending on which one he/she selects, they will set a stage for their AI package to walk into a room and have the player follow them and will also set an integer value called "NPCFlag" to tell the script, which npc the player is interacting with. When the player agrees to sleep with the npc, the screen will fade the black, play a sound that depends on if the player is male or female and which npc the player is interacting with, changes the AI package stage so that the npc will go to sleep on the bed while the screen is black and after 35 seconds, the screen will fade back in.

 

The way I want to do this, is to set up a function within the quest script and then have a script fragment call the function during dialogue. Here is my script:

 

Int Property NPCFlag=0  Auto  Conditional	;Shortcut Flag to tell the Script, which NPC the player is interacting with and to help set AI Packages

Int Property Stage=0  Auto Conditional		;Used to tell the AI packages what stage the npc is in.

Sound Property Sound01A Auto
Sound Property Sound01B Auto
Sound Property Sound02A Auto
Sound Property Sound02B Auto
Sound Property Sound03A Auto
Sound Property Sound03B Auto





Function SexScene()

Game.FadeOutGame(True)
Stage = 3

	If Game.GetPlayer().GetSex() == 0
		If NPCFlag == 1
			Sound01A.Play(Self)
			Utility.Wait(35)
			Game.FadeOutGame(False)
		Elseif NPCFlag == 2
			Sound02A.Play(Self)
			Utility.Wait(35)
			Game.FadeOutGame(False)
		Elseif NPCFlag == 3
			Sound03A.Play(Self)
			Utility.Wait(35)
			Game.FadeOutGame(False)
		Endif
	Elseif Game.GetPlayer().GetSex() == 1
		If NPCFlag == 1
			Sound01B.Play(Self)
			Utility.Wait(35)
			Game.FadeOutGame(False)
		Elseif NPCFlag == 2
			Sound02B.Play(Self)
			Utility.Wait(35)
			Game.FadeOutGame(False)
		Elseif NPCFlag == 3
			Sound03B.Play(Self)
			Utility.Wait(35)
			Game.FadeOutGame(False)
		Endif
	Endif

EndFunction

 

 

Is there anything I'm missing?

Link to comment
Share on other sites

1. Seems the parameters for FadeOutGame don't have a default value and need to be defined.

Example: Game.FadeOutGame(False, true, 0.0, 2.0)

 

2. GetSex() must be called on an ActorBase, so it would be: If Game.GetPlayer().GetActorBase().GetSex() == 0

 

3. Assuming your script extends quest, self can't be used as a parameter for Play(). Better use the player or another reference.

 

4. A property for the player is more efficient than calling Game.GetPlayer() multiple times.

 

 

This script will compile:

Int Property NPCFlag=0  Auto  Conditional
Int Property Stage=0  Auto Conditional		

Sound Property Sound01A Auto
Sound Property Sound01B Auto
Sound Property Sound02A Auto
Sound Property Sound02B Auto
Sound Property Sound03A Auto
Sound Property Sound03B Auto

Actor Property PlayerRef auto



Function SexScene()

Game.FadeOutGame(True, true, 0.0, 2.0)
Stage = 3

	If PlayerRef.GetActorBase().GetSex() == 0
		If NPCFlag == 1
			Sound01A.Play(PlayerRef)
			Utility.Wait(35)
			Game.FadeOutGame(False, true, 0.0, 2.0)
		Elseif NPCFlag == 2
			Sound02A.Play(PlayerRef)
			Utility.Wait(35)
			Game.FadeOutGame(False, true, 0.0, 2.0)
		Elseif NPCFlag == 3
			Sound03A.Play(PlayerRef)
			Utility.Wait(35)
			Game.FadeOutGame(False, true, 0.0, 2.0)
		Endif
	Elseif PlayerRef.GetActorBase().GetSex() == 1
		If NPCFlag == 1
			Sound01B.Play(PlayerRef)
			Utility.Wait(35)
			Game.FadeOutGame(False, true, 0.0, 2.0)
		Elseif NPCFlag == 2
			Sound02B.Play(PlayerRef)
			Utility.Wait(35)
			Game.FadeOutGame(False, true, 0.0, 2.0)
		Elseif NPCFlag == 3
			Sound03B.Play(PlayerRef)
			Utility.Wait(35)
			Game.FadeOutGame(False, true, 0.0, 2.0)
		Endif
	Endif

EndFunction
Edited by Ghaunadaur
Link to comment
Share on other sites

Guest Messenjah

It works but the only problem is with the fade-in/fade-out effect. Basically it will do a quick fade-in-fade-out when the scene starts, play the sound effect, then fade-in-fade-out again.

 

I want it to fade out, play the sound, and then fade in after the sound effect is completed.

Link to comment
Share on other sites

Guest Messenjah

Doh! Sorry guys. Second time that happened to me. That was ment for Rain of Chaos to read, for his naughty version of the mod. :P

Edited by Messenjah
Link to comment
Share on other sites

  • Recently Browsing   0 members

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