Doh! Place yer bets!
As my brother isnāt that familiar with NWN or D&D, I doubt he even knows how to do that, honestly.
I copied your script, compiled it and ran it ingame. I had forgotten how to do debug_mode but found 4760ās notes telling how to do it on a keyboard like mine (it doesnāt work like on american computers).
Anyway, went into debug mode, ran the script before entering the area and it said that everyone
" is not immortal." When I entered the swamp area where the fights area, and where Loreen canāt be damaged, it still said, when running the script, that everyone was not immortal.
Maybe I should try while in the fight perhaps? Iāll see if that can be done.
This is how it looks ingame. Loreen doesnāt take damage, and at the same time Iām running the debug script proving she is not immortal. Soā¦whatās going on?
Maybe I could try something like this?
void main()
{
string sPlot = " is NOT set to plot.";
object oPC = GetFirstPC(FALSE);
object oFM = GetFirstFactionMember(oPC, FALSE);
while (GetIsObjectValid(oFM))
{
if (GetPlotFlag(oFM)) sPlot = " IS set to plot.";
SendMessageToPC(oPC, GetName(oFM) + sPlot);
oFM = GetNextFactionMember(oFM, FALSE);
}
}
Yes, try this. As āPlotā is the key one I would suspect. (Plot stops all damage.)
The other (immortal) is more to do with taking damage but not dying.
Ok. NOW it got really interesting, and quite bizarre. In the area before going to the swamp, all the companions were actually set to plot! But then when entering the area, it said they werenāt set to plot anymore. In other words travusā script did what I wanted to. Then I started the fights again, and low and behold, Loreen takes damage again! But she didnāt do that before!! This is so weird.
But at least weāre getting somewhere now. Maybeā¦could it be that the OnClientEnter script, doesnāt always have the chance to fire? As I said I am using travusā script right now. Maybe if I did a 0.2 sec delay on that?
Iāll try this savegame again, and if Loreen doesnāt take damage, like before Iāll run this plot_check script.
Edit: LOL! Without doing anything (not doing the dely, just leaving travusā script as is), now I canāt recreate the āis NOT set to plotā. Alright, maybe I should just leave it like this, and maybe apply it in the areas on the OnClientEnter where thereās fighting going on.
As I say, it is the plot flag as I suspected from the start. And the script that @travus supplied (and I would have also done) should be the way to go.
As I said above, you need to consider applying this script/function for every area to be sure. I think the game engine may āplotā PCs upon entering to avoid them being killed prematurely. However, it may be getting āstuckā - especially when walking straight into a battle.
Did a bit of testing again, and with my brotherās savegame itās absolutely clear that all the companions are set to plot when in the area before the swamp. So maybe thereās something that happens there. Thereās quite a bit of fights going on in the area before too.
Yes, I get what you mean. With the duel battles, that you helped me with, I noticed clearly that when a new enemy is spawned in, for the first second Taik doesnāt take damage, but then he does, so there itās not a problem. It may be the gameās way of preventing bad things from happening.
I think that was also my conclusion - and a reason why I had to delay āplotā fixing until the game had determined everyone was ready to go. i.e. The plot flag appears to stay āsetā upon entering an area to prevent untimely death - but I have witnessed it get stuck, especially if a battle is going on. i.e. It is probably better / safer design to make sure there is no battle going on (or is targeted as an enemy) as a player enters an area by at least two heartbeats.
For the record, that was how I āfixedā the issue with my own plot issues. I had to leave at least 2 heartbeats (iirc) before I could work with it - Sadly, I cannot recall more details, but I am recalling bits of info as we continue this discussion.
Re Your post below, let me know how you get on - Will be back in a few hours.
I donāt think thereās any area I have where a fight starts right awayā¦oh, wait, there is one, actually, and in that area I have a ClientEnter scriptā¦I think. Iāll look into it.
But then I shouldnāt do a delay on travusā script?
I have now updated all OnEnter scripts. Not all areas had these, but those that didnāt have it, doesnāt have fights, so I think it should be no problem now. At least thereās a check for immortality quite often, so if the bug reappears thereās a great chance it goes away again. Iāve sent the updated Campaigns folder to my brother. Gotta say, Lance, itās quite nice to be able to do it like this. He wonāt need to restart from the beginning now.
I did no delays on the scriptsā¦If there still are problems, I might go back and add some small delays to them. Donāt know how long those delays are supposed to be exactly, for it to be effective in the game.
Itās good to hear you are getting to grips with and benefiting from the campaign structure way of doing things.
There is one thing I would like to mention, which I donāt think affects you, but is worth informing you about as well ā¦
If you use and update a homebrew include library (which I donāt think you have anyway), then bear in mind you would need to recompile all scripts that used your updated/fixed include script and then include all affected scripts within the campaign update. However, I donāt think this affects you, as I believe you keep your functions within your scripts locally.
If that did not make sense, donāt worry, as it likely has no bearing to you anyway.
I know we have spoken about this before, so Iām quite aware of this, actually. Thanks for reminding me, though.
Yes, I mostly have my include functions locally, but there are instances where itās not like this. But as I said, I am well aware of this.
My brother have played some more since I gave him the update, he had backed to a previous save to change a few things (buy other armor and whatnot) , but he told me that now when getting to the area before the swamp (donāt believe he has reentered the swamp yet) everybody takes damage, so for the moment this seems to have worked. Hopefully he wonāt encounter any more nasty bugsā¦but it really is easier to fix things, and above all test things, now that I have my adventure as a campaign.