quick question (party dialogue)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

quick question (party dialogue)

Post 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.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Decayer
Posts: 65
Joined: Sat Oct 13, 2012 3:19 pm

Re: quick question (party dialogue)

Post by Decayer »

You need to put script 2 in a function.
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: quick question (party dialogue)

Post by msyblade »

like, combine all into script 1?
Edit: Got it Decayer, thank you!! just functioned script 2
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Post Reply