And before bed.... 'cutscene woes'
#1
Posté 21 juillet 2011 - 12:42
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);
}
#2
Posté 21 juillet 2011 - 12:43
#3
Posté 21 juillet 2011 - 12:54
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 .
#4
Posté 21 juillet 2011 - 01:19
#5
Posté 21 juillet 2011 - 02:49
Modifié par henesua, 21 juillet 2011 - 02:51 .
#6
Posté 21 juillet 2011 - 03:00
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 .
#7
Posté 21 juillet 2011 - 12:46
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 .
#8
Posté 21 juillet 2011 - 08:01
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 .
#9
Posté 22 juillet 2011 - 10:56
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.





Retour en haut






