Jump to content

Recommended Posts

hi it's me again, my "DigYourCaveEntrance" mod project is nearly complete thanks to you guyz. I have one little issue remaining.

I already added as an optional feature the ability to get a day pass-by quickly (as if you slept through it, except the character doesn't regain anything since he's not sleeping)

while the screen is black I'm trying to play several sounds :

local Player = GetPlayer()
 ...

for i=0,2 do Player:DoTaskInTime(i/3, Player.SoundEmitter:PlaySound("dontstarve/wilson/dig") )	end
for i=3,4 do Player:DoTaskInTime(i/3, Player.SoundEmitter:PlaySound("dontstarve/wilson/use_pick_rock") ) end
Player:DoTaskInTime(2, Player.SoundEmitter:PlaySound("dontstarve/wilson/dig") )

And I hear only one "pick" sound, the thing is I don't understand why it wouldn't be working

sure I guess the alternative way would be to build a single custom sound composed of those (may need tweaks), however I don't think I am able to do that

notes: already tried changing the delay from i/3 to just i (which should increase the delay between sounds) to no avail...

Edited by whismerhill
Link to comment
https://forums.kleientertainment.com/forums/topic/70542-sound-delayloop-as-script/
Share on other sites

4 hours ago, Mobbstar said:

Do you set the tasks after the time jump you had mentioned?

no the sound happens before it, the time jump is in a "do task in time of its own" with a delay of 3

 

EDIT: here's the code :

Spoiler

if timepassesby then 
		Player.HUD:Hide()
		TheFrontEnd:Fade(false,1)
		for i=0,2 do Player:DoTaskInTime(i/3, Player.SoundEmitter:PlaySound("dontstarve/wilson/dig") )	end
		for i=3,4 do Player:DoTaskInTime(i/3, Player.SoundEmitter:PlaySound("dontstarve/wilson/use_pick_rock") ) end
		Player:DoTaskInTime(2, Player.SoundEmitter:PlaySound("dontstarve/wilson/dig") )
		Player:DoTaskInTime(5, function() 
			if Player.components.hunger then
				Player.components.hunger:DoDelta(-TUNING.CALORIES_SMALL, false, true) --add to that the natural hunger drain of the 24h
			end
			if Player.components.sanity then
				Player.components.sanity:DoDelta(-TUNING.SANITY_LARGE, false)
			end
			if GetClock():IsDay() then
				GetClock():MakeNextDay()
			else --if GetClock():IsDusk() then
				GetClock():MakeNextDusk()
			end
			Player.HUD:Show()
			TheFrontEnd:Fade(true,1) 
		end)
	end

 

"if isdusk" is commented out because it's a reminder, at this point in the code, night was checked before so it's dusk or dusk ;)

Edited by whismerhill

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...