Page 1 of 1

Location of objective complete sound? [Solved]

Posted: Sat Jul 12, 2014 12:58 pm
by Noobasaurus
I'm looking for the line of code that makes the sound when an objective is complete.

I've looked through the stock scripts but I haven't found anything that works.

Thanks.

Re: Location of objective complete sound?

Posted: Sat Jul 12, 2014 2:22 pm
by Marth8880
From Objective.lua:

Code: Select all

	--play a little ditty
	if not self.multiplayerRules then
		BroadcastVoiceOver("common_objComplete", self.winningTeam)
	end
The entire function:
Hidden/Spoiler:
[code]function Objective:Complete(winningTeam)
if self.isComplete then return end

--unhide the CPs
MapHideCommandPosts(false)

self.isComplete = true
self.winningTeam = winningTeam

if self.loseTimer then
ShowTimer(nil)
DestroyTimer(self.loseTimer)
self.loseTimer = nil
end

--clean up all the AIGoals for this objective
if self.AIGoals then
for i, goalPtr in ipairs(self.AIGoals) do
DeleteAIGoal(goalPtr)
end
end

--play a little ditty
if not self.multiplayerRules then
BroadcastVoiceOver("common_objComplete", self.winningTeam)
end

--delay the actual objective end by a smidge to allow time for the ditty to finish playing
--(since the designers tend to call other voiceovers from OnComplete)
self.dittyTimer = FindTimer("dittyTimer")
if not self.dittyTimer then
self.dittyTimer = CreateTimer("dittyTimer")
end
SetTimerValue(self.dittyTimer, 1.0)
StartTimer(self.dittyTimer)
self.dittyTimerResponse = OnTimerElapse(
function(timer)
--update the objective's state in the c++ code
if self.text then
CompleteObjective(self.text)
else
if self.textATT then
CompleteObjective(self.textATT)
end

if self.textDEF then
CompleteObjective(self.textDEF)
end
end

if self.container then
self.container:NotifyObjectiveComplete(self)
else
MissionVictory(winningTeam)
end

self:OnComplete(winningTeam)

StopTimer(self.dittyTimer)

print("release self.dittyTimerResponse")
ReleaseTimerElapse(self.dittyTimerResponse)
self.dittyTimerResponse = nil
end,
self.dittyTimer
)
end[/code]
Basically, it's supposed to play automatically upon Objective:Complete, but you should be able to call it regardless with this:

Code: Select all

BroadcastVoiceOver("common_objComplete")
Also, in case you're wondering or if it's helpful in any way, it's a sound stream.

Re: Location of objective complete sound?

Posted: Sat Jul 12, 2014 9:52 pm
by Noobasaurus
Thank you. I added it, however, and it doesn't play a sound. No errors.

Re: Location of objective complete sound?

Posted: Sat Jul 12, 2014 9:53 pm
by Marth8880
Hmm. Could you please post the sound section of your LUA? (The section in ScriptInit().)

Re: Location of objective complete sound?

Posted: Sat Jul 12, 2014 9:58 pm
by Noobasaurus
So it's currently played in a few different places.
Hidden/Spoiler:
[code]
checker = OnCharacterDeath(function(character, killer)
if GetNumTeamMembersAlive(2) == 0 then
if x == 1 then
inChallenge = false
player = GetCharacterUnit(killer)
SetEntityMatrix(player, hub)
ShowMessageText("level.BBX.complete")
BroadcastVoiceOver("common_objComplete", 1)
end
x = x + 1
checker = nil
end
if GetNumTeamMembersAlive(1) == 0 then
SetProperty(boss1, "CurHealth", 0)
SetProperty(boss2, "CurHealth", 0)
SetProperty(boss3, "CurHealth", 0)
SetProperty(boss4, "CurHealth", 0)
SetProperty(boss5, "CurHealth", 0)
end
end)[/code]
[code]
disk1p = OnEnterRegion(
function(region, character)
KillObject("disk1")
numdisks = numdisks + 1
ShowMessageText("level.BBX.item")
BroadcastVoiceOver("common_objComplete", 1)
if numdisks == 10 then
player = GetCharacterUnit(character)
SetEntityMatrix(character, hub)
ShowMessageText("level.BBX.complete")
InChallenge = false
end
DeactivateRegion("disk1r")
end,
"disk1r"
)
disk2p = OnEnterRegion(
function(region, character)
KillObject("disk2")
numdisks = numdisks + 1
ShowMessageText("level.BBX.item")
BroadcastVoiceOver("common_objComplete", 1)
if numdisks == 10 then
player = GetCharacterUnit(character)
SetEntityMatrix(character, hub)
ShowMessageText("level.BBX.complete")
InChallenge = false
end
DeactivateRegion("disk2r")
end,
"disk2r"
)
disk3p = OnEnterRegion(
function(region, character)
KillObject("disk3")
numdisks = numdisks + 1
ShowMessageText("level.BBX.item")
BroadcastVoiceOver("common_objComplete", 1)
if numdisks == 10 then
player = GetCharacterUnit(character)
SetEntityMatrix(character, hub)
ShowMessageText("level.BBX.complete")
InChallenge = false
end
DeactivateRegion("disk3r")
end,
"disk3r"
)
...and more[/code]
I did also try it without the 1 in case you were wondering.

Re: Location of objective complete sound?

Posted: Sat Jul 12, 2014 9:59 pm
by Marth8880
Noooo, I meant the section with all of the OpenAudioStream lines. :lol:

Re: Location of objective complete sound?

Posted: Sat Jul 12, 2014 10:02 pm
by Noobasaurus
OH. I'm supposed to load it there? OH.

Got it, thanks.