Problems with choice briefing

» Siedler Map Source Forum » Siedler DEdK Script Forum » Problems with choice briefing

Seiten: 1

Qba331PL
#1
05.07.2018 15:01
Beiträge: 102

Problems with choice briefing

Hi!

I have got problem with briefing with options.

First - I want to make one briefing with some pages of normal talking (ASP) and then page with 2 options (not two functions like in my code). I tried to do that, but it didn't work.

Second - When options briefing starts, game camera still looks at the same place. I wnat to change that place. Like in ASP.

Here is my code:

function BriefingStart()

	local briefing = {};
	local AP, ASP  = AddPages(briefing);
 
	ASP("NPC1", "Bandit", "something", true)
	ASP("NPC2", "Bandit", "something", true)

	briefing.finished = function()

Choice()
    			end;
    StartBriefing(briefing);
end


function Choice()

    local briefing = {}

    local AP = function( _page ) table.insert( briefing, _page ); return _page; end
   
    local choicePage = AP{   
        mc   = {    
            title   = "Hero",
            text    = "something",
            firstText   = "Option1",
            secondText  = "Option2",
            firstSelected  = 2,  
            secondSelected = 4,  
        },
        dialogCamera    =   true,
    }
    

    AP{ 
        text = "Option1",
    }
 

    AP()   
    

    AP{ 
        text = "Option2",
    }
    

    briefing.finished =
        function()
            if GetSelectedBriefingMCButton( choicePage ) == 1 then 
                ChangePlayer("NPC1", 2)
                ChangePlayer("NPC2", 2)
            else    
                ChangePlayer("NPC3", 2)
                ChangePlayer("NPC4", 2)
            end
        end
    

    StartBriefing( briefing)

    
end



Can yuo help me?

mcb
#2
05.07.2018 15:26
Beiträge: 1472

Has been a while that i used unmodified briefing code, but this should work:

function BriefingStart()

	local briefing = {};
	local AP, ASP  = AddPages(briefing); -- AddPages creates both AP and ASP
 
	ASP("NPC1", "Bandit", "something", true)
	ASP("NPC2", "Bandit", "something", true)

	local choicePage = AP{   
		mc   = {    
			title   = "Hero",
			text    = "something",
			firstText   = "Option1",
			secondText  = "Option2",
			firstSelected  = 4, -- i changed these indices, so they match to the pages you used in the 2. briefing. just count the pages to get the correct indices
			secondSelected = 6,
		},
		dialogCamera    =   true,
		position = GetPosition("NPC1"), -- this is the target position
	}

	AP{-- you can simply use ASP here, since you only use text
		text = "Option1",
		-- you can also use title, dialogCamera and position here
	}

	AP()

	AP{-- again, ASP is shorter
		text = "Option2",
	}

	briefing.finished =function()
		if GetSelectedBriefingMCButton( choicePage ) == 1 then 
			ChangePlayer("NPC1", 2)
			ChangePlayer("NPC2", 2)
		else    
			ChangePlayer("NPC3", 2)
			ChangePlayer("NPC4", 2)
		end
	end

	StartBriefing( briefing)
end

Qba331PL
#3
05.07.2018 16:26
Beiträge: 102

Thank you!!!

Seiten: 1

SiteEngine v1.5.0 by nevermind, ©2005-2007
Design by SpiderFive (www.siedler-games.de) - English translation by juja

Impressum