• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Fixed Merging "No Resurrection" Code

Except that almost as soon as I've uploaded the files, I work on them again to progress the storyline. And at the moment I'm only disabling and re-enabling resurrection for the prison escape scene, as that's the one which will certainly be broken if you get killed while in prison and resurrected outside prison. So it's best if I replace "killed" with "disable_rebirth" when necessary, then when I upload the next version you don't need to search and replace again.
I always use WinMerge to install other modders' content anyway; no exceptions. So it would be fine anyway. :doff
 
I was just about to change my "disable_rebirth" with "killed". So which one is it?
This is what I want to change it to:
PChar.disable_rebirth = true;
and
DeleteAttribute(PChar, "disable_rebirth");

That seems the most sensible to me. :doff
 
@Jack Rackham and @Grey Roger: Search-and-replace done. See attached.

I ended up making it:
PChar.quest.disable_rebirth = true;
and
DeleteAttribute(PChar, "quest.disable_rebirth");

That is closer to Jack's original code and saves us having one more attribute being added directly to the player.
Please WinMerge this with your own game versions. If you have any suggestions/additions, let me know. :doff
 

Attachments

  • disable_rebirth.zip
    490.3 KB · Views: 91
Rather than WinMerge, I've done what I said I was going to do and simply done the replacement myself on the current version. But thanks for the main game files which will make it work. :onya
 
Rather than WinMerge, I've done what I said I was going to do and simply done the replacement myself on the current version. But thanks for the main game files which will make it work. :onya
Also fine. There was only exactly one instance in your files that I could find anyway.
So no earth-shattering differences there. :no ;)
 
There are more than one now. That's why it was better to do the replacing myself. ;) I've added it to when you're in prison, possibly the most important part and the one where @Jack Rackham reported the problem which triggered this whole conversation in the first place, and then cancelled it when you escape. And there's another part of the plot where I suspect a tavern resurrection could cause problems, but that bit is still in development...
 
I merged my files and included the zip files and tested a new game with

Pchar.quest.disable_rebirth = true;

but I was reincarnated. :confused:

Maybe the line in LAi_events.c is not perfect yet?
 
That's odd; I must have made a mistake somewhere then.
I moved this to the Bug Tracker so I'll remember next week to test and fix that again.
 
I merged my files and included the zip files and tested a new game with

Pchar.quest.disable_rebirth = true;

but I was reincarnated. :confused:

Maybe the line in LAi_events.c is not perfect yet?
How did you do your test? As far as I can tell, it does work.... :unsure

This is what I did:
1. Set the survival chance value to "1", which means ALWAYS SURVIVE
2. Execute this code through console:
Code:
   pchar.quest.disable_rebirth = true;
   if (CheckAttribute(pchar,"quest.disable_rebirth")) LogIt("You will DIE!!!");
   else LogIt("You may survive....");
   LAi_KillCharacter(pchar);
The LogIt lines confirmed that indeed the "kill check" should work and indeed I wasn't resurrected despite the "definite resurrection setting".
So I cannot find anything wrong, I'm afraid....

Were you testing in the Woodes Rogers storyline, by any chance?
Note that there are a whole bunch of these lines scattered through your code:
Code:
DeleteAttribute(PChar, "quest.disable_rebirth");
I don't know if perhaps one of those got triggered between StartStoryline.c and your actual test?
Looks like also not every single one of your "test cases" has the line to set "disable_rebirth" to true.

Might that be the reason?
 
I tested earlier direct in my StartStoryline
a case with Pchar.quest.disable_rebirth = true; but was reincarnated anyway.


Now I tested 2 cases from Teach_head dialog.c with Pchar.quest.disable_rebirth = true;
They were ok, I died.

Then I teste 1 case from Teach_head dialog.c without Pchar.quest.disable_rebirth = true;
I died here too!

So ? o_O
 
I tested earlier direct in my StartStoryline
a case with Pchar.quest.disable_rebirth = true; but was reincarnated anyway.
On that one, I really wonder if you STILL had the attribute when the resurrection happened.
Because that shouldn't be possible and, based on my test, truly doesn't seem to happen. o_O

Then I teste 1 case from Teach_head dialog.c without Pchar.quest.disable_rebirth = true;
I died here too!
Surviving at all is based on a random chance that can be changed through the ingame Options menu.
To ensure a correct test, I set that to FORCE resurrection (and I still died due to the quest override).
So not surviving if you don't have the override is quite normal; because you don't necessarily always survive.
 
So not surviving if you don't have the override is quite normal; because you don't necessarily always survive.
Aha
and also these ones
Code:
DeleteAttribute(PChar, "quest.disable_rebirth");
between StartStoryline.c and my actual test could be the reason.

Tested now again direct in StartStoryline same case with/without and both worked.
I think it's ok Pieter! :onya
 
I tried it last night. At first it looked fine - having set "Survival" to 1 so as to guarantee resurrection, I charged suicidally at the prison guards, got killed, and wasn't resurrected. Next attempt: let the invincible Indian take care of the guards, escape, suicide-charged the soldiers which appear, also wasn't resurrected.

Here's why:
Code:
    // PB: Immediately determine if you survive or die
     if (rand(100) + (makeint(chr.skill.Sneak)*3) >= DEATHRATE && !CheckAttribute(chr,"quest.disable_rebirth") && !bSuppressResurrection) // SJG
It only checks if "PChar.quest.disable_rebirth" exists, not how it's set. So 'PChar.quest.disable_rebirth = false', which happens in "Ardent" when you've left the prison, has exactly the same effect as 'PChar.quest.disable_rebirth = true'.

Try this instead:
Code:
     if (rand(100) + (makeint(chr.skill.Sneak)*3) >= DEATHRATE && !checkquestattribute("disable_rebirth", true) && !bSuppressResurrection) // SJG

Now it only over-rides your "Survival" choice and prevents resurrection if 'PChar.quest.disable_rebirth = true' is in effect. If you've cancelled it with either 'PChar.quest.disable_rebirth = false' or 'DeleteAttribute(PChar, "quest.disable_rebirth")', resurrection should happen, or not, as normal. I tried that with the same suicidal tactics and it worked as intended.
 
But PChar.quest.disable_rebirth = false is not the right one any longer.
It should be DeleteAttribute(PChar, "quest.disable_rebirth").
 
It only checks if "PChar.quest.disable_rebirth" exists, not how it's set. So 'PChar.quest.disable_rebirth = false', which happens in "Ardent" when you've left the prison, has exactly the same effect as 'PChar.quest.disable_rebirth = true'.
Very true. That's why I was using DeleteAttribute rather than setting it to false. ;)

Try this instead:
Code:
     if (rand(100) + (makeint(chr.skill.Sneak)*3) >= DEATHRATE && !checkquestattribute("disable_rebirth", true) && !bSuppressResurrection) // SJG

Now it only over-rides your "Survival" choice and prevents resurrection if 'PChar.quest.disable_rebirth = true' is in effect. If you've cancelled it with either 'PChar.quest.disable_rebirth = false' or 'DeleteAttribute(PChar, "quest.disable_rebirth")', resurrection should happen, or not, as normal. I tried that with the same suicidal tactics and it worked as intended.
Good call on using CheckQuestAttribute! I hadn't thought of that, but that should indeed be an even better solution. :onya

Also good call on @Jack Rackham's part to actually MAKE it a quest attribute; because until now that was only the case in his storylines.
ba963acfdba6b729058d4ef08a9e6cb0.jpg

:rofl
 
Back
Top