Aller au contenu

Photo

[SOLVED] Death Irregularities


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

#1
Qutayba

Qutayba
  • Members
  • 1 295 messages
I'm testing combat in my module, and party death is not working properly.  The followers are set to have no permanent death, but they are not plot or immortal.  They are not dying in combat and become invulnerable at 0 hp (as if they were immortal).  The player dies but does not res even when all creatures in the area are killed.  This is probably because the engine still believes combat is going on.  I'm thinking maybe I've neglected to include the death rules in my module script or something along those lines.  I've included the following in my main module script:

#include "events_h"
#include "global_objects_h"
#include "utility_h"
#include "wrappers_h"

Where else should I look to fix these problems?

Modifié par Qutayba, 08 mars 2010 - 04:43 .


#2
wyvern14

wyvern14
  • Members
  • 107 messages
Make sure there is a line at the end of your module script that "throws" all other events than those you customized to the real module core. Load up one of the module core templates and look at the last 3 lines.

#3
Qutayba

Qutayba
  • Members
  • 1 295 messages
I already have this at the end of the module script:



if(!nEventHandled)

{

HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);

}



I haven't fiddled with death rules at all, so I don't know what's causing this behavior.

#4
wyvern14

wyvern14
  • Members
  • 107 messages
try this : go in the single player game and copy paste their whole module core in a temporary new module core for your thing. Edit the tidbits you need different (for example, if you coded campaign item acquired), add some printtolog to the functions that are not happening and assign it to the mod. Clear the log, play and read the log afterward, it might help.


Oh, forgot to mention - no need to put no permadeath on followers, when they are added to the party it's all taken care off.

Modifié par wyvern14, 27 février 2010 - 06:02 .


#5
Qutayba

Qutayba
  • Members
  • 1 295 messages
So, I'm thinking my player not ressing may have had something to do with my creature placement. I think I had a creature stuck in the architecture, so I couldn't see him in game but he kept the combat event going.



The followers being immortal is still a mystery, but I think I've eliminated the possibility that the central scripts are causing the problem. Fortunately, modules are big enough that you can set aside a problem for a few days and come back with fresh thinking. Thanks for the help, Wyvern.

#6
Qutayba

Qutayba
  • Members
  • 1 295 messages
OK, I've eliminated the module script and creature placement as causes for follower immortality and combat not ending. I've fixed all but one of my companions (it turns out I didn't initialize them through a full hire script and had merely toggled them to available.) The remaining follower differs only in that he is temporarily fired (UT_FireFollower - there is a building he refuses to enter, behavior set by a trigger). When I look at the utility_h script, it appears that the only thing UT_FireFollower does is change the follower's state to available (unless you want xp or gear to be altered). His original hiring script is identical to other followers that work fine now.

So, I'm wondering which variables make him immortal and prevent ressing. If there is anyone else alive at the end of combat besides him, the PC and other companions res. But if he is the last one standing, the engine doesn't consider combat to have ended. I'm at a loss, since the only thing different is that he is temporary fired (status changed to available) and then rejoins the party through the party picker. Is he not counting on the player's team for some reason?

Edit: The problem is not fixed by replacing UT_FireFollower with WP_SetFollower State.  If he dies before the script that fires him, he dies properly.  Is this perhaps caused by jumping from FOLLOWER_STATE_LOCKEDACTIVE to FOLLOWER_STATE_AVAILABLE?  Seems weird to me.

Modifié par Qutayba, 07 mars 2010 - 08:35 .


#7
Magic

Magic
  • Members
  • 187 messages
There is a SetImmortal(oCreature, TRUE); call for the firing event in wrappers_h.nss, line 427. If you use UT_FireFollower() or WR_SetFollowerState(), just remove the immortality after the call. Maybe that's what you're looking for?

#8
Qutayba

Qutayba
  • Members
  • 1 295 messages
This is probably the problem. Thanks, Magic! But isn't putting him back in the party through the Party Picker supposed to change his state to active again, and thus remove his immortality?  (I double checked this, I even have a switch to active line in my intercept of EVENT_TYPE_PARTYMEMBER_ADDED).  Well, at least I can get it working now, but it still bothers me knowing the glitch is there.

Modifié par Qutayba, 07 mars 2010 - 10:05 .


#9
Magic

Magic
  • Members
  • 187 messages
Oops, I think I lost the plot. WR_SetFollowerState() with FOLLOWER_STATE_ACTIVE is removing the immortality, that's true. Are you using this (in UT_HireFollower() e.g.)? I understood that you were using SetFollowerState() directly, at least for the only one still problematic follower. I'm not familiar with the party picker but I assume you're right in saying that it should remove immortality as well.

On the other hand, if your scripts are working for all but one follower, there's most likely a bug in your scripts and not in the default ones, isn't it? It will be difficult to locate it without seeing the code.

Edit: Uhm, I missed your edit. Is all working now?

Modifié par Magic, 07 mars 2010 - 10:15 .


#10
Qutayba

Qutayba
  • Members
  • 1 295 messages
I'll show you my key scripts (removing some unrelated stuff, the includes, etc., to make it shorter: these all compile and export with no errors).  I'll include the older code that I slashed out.  I'm making use of the custom follower hire script from the wiki, which has the following syntax:

hireCustomFollower(object oFollower, int nForceclass, string sPlot = "", int nPlotFlag = 0, int nForceSpec = 0, int nALTable = 0, int bInvokePicker = FALSE, int nInitialState = FOLLOWER_STATE_AVAILABLE, string sCurrPlot = "", int nCurrPlotFlag = 0, int nAutolevel = 0, int bFreeSpecPoint = TRUE, int nTargetLevel = 0, int nMinLevel = 0)


The original hire script (where he is made locked):

void main() {
        object oFollower = GetObjectByTag("wh_comp_callum");
   
        //WR_SetPlotFlag(PLT_WH_PARTY_STATUS, CALLUM_JOINED, TRUE);
        //UT_HireFollower(oFollower);
        //WR_SetFollowerState(oFollower, FOLLOWER_STATE_LOCKEDACTIVE);

        WR_SetPlotFlag(PLT_WH_PARTY_STATUS, CALLUM_ACTIVE, TRUE);

        hireCustomFollower(oFollower, class_WIZARD, PLT_WH_PARTY_STATUS, CALLUM_JOINED, ABILITY_SPELL_HIDDEN_SHAPESHIFTER, 0, FALSE, FOLLOWER_STATE_LOCKEDACTIVE);

        SetPartyPickerGUIStatus(2);
        ShowPartyPickerGUI();
        }


The party picker intercept code in my module script:

 case EVENT_TYPE_PARTYMEMBER_ADDED:
        {
            object oFollower = GetEventObject(ev, 0);
            SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);
            AddCommand(oFollower, CommandJumpToLocation(GetLocation(GetHero())));
            SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE);

            if (GetTag(oFollower) == "wh_comp_callum") {
                WR_SetPlotFlag(PLT_WH_PARTY_STATUS, CALLUM_ACTIVE, TRUE);
            }


The fire script, triggered by a conversation (and subsequently by a ground trigger).  He is kicked out of the party and stands by an object, around which the party picker is made available:

void main() {

        object oFollower = GetObjectByTag("wh_comp_callum");
        object oWp = GetObjectByTag("wh_stand_callum");
        location lWp = GetLocation(oWp);

        WR_SetPlotFlag(PLT_WH_PARTY_STATUS, CALLUM_ACTIVE, FALSE);

        //UT_FireFollower(oFollower, FALSE, FALSE);

        WR_SetFollowerState(oFollower, FOLLOWER_STATE_AVAILABLE);

        AddCommand(oFollower, CommandMoveToLocation(lWp, FALSE, FALSE));

        }


The chain of events:

Callum hired (locked)  <--- he is mortal at this point
Enter trigger, conversation fires the firing script, his status is available, so he can be added in areas where party picker is allowed
Party Picker: He can be returned to the party as active <---- It's at this point that he is immortal and unable to recognize the end of combat, which then prevents party res).

There aren't any other scripts that should affect his status.

#11
Magic

Magic
  • Members
  • 187 messages
Just one guess for now because it's already late. Shouldn't it be WR_SetFollowerState() here as well? Please notice that WR_SetFollowerState() is removing the immortality while SetFollowerState() is the pure engine function.

 case EVENT_TYPE_PARTYMEMBER_ADDED:
        {
            object oFollower = GetEventObject(ev, 0);
            SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);
            AddCommand(oFollower, CommandJumpToLocation(GetLocation(GetHero())));
            SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE);

            if (GetTag(oFollower) == "wh_comp_callum") {
                WR_SetPlotFlag(PLT_WH_PARTY_STATUS, CALLUM_ACTIVE, TRUE);
            }



#12
Qutayba

Qutayba
  • Members
  • 1 295 messages
Magic, you are a genius! This has been stumping me for weeks. Sometimes you read over something so often that you miss the obvious. Thanks! Callum, however, does not thank you, because he is now mortal.

#13
Magic

Magic
  • Members
  • 187 messages
Hehe, that's a funny sentence at the end. I tend to jump around like crazy when I find a bug in my scripts which was a minor thing occupying me for days. So I have to disagree with your first statement - thanks though. :happy:

#14
Obadiah

Obadiah
  • Members
  • 5 714 messages
Should I use SetFollowerState() then WR_SetFollowerState(), or should I call SetFollowerState() then SetImmortal()?

P.S. I am following the wiki guide which only calls SetFollowerState() in EVENT_TYPE_PARTYMEMBER_ADDED.

P.P.S Gonna use the WR_SetFollowerState() function. Otherwise the Save/Load screen doesn't load properly when the party wipes.

Modifié par Obadiah, 12 juillet 2011 - 05:01 .


#15
Proleric

Proleric
  • Members
  • 2 343 messages

Obadiah wrote...

Gonna use the WR_SetFollowerState() function.

I came to the same conclusion after encountering similar issues recently.

I've patched the follower tutorial.

I plan to make a thorough revision once I'm satisfied that my followers are behaving robustly in beta test.

#16
Obadiah

Obadiah
  • Members
  • 5 714 messages
Updated "Capture the EVENT_TYPE_PARTYMEMBER_ADDED Event" and "Add Plot Flags to Party Picker Event Intercept" in the wiki tutorial to use WR_SetFollowerState()