Jump to content

Protagonist resurrection mod


Recommended Posts

I was playing some Diablo 2 recently, but now thinking about going back to Baldur's Gate. During planning of my next journey as "Gorion's Ward" I realized, that one thing I really liked about D2 is no save-and-load, I mean, it's make gameplay much more fluent when you just play the game and don't think about saving and loading game. Ofc, you can play BG "hardcore" style, with "no reload" approach, but for this you really need to know the game well and in general, it is really challenging.

My question is: Are there any modifications that somehow implements this behavior in BG?

I assume that not everyone knows Diablo 2 so I quickly sum up how it works there. When your character dies, he or she is automatically resurrected in town. There is some penalty in experience points and gold. Your whole equipment is left in place when you died, but its rather easy in this game to get back to the place quickly and continue fight.

BG is very different game then D2 so obviously it cannot be mapped one to one, but here is how I can imagine this. When protagonist dies, he or she is transferred to nearest temple and starts new life with 1 hp, there is some penalty for that (lets say 1% of gold and exp, this is ofc just matter of balance). All companions are dead (you can resurrect them). Your equipment lies on ground in temple (I guess it can be somehow implemented, moving equipment from ground happens in ToB after defeating Illasera). I realize that there are some corner cases like Candlekeep or Spellhold dungeons etc. when transferring to temple don't make much sense. But there would always be way to fit it somehow into this schema.

I know, maybe it is too complicated for benefit it provides, but something like this could allow for "semi-hardcore" playthrough, where you need to be careful, but on the other hand you don't kill your character entirely because of some small neglect.

Do you know about some modifications that allows such thing? Would such mechanics in BG make sense in your opinion?

Link to comment

Thank you for your answer, this "Protagonist can die" mod can be good starting point for me.

What I described was only idea how it could work in BG, not exact specification. I guess if it is possible to stop "game over" on protagonist death it would be possible to trigger some action on protagonist death, imprisonment etc. The rest is just find the most suitable actions that engine allows on. Quickly looking on "Protagonist can die" I'm a bit surprise that this "game over" is handled from so many places, but anyway, if I'm not mistaken the most challenging part is already done. I will try to prepare some proof of concept.

I recently realized that very similar mechanics was also in Neverwinter Nights. There were also there item called "stone of recall" that allow player for teleport to "safe place". I found two BG mods that try to do similar thing:

It seems like I need to combine "Protagonist can die" with one of them and voila, seems like piece of cake. 😉

Link to comment

@In_A_Graveyard Sure, any help is welcome. I will setup github repository for easy code sharing. I would also for sure need help with detecting all corner cases that can lead into bugs.

 

I investigated a bit this topic regarding what could be technical implementation:

 

1. Preventing "game over" on protagonist death

Besides mentioned before "Protagonist can die" I also checked "Death Cam" module of "Tweaks Anthology". It seems that "game over" on protagonist death need to be disabled on each area separately. This WeiDU code is doing this (from "Tweaks Anthology"):

COPY_EXISTING_REGEXP GLOB ~^.+\.are$~ ~override~
  WRITE_LONG 0x14 (THIS | BIT4) // add player1-can-die bit
  BUT_ONLY

This affects all ARE files, so its is also compatible with other mods, if installed after them. This only work for EE versions of game.

Also, there seems to be also three script files involved: "baldur.bcs", "baldur25.bcs", "bdbaldur.bcs". According to SimDing0 scripting guide "baldur.bcs" is global script that runs all the time during game and "baldur25.bcs" is its equivalent for ToB. "Protagonist can die" remove all GameOver actions from those scripts:

COPY_EXISTING ~baldur.bcs~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY ~GameOver(19377)~ ~NoAction()~
END
COPY_EXISTING ~baldur25.bcs~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY ~GameOver(19377)~ ~NoAction()~
END
COPY_EXISTING ~bdbaldur.bcs~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY ~GameOver(19377)~ ~NoAction()~
END

In my version BG1EE I have "baldur.bcs" and "baldur25.bcs", there is no "bdbaldur.bcs". In "baldur.bcs" there is GameOver trigger:

IF
	!InParty(Player1)
	Global("bdtgaze","GLOBAL",1)
THEN
	RESPONSE #100
		GameOver(19377)  // The main character has been killed. You must restart the game.
END

But I couldn't find place where "bdtgaze" variable is set. "Death Cam" do not replace GameOver() with NoAction() so i"m not sure if it is required.

 

2. Respawn in temple

I was able to move my dead protagonist to temple with following commands:

C:Eval('ActionOverride(Player1, LeaveAreaLUA("AR4802","",[505.408], NE))')
C:Eval('ApplySpell(Player1, CLERIC_RESURRECTION)')

However, camera do not changes to new area. It seems that LeaveAreaLUA action normally moves camera, but since character is dead, it is not happening. There is action MoveViewObject that can move viewport, but it seems to works only inside same area. Maybe  LeaveAreaLUA is not proper action to use in this case? Or maybe there is some action that could move viewport to other area? I'm seeking advice.

I didn't touch equipment movement topic yet. There is action "CopyGroundPilesTo()" that allows to move ground piles between locations, but it affect all ground piles, what I believe can cause strange output in some cases. Unless equipment  dropped by PC has some own identifier it could be rather hard to move this. However, maybe just allowing quick travel to place of death would be anyway better option. With "quick loot" window it would be rather easy to get gear back. TBD

 

3. Detecting respawn point

I'm thinking about resolving in three groups of steps:

  • plot critical rules (e.g. for Candlekeep catacombs, Irenicus dungeons, Spellhold dungeons etc.)
  • based on last visited outdoor area
  • some fallback based on game chapter etc.

 

4. Respawn penalty

IESDP don't says that, but I tested, and it seems you can pass negative value to "AddExperienceParty()" action. There is even nice console message "party lost experience". It doesn't reduce character level, what I think is best option for respawn penalty case.The only problem is, that reducing experience below 0 cause integer underflow and character is on maximal experience then. But I guess with right triggers that check experience value of PCs it can be prevented easily.

I guess there is no way to apply percentage penalty, it seems there is no way to read character XP points in script action block. Maybe it could be accomplished with Effect, I need to investigate more. Fallback would be to have penalties based on some thresholds.

 

Link to comment

This is a great start @marchitek! As I have time I wouldn't mind digging into some of the scripting calls.

A design thought:

in D2, your equipment doesn't transfer back to camp, but remains in the field and must be re-acquired for use and to recover gold/xp. Perhaps there is something along these lines we could re-create instead of attempting to move the ground piles?

The best place for me to start will definitely be Sim's guide. 😬

I'll clone protagonist can die mod and start tinkering myself.

Thanks!

Link to comment

PST is a hardcoded mess, but some of this resurrection stuff is nicely specified with ini files. But you're not modding for pst, so that's useless.

Copying piles is a safer alternative, since they might get destroyed with time otherwise. Teleporting the pc to the temple alone can lock you into areas that require the full party to travel from.

Link to comment
1 hour ago, lynx said:

Copying piles is a safer alternative, since they might get destroyed with time otherwise.

That's true. I think that maybe it wouldn't be a problem if I implement some ability/item that allows to quick travel to place of death. But for now I'm not sure how to implement that. I tested "StorePartyLocations()" and "RestorePartyLocations()" actions and it works flawless, but it allows to store only one location at the time, what could cause compatibility issues with other usage of this actions. I think it is mostly used for dream cut scenes etc. to restore party location after dream ends.

Regarding copying of piles alternative to "CopyGroundPilesTo()" could be copying them one by one, but not sure if I can identify correct ones. If I understand correctly ground piles are container of some type, so they have some id generated by engine. But I'm not sure how it works.

 

1 hour ago, lynx said:

Teleporting the pc to the temple alone can lock you into areas that require the full party to travel from.

True, I will move whole party I guess.

This is what I have for now:

IF
	StateCheck(Player1, STATE_REALLY_DEAD)
THEN
	RESPONSE #100
		StartCutSceneMode()
		SmallWait(15)
		FadeToColor([20.0],0)
		SmallWait(30)
		ClearAllActions()
		ActionOverride(Player1, LeaveAreaLUA("AR4802","",[473.395], NE))
		ApplySpell(Player1, "CLERIC_RESURRECTION")
		ActionOverride(Player2, LeaveAreaLUA("AR4802","",[528.421], NE))
		ApplySpell(Player2, "CLERIC_RESURRECTION")
		ActionOverride(Player3, LeaveAreaLUA("AR4802","",[442.428], NE))
		ApplySpell(Player3, "CLERIC_RESURRECTION")
		ActionOverride(Player4, LeaveAreaLUA("AR4802","",[498.454], NE))
		ApplySpell(Player4, "CLERIC_RESURRECTION")
		ActionOverride(Player5, LeaveAreaLUA("AR4802","",[407.464], NE))
		ApplySpell(Player5, "CLERIC_RESURRECTION")
		ActionOverride(Player6, LeaveAreaLUA("AR4802","",[461.490], NE))
		ApplySpell(Player6, "CLERIC_RESURRECTION")
		SmallWait(15)
		FadeFromColor([20.0],0)
		SmallWait(30)
		EndCutSceneMode()
END

It seems that if applying of resurrection is right after LeaveAreaLUA, the camera is moved to target location correctly. If I would put same wait in between, it will not work. I believe that due to some race condition it will not work once in a while, but it's not game breaking problem, double click on character portrait move camera to correct area and everything is fine. So I would say this behavior is "good enough".

Link to comment
20 minutes ago, lynx said:

ground piles are indeed containers, but they don't have any or any predictable scripting names you could use to target them.

Uh, that's bad, because now I realized that without copying ground piles this mod wouldn't allow to resign on coming back to fight that cause character death what could be one of cool usage of it. Anyway, maybe "CopyGroundPilesTo()" wouldn't be that bad, I cannot think of an example from the game when it could allow player to access some item too early etc. If anyone has something like this in mind, please shout.

Thank you for clarification of this topic!

Link to comment
On 3/6/2022 at 9:57 PM, kijikun said:

Would a work around being triggering the 'resurrection'  sequence when the pc1 is at 1hp?

I was thinking about it as a "final" workaround, if everything else fails. But engine at least in theory allows protagonist dead, so I will explore a bit this concept, maybe there is a way to make it work.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...