Page 1 of 2

adding a party member further into the dungeon

Posted: Tue Sep 25, 2012 9:45 pm
by Shloogorgh
I had an idea for a dungeon where you start off with 1 character, but encounter other characters down the line to add to your party.

I tried testing this out but I've hit a wall. I tested this two ways. One way was to limit the starting party via the SetDefaultParty Script and the other was to enter the dungeon with Toorum mode activated.

Basically, the test dungeon has a room with a skeletal warrior behind a portcullis, and when you step on a hidden plate a script checks if your player 1 slot is open or not. If you open the portcullis and your slot is full, he requests to have his soul freed (and it's an easy kill since it's a clone with 1 hitpoint, and he's in guard mode so he never attacks first)

But if you open the portcullis and your slot is open, then he joins it. Or he would, if the game didn't give the error "bad argument #1 to 'setEnabled' (boolean expected, got nil)"

Is there anyway to get around this? I assume it stems from confusion between one script (setdefault party and toorum mode) telling it to disable a champion while this script is telling it to enable a champion.

Maybe this is could be a function that runs within the setdefaultparty that is activated by stepping on that hidden plate? Hmm...

Here's the code:

Code: Select all

function lever1()
	if counter_1:getValue() == 0 then 
		if party:getChampion(1):getEnabled() == false or party:getChampion(2):getEnabled() == false or party:getChampion(3):getEnabled() == false or party:getChampion(4):getEnabled() == false then
		hudPrint("Give me freedom!")
	else
		hudPrint("Destroy me! Free my soul!")
	end
	else
	if door1:isOpen() then
		if party:getChampion(1):getEnabled() == false then
		hudPrint("I will accompany you...")
		party:getChampion(1):setEnabled(true)
		party:getChampion(1):setName("Miraja Fantoon")
		party:getChampion(1):setRace("Human")
		party:getChampion(1):setClass("Fighter")
		party:getChampion(1):setSex("male")
		party:getChampion(1):setPortrait("assets/textures/portraits/dead.tga")
	else
		hudPrint("Destroy me! Release my soul!")
	end
	end
	end
end

Re: adding a party member further into the dungeon

Posted: Tue Sep 25, 2012 10:01 pm
by petri
As the error msg says, setEnabled requires a boolean argument, i.e. true or false. You are passing in the value of variable enabled which is probably nil in your case.

Re: adding a party member further into the dungeon

Posted: Tue Sep 25, 2012 11:14 pm
by Shloogorgh
Wow, changing it to setEnabled(true) was all it took!

Awesome, thanks

Re: adding a party member further into the dungeon

Posted: Wed Sep 26, 2012 7:24 am
by tyterrio
I had a question regarding this as well. I think im on the right track, but im a little confused. I've figured out how to script the party away, leaving solo play. But I'm having a hard time using a button or lever (or torch) to unlock (and add) a party member spot back.

I've managed to reverse the process by using a torch holder to get rid of my party. But I cant seem to get an interact-able asset to reverse the process. This is sort of where I'm at. Any thoughts/help would be great!

Ideally im looking for something that allows me to start with a party members, and add members in later.

function oneMember()
if torchHolder1:hasTorch() == true then
party:getChampion(2):setEnabled(false)
party:getChampion(3):setEnabled(false)
party:getChampion(4):setEnabled(false)
end
end

Re: adding a party member further into the dungeon

Posted: Wed Sep 26, 2012 9:00 pm
by BlackHell
WOW. If this would work so that you can start with an empty party and you can then get four members of your choice than we would have the real beginning of Dungeon Master. So i could write wall text with the Information of the Char and a door where he is behind ready to go.

Re: adding a party member further into the dungeon

Posted: Wed Sep 26, 2012 11:16 pm
by HaunterV
Iron man dungeons! only 1 party member!

Re: adding a party member further into the dungeon

Posted: Wed Sep 26, 2012 11:42 pm
by SpacialKatana
HaunterV wrote:Iron man dungeons! only 1 party member!
With a mage ;)

Re: adding a party member further into the dungeon

Posted: Thu Sep 27, 2012 12:04 am
by tyterrio
So is this even possible? Or am i grasping at straws here? :P

Re: adding a party member further into the dungeon

Posted: Thu Sep 27, 2012 1:19 am
by Shloogorgh
tyterrio wrote:So is this even possible? Or am i grasping at straws here? :P
well, my script at the top of the page works, so it's possible. This is the relevant part, activated by a hidden plate.

Code: Select all

if party:getChampion(#):getEnabled() == false then
hudPrint("I will accompany you...")
party:getChampion(#):setEnabled(true)
Mine goes on to define the new party member's race, class, name, gender, etc.

Re: adding a party member further into the dungeon

Posted: Thu Sep 27, 2012 3:34 am
by tyterrio
awesome! i'll give it a go, thanks! :)