Page 1 of 1

question on dying and ressurection

Posted: Mon Oct 05, 2015 7:39 pm
by kelly1111
Hello There,

Is there a simple way to make a script that would do the following:

party steps inside a room (or on a certain tile): dies
and when the party dies, do not go to the game over screen but teleport them full health to another place in the dungeon?
Would this be possible to overide, or is the game over screen thing hard coded?

Re: question on dying and ressurection

Posted: Mon Oct 05, 2015 7:55 pm
by Azel
I believe minmay boasted of accomplishing this very thing, as a feature of boss battles in his someday-soon to be released mod. Maybe he'll share it with ya! ;)

As for insta-death, I believe this has been accomplished and solution sits somewhere in these threads. If I recall, you will need to do tile damage that reduces all party members health to 0

Re: question on dying and ressurection

Posted: Mon Oct 05, 2015 8:30 pm
by Drakkan
there is a onpartydie hook I believe so with little scripting this could be possible I think

Re: question on dying and ressurection

Posted: Mon Oct 05, 2015 8:36 pm
by kelly1111
Any help to get started minmay :) ?

Re: question on dying and ressurection

Posted: Mon Oct 05, 2015 8:36 pm
by minmay
Just use PartyComponent.onDie(). Check if there are no other living champions left, and if so, do your teleport/heal/whatever and return false.

Re: question on dying and ressurection

Posted: Mon Oct 05, 2015 8:51 pm
by Zo Kath Ra
Put this in your mod's init.lua:

Code: Select all

defineObject{
    name = "party",
    baseObject = "party",
    components = {
        {
            class = "Party",
            
            onDie = function(self, champion)
                local living_champions = 0
                
                for i = 1, 4 do
                    if (party.party:getChampionByOrdinal(i):isAlive()) then
                        living_champions = living_champions + 1
                    end
                end
                
                if (living_champions == 0) then
                    party:setPosition(starting_location_1.x, starting_location_1.y, starting_location_1.facing, starting_location_1.elevation, starting_location_1.level)
                    party.party:heal()
                end
            end,
        }
    }
}

Re: question on dying and ressurection

Posted: Mon Oct 05, 2015 9:11 pm
by kelly1111
Thanks alot zo kath ra. One question tho,

what if I want to make it a one time use only ?
say for instance only in a certain area or if a certain counter is at a certain number?

is that possible?

Re: question on dying and ressurection

Posted: Mon Oct 05, 2015 9:44 pm
by Azel
You can probably just add to the "IF" statement,

So this:

Code: Select all

if (living_champions == 0) then
becomes something like this:

Code: Select all

if (living_champions == 0 AND mySpecialDeathCounter.counter:getValue() == 1) then
Just modify that to check for whatever value your Counter should be to allow for this circumstance. That should work!