Aller au contenu

Photo

LoadCutscene() function w/dynamic actors in cutscene?


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

#1
techwench

techwench
  • Members
  • 79 messages
So...reading the lexicon, would I be able to dynamically replace actors in a cutscene with LoadCutscene()?

For example, let's say I place Zathrian in a cutscene and animate him, etc...but then I have a script that runs a check against NTB_MAIN_ZATHRIAN_SACRIFICES_HIMSELF and NTB_MAIN_ZATHRIAN_KILLED_BY_PC, and if either of these return true, I could use LoadCutscene() to replace him with Lanaya (keeping the same animations/keyframes, etc)?

Maybe something like...

if (NTB_MAIN_ZATHRIAN_SACRIFICES_HIMSELF || NTB_MAIN_ZATHRIAN_KILLED_BY_PC) {
     resource rCutscene = R"cutscene.cut";
     object oHero = GetHero();
     object oLanaya = UT_GetNearestCreatureByTag(oHero, "ntb100cr_lanaya");
     LoadCutscene(rCutscene, oHero, 1, "ntb100cr_zathrian", oLanaya);
}

#2
Sunjammer

Sunjammer
  • Members
  • 925 messages
Nearly however:
  • aTargetTagsToReplace has to be an array of strings (even if you're only replacing 1 actor)
  • aReplacementObjects has to be an array of objects (again even if you're only replacing 1 actor)
Also the final parameter isn't optional so you must remember to add a TRUE or FALSE as the final parameter.

In any event your script should look a little more like this:
    if(NTB_MAIN_ZATHRIAN_SACRIFICES_HIMSELF || NTB_MAIN_ZATHRIAN_KILLED_BY_PC) 
    {
        resource rCutscene = R"cutscene.cut";
        object oHero = GetHero();
        
        // create and populate an array of tags to be replaced
        string[] aTargetTagsToReplace;
        aTargetTagsToReplace[0] = "ntb100cr_zathrian"; 
           
        // create and populate an array of objects to use as replacements
        object[] aReplacementObjects;
        aReplacementObjects[0] = UT_GetNearestCreatureByTag(oHero, "ntb100cr_lanaya");
         
        // load and play the cutscene with the appropriate replacements
        LoadCutscene(rCutscene, oHero, TRUE, aTargetTagsToReplace, aReplacementObjects, TRUE);
    }

Modifié par Sunjammer, 22 décembre 2010 - 01:32 .


#3
techwench

techwench
  • Members
  • 79 messages
Ah. Very cool. I haven't gotten that far yet (um...minor setbacks heh) but I'm making a mental note of it and will give it a shot when I get to that point. Thanks!

#4
techwench

techwench
  • Members
  • 79 messages
I just ran a very quick and dirty test of this, and it worked...I just had to move Lanaya from the cutscene to the area and leave her inactive. Thanks again, Sunjammer!