Page 1 of 1

quick question (party dialogue)

Posted: Sun Oct 28, 2012 5:38 pm
by msyblade
rescripting an ending with party dialogue, Using party health checks to do it right. Problem is that all of the dialogue displays on dungeon start instead of the triggers i set up at the end. the first script is a 3 in one (1)figure out who's alive.(2) pick two at random and (3) display the conversation. then a separate entity defining that conversation.
SpoilerShow
-- returns how many characters are still alive and enabled
function checkLifeSigns()
local lifesigns = 0
for i=1,4 do
if party:getChampion(i):getEnabled() and party:getChampion(i):isAlive() then
lifesigns = lifesigns+1
end
end
return lifesigns
end

-- returns the name of a random living and not disabled champion
function getRandomLivingChamp()
local charnumber = ""
repeat charnumber = math.random(1,4)
until party:getChampion(charnumber):getEnabled() and party:getChampion(charnumber):isAlive()
return party:getChampion(charnumber):getName()
end

function champTalk1(line1,line2,line3)
local firstTalker = getRandomLivingChamp()
local secondTalker = firstTalker
if line1 == nil then
return
else
hudPrint(firstTalker..": "..line1)
end
if line2 ~= nil then
if checkLifeSigns() > 1 then
repeat secondTalker = getRandomLivingChamp()
until secondTalker ~= firstTalker
end
hudPrint(secondTalker..": "..line2)
end
if line3 ~= nil then
hudPrint(firstTalker..": "..line3)
end
end
and script 2
SpoilerShow
script_entity_137.champTalk1("I see no pit!", "Try placing her on the Altar!", "Do it!, on the Altar!")
All works great except it does not cue on a trigger, it is cueing on game start.

Re: quick question (party dialogue)

Posted: Sun Oct 28, 2012 8:21 pm
by Decayer
You need to put script 2 in a function.

Re: quick question (party dialogue)

Posted: Sun Oct 28, 2012 8:25 pm
by msyblade
like, combine all into script 1?
Edit: Got it Decayer, thank you!! just functioned script 2