Aller au contenu

Photo

How to make my module stop crashing when I return to main menu when I have a henchman.


  • Veuillez vous connecter pour répondre
23 réponses à ce sujet

#1
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
I know that it is a known bug that if you try to exit to main menu with a henchman in your party that the game will crash.  I also know that someone has made a fix, Pain's DMFI, I believe.  I am wondering if there is a way I can integrate that code into my campaign somehow so that my players will have this fix automatically?  I guess the other option is to point them toward the DMFI.  It is DMFI, right? 

#2
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
I am not sure what that issue is, but i have fixed a lot of issues like that, and prolly just can't remember it. I have not seen that myself so it's very likely in my refactoring of almost all the code used when i play would have fixed that or it's the client extension, but it also could be something else you remember by someone else.

My work is aimed more broadly, trying to take the engine to the next level. As such i am working on a core base library on which all my projects are dependent, which at this point uses almost none of the code which comes with the game, and what is for the most part modular pieces that go on top of that, which include the DMFI, AI, environmental triggers, spells and feats, summoning, chat and languages. All of this is in development and mainly released as a core library to help other scripters as i try to make everything rock solid and easy to use for end users.

The DMFI is aimed for DM's really.

I imagine the AI i am working on might affect that, or some of the events. I would say you should get on IRC and get a copy of your crash log so we can ask some more advanced coders than myself to diagnose exactly why the game is crashing and make sure it's already been dealt with, and we can talk about what you would use out of my codebase. The NWN2 client extension skywing wrote also fixes a lot of the crashing issues.

You can also see released code, and my descriptions of what i am working on at the community script library and these other threads at the citadel.

#3
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
How do I get a copy of the crash log?

#4
dethia

dethia
  • Members
  • 146 messages
Mr Rieder this is indeed a known problem and I am working on some system that also requires a solution.

What I am going ot attempt to do (haven't yet) is OnClientExit quickly iterate through the player's party, if any party member is a henchman belonging to the player, remove them (RemoveHenchman) and probably also DestroyObject them. Hopefully this will resolve the issue. I will try to do this sometime when I get back from work, so if you hadn't done it by then I will post the results here.

#5
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Hey Dethia,

It's really funny that you posted this today because I was just wondering if removing the henchman from the party before the save might work.

It's good to know you are working on it. If I come up with anything I will post it.

#6
dethia

dethia
  • Members
  • 146 messages
Well I have written a function that removes and destroys all henchmen from a player's party on client exit. While the function worked it had no effect on the crashing factor, most likely oPC becomes invalid too fast and the function doesn't get a chance to remove the henchies. I had looked all throughout the default scripts used in the campaigns and from what I understand the devs simply used the roster everywhere instead of henchman.

You can have roster creatures emulate henchmen by using the function:
SetIsRosterMemberSelectable(sRosterName, FALSE);

If you come up with a solution for usinge henchmen please post it here.


EDIT:  Well I have tried using rosters and it doesn't crash the game.  BUT regardless of whether I use SetIsRosterMemberSelectable with a TRUE or FALSE parameter the end-result is always the same in that the creature is selectable and controllable by the player ;(

Modifié par dethia, 26 mars 2011 - 05:04 .


#7
dethia

dethia
  • Members
  • 146 messages
All righty i've sorted it out. You DO use the roster functions instead of henchman and then you use the function:

SetIsCompanionPossessionBlocked(oCreature, TRUE);

to block the creature's posession.

Also to not have to muck around with the creature's AI I do:
HenchmanAdd(oCaster, oCreature, FALSE, TRUE);
RemoveHenchman(oCaster, oCreature);

(HenchmanAdd is in ginc_henchman include file).
The above sets the creature's AI to henchman ai so they will follow commands like move, follow me, attack, and hold. Hope that helps you.

#8
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
That is very helpful indeed! So it seems like you are saying for the OC, the developers never used henchman and only used roser creatures. Am I understanding you correctly?

That sounds like a good solution, but I have run into problems in the past with creatures that I have added to the party. When they die, instead of leaving the group, their portrait stays in the group except it has the picture of a party member leaving. Have you ever noticed this? Have you figured out how to fix it?

#9
dethia

dethia
  • Members
  • 146 messages
I will check in general you can add to the creature's on death event to be removed from roster/party. My main problem right now is creatures added to roster (instead of as henchmen) are not hostile to hostile creatures and I can't seem to make them hostile no matter what I do. Driving me crazy at the moment ;(

#10
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi All,

I just posted a similar post before finding this one. Doh!

Anyway, good to hear there is a workaround using roster functions. I had tried doing everything dethia said already (including trying to use the On Area Exit as a way of removing the henchman, and would have added again if the player had not left the game) and also came to the conclusion that the game exited quicker than the code cold be run.

dethia wrote ...

Also to not have to muck around with the creature's AI I do:
HenchmanAdd(oCaster, oCreature, FALSE, TRUE);
RemoveHenchman(oCaster, oCreature);


I don't think this will work will it? I believe the original scripts are replaced when you remove the henchman again ... at least, they are when I have tested my henchmen prior to discovering this bug. You can of course, do this yourself by using the SetCreatureScriptsToSet function, which I have found invaluable - and is probably what the HenchmanAdd uses anyway.

There are, of course, some other drawbacks that cross my mind as I write this ... I guess doing it this way will mean the henchman will count as a faction member (from the loop function), which I was trying to avoid .... add another variable check I guess.

Anyway, at least I can look at this again ... unless someone comes up with the answer to using AddHenchman, I will try this route.

Lance.

EDIT: Oh, actually this is NOT going to work for me, as it messes with the roster limit numbers that I have set - and keeping track of this could turn into a bit of a code nightmare. Therefore, I will just have to warn the player about the on game exit crash unless someone can come up with a solution.

Modifié par Lance Botelle, 27 mars 2011 - 03:48 .


#11
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Hey Lance, would it be possible to write some code that detects whether you have a henchman when you press the "exit to main menu" button, then if you do have a henchman, displays another GUI which reminds you that you need to remove the henchman before exiting, then the GUI would have a button that you can press which will remove the henchman. Once you press this button, another button could become useable which sends you back to the main menu.

This seems like it should be possible, but you are GUI guru. What do you think?

#12
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

M. Rieder wrote...

Hey Lance, would it be possible to write some code that detects whether you have a henchman when you press the "exit to main menu" button, then if you do have a henchman, displays another GUI which reminds you that you need to remove the henchman before exiting, then the GUI would have a button that you can press which will remove the henchman. Once you press this button, another button could become useable which sends you back to the main menu.

This seems like it should be possible, but you are GUI guru. What do you think?



Hi Matt,

Excellent idea ... that should work. (As long as I can get to the Main Menu XML code.)

If I can do this, I will simply remove the henchman when th eplayer presses the button prior to continuing to run the exit code.

I will look into it straight away and come back to you.

Lance.

Modifié par Lance Botelle, 27 mars 2011 - 03:54 .


#13
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
That's great. This will be a great fix for the game.

#14
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

M. Rieder wrote...

That's great. This will be a great fix for the game.



Hi Matt,

Preliminary test works ... Posted Image

I need to take a break now and will finish the code later before releasing it on the Vault.

I still need to add some code to ensure the henchmen reattach themselves to the player if they resume the game, and do a little more testing. I may look at MP aspects.

I had to edit the XML and make one in game script, but all looks good so far.

Back later.

Lance.

#15
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
You're amazing Lance! Great work and thanks for fixing that annoying bug!

#16
dethia

dethia
  • Members
  • 146 messages
Great job after exhausting everything I was going to do the same but since you have done it I'll just wait for the vualt release ;P

#17
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 585 messages

dethia wrote...
... regardless of whether I use SetIsRosterMemberSelectable with a TRUE or FALSE parameter the end-result is always the same in that the creature is selectable and controllable by the player ;(


I thought the purpose of this function was to indicate whether the member is selectable in the roster GUI itself, not whether or not you can take control of them in game.

I avoid the roster GUI at all costs though and instead control the party membership with conversations, so my experimentation with it is limited.

Regards

#18
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi All,

The patch is now available ... http://nwvault.ign.c...I.Detail&id=160

Here is a copy of the Readme.txt, which contains some important information:


HENCHMAN GAME EXIT CRASH PREVENTION
=============================

This is an updated optionsmenu.xml and an accompanying script (gui_alb_henchfix) to fix an exit game crash when the player has HENCHMEN in the party. It is recommended that you place both files in places where they take priority. E.g. In the campaign folder.

This is what the new code does:-

1) When either the game options EXIT GAME or MAIN MENU are selected from the options menu, it immediately dismisses all henchmen that the PC has with them and records on the henchmen who their master was at the time of dismissal.
2) If the player then continues to exit to the main menu or the game, it will no longer crash.
3) If the player cancels either exit path and resumes the game, the code will try to reattach the henchmen as they were prior to bringing up the options menu.
4) Furthermore, if the player chooses to save the game after abandoning an exit route, the code will reattach the henchmen prior to the save taking place so that the henchmen status is saved.

*IMPORTANT NOTE REGARDING HENCHMEN NUMBERS*
====================================

While the function HenchmanAdd used in the format example below forces a henchman to be added to the party, there remains an issue when saving a game when the maximum number of henchmen has not been set by the function SetMaxHenchmen.

E.g. HenchmanAdd(oMaster,oHench,1,1);

When the function that sets the maximum number is not used (normally set in the module's On Load), then when reloading a game, the player will find themselves with fewer henchmen than they saved the game with (possibly having only one henchman if the maximum number was not set at all) regardless of the number they saved with the game. Therefore, it is recommended that you use this function in your module's On Load to ensure the maximum number of henchmen that the player can possibly have is set correctly from the start. E.g. Place this in your module's On Load:

// MAXIMUM HENCHMEN POSSIBLE
SetMaxHenchmen(10);

By Lance Botelle


Modifié par Lance Botelle, 28 mars 2011 - 08:39 .


#19
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Thanks lance. This is great. Can't wait to put it in my campaign!

#20
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi Matt,

UPLOADED:  http://nwvault.ign.c...I.Detail&id=160

Lance.

Modifié par Lance Botelle, 28 mars 2011 - 08:39 .


#21
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Sweet! I'll get it tonight when I get home.

#22
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

M. Rieder wrote...

Sweet! I'll get it tonight when I get home.



Any feedback?

Did it work OK for you?

Lance.

#23
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
I haven't had a chance to test run it yet. I'm working through some tricky convos and scripts right now. Dont' worry, its the next thing to go into my mod and I'll test it and give feedback.

#24
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

M. Rieder wrote...

I haven't had a chance to test run it yet. I'm working through some tricky convos and scripts right now. Dont' worry, its the next thing to go into my mod and I'll test it and give feedback.


Thanks for updating me Matt.

I have not heard a thing from any download, so I was wondering if I had missed something. Posted Image I know it worked fine for me, but you never know ....

Do keep me updated.

Lance.