Author Topic: And before bed.... 'cutscene woes'  (Read 444 times)

Legacy_TrekSL

  • Newbie
  • *
  • Posts: 35
  • Karma: +0/-0
And before bed.... 'cutscene woes'
« on: July 21, 2011, 01:42:23 am »


               Ok, this isn't really a cutscene, I didn't need a proper one. All that's meant to happen is:

Player enters area
FadeFromBlack
Player is made invisible and paralyzed
NPC walks over and talks to invisible player(the way it's set up it looks like a meeting of 3 guys)

End of conversation, player clicks 'end conv'
Fade to Black, player is jumped to another *area*
fade from black again
remove all effects, continue play.

Now, I thought that by not making a proper cutscene, I'd made it easy for myself, but apparently not.. would someone please take a look and see what I've done wrong? (The 'cutscene' works but when jumped out side, I can't for love nor money remove any effects, so I still have an invisible, paralyzed player)

void main()
{
object oTarget;
oTarget = GetObjectByTag("Marke");
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;

int DoOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));
if (DoOnce==TRUE) return;

SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);

 FadeFromBlack(oPC, FADE_SPEED_SLOWEST);
  effect eGhost = EffectCutsceneGhost();
  effect eImmobilize = EffectCutsceneImmobilize();
  effect eInvis = EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY);


  //ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, oPC);
  //ApplyEffectToObject(DURATION_TYPE_PERMANENT, eImmobilize, oPC);
  //ApplyEffectToObject(DURATION_TYPE_PERMANENT, eInvis, oPC);



AssignCommand(oTarget, ActionMoveToObject(oPC));

AssignCommand(oTarget, ClearAllActions());

AssignCommand(oTarget,ActionStartConversation(oPC, ""));

}


object oPC = GetPCSpeaker();

void jump();
void cutscene();
void main()
{
AssignCommand(oPC, cutscene());

AssignCommand(oPC, jump());


}


void jump()
{
object oTarget;
location lTarget;
oTarget = GetWaypointByTag("Player_jump");

lTarget = GetLocation(oTarget);


if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;

//AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionJumpToLocation(lTarget));
}

void cutscene()
{
FadeToBlack(oPC, FADE_SPEED_SLOWEST);
  effect eGhost = EffectCutsceneGhost();
  effect eImmobilize = EffectCutsceneImmobilize();
  effect eInvis = EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY);


  RemoveEffect(oPC, eGhost);
  RemoveEffect(oPC, eImmobilize);
  RemoveEffect(oPC, eInvis);
 FadeFromBlack(oPC, FADE_SPEED_SLOWEST);
 }
               
               

               
            

Legacy_TrekSL

  • Newbie
  • *
  • Posts: 35
  • Karma: +0/-0
And before bed.... 'cutscene woes'
« Reply #1 on: July 21, 2011, 01:43:13 am »


               should probably add these are two separate scripts. One is onEnter, the other is clled from a conversation line
               
               

               
            

Legacy__six

  • Hero Member
  • *****
  • Posts: 1436
  • Karma: +0/-0
And before bed.... 'cutscene woes'
« Reply #2 on: July 21, 2011, 01:54:00 am »


               I haven't really read through the scripts properly, but I believe your problem here is with the way you're removing effects. The variables you specify are actually creating new effects (with no target) and then trying to remove them from the PC. In order to actually remove an effect from the PC you have to grab that specific instance of the effect.

In other words something like this:

void clearfx(object target)
{   effect fx = GetFirstEffect(target);

    while(GetIsEffectValid(fx))
    {  
        RemoveEffect(target, fx);
        fx = GetNextEffect(target);
    }
}

The above function will remove all effects from the PC. The easiest way IMO to only remove specific effects is to create an object in your mod with a tag like "CutsceneFX", and assign the ApplyEffect command to it. Then, check for the tag of the effect creator in the effect removal loop, and remove only effects created by "CutsceneFX". Like so...

AssignCommand(GetObjectByTag("CutsceneFX"), ApplyEffect...

...

void clearCutscenefx(object target)
{   effect fx = GetFirstEffect(target);

    while(GetIsEffectValid(fx))
    {
        if(GetTag(GetEffectCreator(fx)) == "CutsceneFX") 
        {   RemoveEffect(target, fx);
            fx = GetNextEffect(target);
        }
    }
}
               
               

               


                     Modifié par _six, 21 juillet 2011 - 12:58 .
                     
                  


            

Legacy_TrekSL

  • Newbie
  • *
  • Posts: 35
  • Karma: +0/-0
And before bed.... 'cutscene woes'
« Reply #3 on: July 21, 2011, 02:19:39 am »


               I think I love you.. but as an aside.. what's project q? A gfx overhaul or a cep?
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
And before bed.... 'cutscene woes'
« Reply #4 on: July 21, 2011, 03:49:35 am »


               Q stands for quality. Project Q is a set of Haks that dramatically improves the look of NWN. Its the HAK base for anything I build these days in NWN. Six - being part of the core Q team - can explain it from the insider's point of view. Bt my point of view as a user of the HAKS is that Project Q is essential content that helps NWN look respectable despite its age.
               
               

               


                     Modifié par henesua, 21 juillet 2011 - 02:51 .
                     
                  


            

Legacy__six

  • Hero Member
  • *****
  • Posts: 1436
  • Karma: +0/-0
And before bed.... 'cutscene woes'
« Reply #5 on: July 21, 2011, 04:00:18 am »


               Well my sig links to the best place to learn about Q, I think. It's essentially a large package of content (so similar to CEP in a way) that both adds new content to the game and overhauls quite a bit of the standard content. A large amount of it we made specifically for the project and so can't be found elsewhere. But I'd rather people just had a play around with it to see than me advertising it.

Oh, and as for what the 'Q' stands for, much debate may be had about that. I believe our site has a highly uninformative disclaimer on it. Personally, I like to think it stands for quoddamodotative, because it is.

*idly wonders if anyone is a sad enough language nerd to understand the joke in that last sentence*
               
               

               


                     Modifié par _six, 21 juillet 2011 - 03:07 .
                     
                  


            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
And before bed.... 'cutscene woes'
« Reply #6 on: July 21, 2011, 01:46:12 pm »


               Since the effect's creator in essence the Area you should be able to do this:

void clearfx(object target)
{
     effect fx = GetFirstEffect(target);
     while(GetIsEffectValid(fx))
     {
          if (GetEffectCreator(fx) == GetArea(target))
               RemoveEffect(target, fx);
          fx = GetNextEffect(target);
      }
}

This should eliminate the need to create a special item that applies the effect.
               
               

               


                     Modifié par Pstemarie, 21 juillet 2011 - 12:54 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
And before bed.... 'cutscene woes'
« Reply #7 on: July 21, 2011, 09:01:41 pm »


               

Pstemarie wrote...

Since the effect's creator in essence the Area you should be able to do this:

void clearfx(object target)
{
     effect fx = GetFirstEffect(target);
     while(GetIsEffectValid(fx))
     {
          if (GetEffectCreator(fx) == GetArea(target))
               RemoveEffect(target, fx);
          fx = GetNextEffect(target);
      }
}

This should eliminate the need to create a special item that applies the effect.


Isn't the creator, by default, the module?

You could assign the creation of the effects to the area first and then do that though. Or replace GetArea(oTarget); with GetModule();.

This is one of those situations where I would assign the creation of the effects to something specific like an invisible object or what not and then check for that object as the creator. Or the area as long as I was sure I wouldn't assign any other effects to the area.
               
               

               


                     Modifié par GhostOfGod, 21 juillet 2011 - 08:07 .
                     
                  


            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
And before bed.... 'cutscene woes'
« Reply #8 on: July 22, 2011, 11:56:40 am »


               

GhostOfGod wrote...

Pstemarie wrote...

Since the effect's creator in essence the Area you should be able to do this:

void clearfx(object target)
{
     effect fx = GetFirstEffect(target);
     while(GetIsEffectValid(fx))
     {
          if (GetEffectCreator(fx) == GetArea(target))
               RemoveEffect(target, fx);
          fx = GetNextEffect(target);
      }
}

This should eliminate the need to create a special item that applies the effect.


Isn't the creator, by default, the module?


If the event is an area's OnEnter then the creator would be the area. If its the module's OnClientEnter then the creator would be the module.

There are numerous ways to accomplish things with nwscript. The trick is knowing what implementation to use for a given situation. If you plan on having the area assign more effects, by all means use an invisible to apply the effect to the entering PC. However, if it just applying the one effect then the invisible object becomes kind of unnecessary - and ultimately a wasted resource.