Aller au contenu

Photo

Reviving Party Members and Autosave troubles


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

#1
FergusM

FergusM
  • Members
  • 460 messages
I have a scenario that goes fight -> cutscene -> fight. What I want to do is revive/heal/cooldown all party members after the first fight. The trouble is reviving them; I can't figure out what function to us to get them on their feet. The second thing I want to do is Autosave directly after the cutscene.

The cutscene loads when the first fight team is destroyed. I have tried calling DoAutoSave when the team destroyed event fires, and I have also tried putting it in a script that runs when the cutscene finishes (using the object inspector in the cutscene editor). However, in both cases, it does not work. The problem seems to be that since the party is still in combat when the cutscene fires, there is never a chance to AutoSave out of combat. I have tried using things like SetCombatStateParty, but this doesn't seem to work for me either.

So, I need a way to revive dead party members and a way to do an AutoSave in combat, or a way to stop combat.

#2
Mengtzu

Mengtzu
  • Members
  • 258 messages
I'm not sure DoAutosave() works, try setting the gen_autosave plot in gen00pt_generic_actions




#3
Magic

Magic
  • Members
  • 187 messages
The plot is using the same function. ;)

Conversations in the official campaign are using ResurrectPartyMembers() from effect_resurrection_h.nss for the revival. See UT_Talk() for example.

For auto-saving, maybe check for EVENT_TYPE_GAMEMODE_CHANGE in the module script?

#4
FergusM

FergusM
  • Members
  • 460 messages
GAMEMODE_CHANGE, interesting. I had been trying COMBAT_END, that sounds promising.



Thanks.

#5
FergusM

FergusM
  • Members
  • 460 messages
Okay, so resurrection works fine. However, autosaving still not happening. It works elsewhere, just not in this one example. The code is basically

event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
switch(nEventType)
{
        case EVENT_TYPE_TEAM_DESTROYED:
        {
                 int teamdest = GetEventInteger(ev,0);
                 if (teamdest == 1)
                 {
                            SetLocalInt(GetModule(),"DARKSPAWN_DEAD",1);
                 }
         }
        case EVENT_TYPE_GAMEMODE_CHANGE:
        {
                  if (GetLocalInt(GetModule(),"DARKSPAWN_DEAD"))
                  {
                                //Heal party members and stuff.
                                DoAutoSave();
                                CS_LoadCutscene(R"team4_intro.cut");
                  }
         } //right now this case fires multiple times as you reenter combat etc but obviously this
          //can be handled with another local variable
}

Everything works fine, except the autosave. As mentioned, also tried with EVENT_TYPE_COMBAT_END (Actually, on reflection, that did not work, the whole case never fired. However, I did try it with EVENT_TYPE_TEAM_DESTROYED directly before and the code did run there).

Also have a script that is set to run after the cutscene in the cutscene editor that simply goes:

DoAutoSave();
UT_TeamAppears(4);
UT_TeamGoesHostile(4);

Again, everything but the Autosave works.
          

Modifié par FergusM, 03 avril 2010 - 09:31 .


#6
Magic

Magic
  • Members
  • 187 messages
I'm sorry and out of ideas since I'm not familiar with the auto-save and the cutscene. Was just hoping to give the right pointer.



By the way, EVENT_TYPE_GAMEMODE_CHANGE is fired for many modes. GetEventInteger(ev,0) returns to new mode, and 1 the old one. module_core.nss has examples. Hopefully, someone else can help. Perhaps the cutscene is already running when trying to save due to the multiple calls, however.

#7
Craig Graff

Craig Graff
  • Members
  • 608 messages
Autosaves don't work from cutscene to fight. You can do conversation - autosave - fight, though.

#8
FergusM

FergusM
  • Members
  • 460 messages
Hah, I almost tried associating it with a line in a conversation but I convinced myself that it wouldn't work. :P

#9
FergusM

FergusM
  • Members
  • 460 messages
Okay, still not working. I'm doing the following:

Event type Gamemode change (or team destroyed) -> run conversation.
Conversation is just two blank lines. The speaker line is associated with the cutscene I want to play, the listener line is an end dialogue. The end dialogue line has the script for starting the second fight attached to it.
The script for starting the second fight is just:
DoAutoSave();
UT_TeamAppears(4);
UT_TeamGoesHostile(4);

Again, everything works except autosave; the cutscene plays at the right time, the enemies appear and attack, etc. But still no autosave.

I have two other parts where I go cutscene (wrapped in conversation) -> autosave -> fight, the only real difference is that the party enters those conversations not in combat. So the problem appears to be that the party is still 'in combat' before the new wave of enemies go hostile. Which doesn't make a lot of sense since I'm using gamemode change, which I presume fires when combat is over in this case.

Modifié par FergusM, 03 avril 2010 - 11:55 .


#10
FergusM

FergusM
  • Members
  • 460 messages
I tried running the conversation just from a trigger, and the autosave works fine. So definitely the problem is that the party is still in combat somehow even after the cutscene ends.

EDIT:
Tried the following absurd brute force, did not work.

                object[] everything = GetObjectsInArea(GetArea(oFollower2));
                int i;
                for (i = 0; i < GetArraySize(everything); i++)
                {
                    SetCombatState(everything[i],FALSE);
                }

Modifié par FergusM, 04 avril 2010 - 12:42 .


#11
Craig Graff

Craig Graff
  • Members
  • 608 messages
Sorry, I didn't notice that you said the cutscene/conversation is sandwiched by fights. If so, it still won't work. DoAutoSave only works in GM_EXPLORE, but Explore - Conversation - Combat is usually actually Explore - Conversation - Explore - Combat.

#12
FergusM

FergusM
  • Members
  • 460 messages
EDIT: Aha, SetGameMode(GM_EXPLORE); does the trick. Thanks for the explanation.

Modifié par FergusM, 04 avril 2010 - 12:59 .