Author Topic: Yet another plead for scripting help...  (Read 659 times)

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« on: August 28, 2011, 04:12:13 pm »


               Hey guys,

Here's the problem: at the start of my module, when the player enters, I want the player to be bleeding to death (gory effects and all.) and a npc runs over and heal the player. I have little idea how to do this. I've look at some scripts on the NWN Wiki such as the nwn.wikia.com/wiki/NPC_Healer and nwn.wikia.com/wiki/Bleed_to_death and still have no idea on how to do this.

Grateful thanks, '=]'

AstoundingArcaneArcher.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #1 on: August 28, 2011, 04:30:26 pm »


               <leaking all over the place...>

To start with (IOW, without discussing the effects themselves), there are a couple things to think about. (Sorry for the pontification, writing with one hand, folding with the other :-P

Your script should be a part of your starting area's OnEnter script, rather than your module's - you want the player to be fully loaded and ready to go.

Second, particularly if you already have a standard OnEnter script, you should code the opening scene as a conditional - so it only fires once and then bows out of the way forever more. I would do it by setting the area with a bFirstTime integer set to TRUE, and, after the gore splatters, set bFirstTime to FALSE.

Hopefully, this is just the start of a long a profound thread which goes into details on the effects :-) I just wanted to be first! =)

<...in his scramble for ink & quill>
               
               

               


                     Modifié par Rolo Kipp, 28 août 2011 - 03:31 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #2 on: August 28, 2011, 04:49:33 pm »


                <thinking about...>

There is a whole bunch of good functions you can use (Here's a partial list) that might give you some ideas.

Also, there's great (if dated) cutscene tutorials.

So in the first few seconds after loading you want to:

  apply a harm effect to the pc
  add a little extra blood and screams and maybe some other effects...
  have an NPC that is in the area either cast a healing spell on the PC or use the healing skill...
  then start a conversation.

Is that about right?

<...whites & colors and how red bleeds into *everything*!>
               
               

               


                     Modifié par Rolo Kipp, 28 août 2011 - 03:50 .
                     
                  


            

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #3 on: August 28, 2011, 05:29:31 pm »


               Yep. But due to my hatred of cutscene abuse (playing too much Metal Gear Solid 4.) and I would rather this be simple as possible.I would rather it happen in-game. As with the effects, as much gore as realisticly possible.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #4 on: August 28, 2011, 05:38:00 pm »


               

AstoundingArcaneArcher wrote...

Yep. But due to my hatred of cutscene abuse (playing too much Metal Gear Solid 4.) and I would rather this be simple as possible.I would rather it happen in-game. As with the effects, as much gore as realisticly possible.


Quite possible to hold a player in place with a looping animation (typically animation_looping_dead_front or animation_looping_dead_back) and a cutscene immobilize effect.  Doesn't stop the player from looking at his own inventory during the healing.
               
               

               
            

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #5 on: August 28, 2011, 07:53:51 pm »


               I don't think a cutscene immobilze effect is really needed. You just could have the pc do the animation for a set duration.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #6 on: August 28, 2011, 08:10:49 pm »


               Why not just create a trigger around your starting point.   Have it set the PC's commandable state to false and load his Action que up with the animantions you want him to play and the vfx's.   At the same time load your Npc's action que with the action to move to the PC, What ever actions you want them to do loike saying something,  casting there spell,  making the PC commandable again and the last thing to add to the Npc's action que would be a clear all actions on the PC to stop him looking like a fool.
               
               

               
            

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #7 on: August 28, 2011, 09:30:12 pm »


               Thing is, you'll have to tell me how to do that script-wise. This is the script I'm using at the moment, generated by Lilac Soul's good old script generated.

/*
*  Script generated by LS Script Generator, v.TK.0
*
*  For download info, please visit:
*  http://nwvault.ign.c....Detail&id=1502
*/
// Put this script OnEnter.


void main()
{
   object oSpawn;
   effect eDamage;
   effect eVFX;
   int nCount;
   object oItem;

   // Get the creature who triggered this event.
   object oPC = GetEnteringObject();

   // Only fire for (real) PCs.
   if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )
       return;

   // Only fire once.
   if ( GetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF)) )
       return;
   SetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);

   // Relieve the PC of its possessions.
   oItem = GetFirstItemInInventory(oPC);
   while ( oItem != OBJECT_INVALID )
   {
       DestroyObject(oItem);
       oItem = GetNextItemInInventory(oPC);
   }

   // Relieve the PC of its equipment.
   nCount = NUM_INVENTORY_SLOTS;
   while ( nCount-- > 0 )
   {
       oItem = GetItemInSlot(nCount, oPC);
       DestroyObject(oItem);
   }

   // Relieve the PC of its gold.
   TakeGoldFromCreature(GetGold(oPC), oPC, TRUE);

   // Cutscene functions:
   BlackScreen(oPC);

   // Cutscene functions:
   StopFade(oPC);

   // Have the PC perform a sequence of actions.
   AssignCommand(oPC, ActionPlayAnimation(ANIMATION_FIREFORGET_SPASM));

   // Have the PC perform a sequence of actions.
   AssignCommand(oPC, ClearAllActions());
   AssignCommand(oPC, ActionPlayAnimation(ANIMATION_FIREFORGET_SPASM));
   AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 1.0, 5.0));
   AssignCommand(oPC, ActionSpeakString("Ugh... Attacked... Mugged"));
   AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 1.0, 5.0));

   // Apply a visual effect.
   eVFX = EffectVisualEffect(VFX_COM_BLOOD_CRT_RED);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);
   eVFX = EffectVisualEffect(VFX_FNF_PWKILL);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);
   eVFX = EffectVisualEffect(491);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);
   eVFX = EffectVisualEffect(VFX_COM_CHUNK_RED_SMALL);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);

   // Cause damage.
   eDamage = EffectDamage(d12(), DAMAGE_TYPE_SLASHING);
   eVFX = EffectVisualEffect(VFX_COM_BLOOD_LRG_RED);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX   , oPC);

   // Cutscene functions:
   BlackScreen(oPC);

   // Cutscene functions:
   StopFade(oPC);


}
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #8 on: August 29, 2011, 02:15:12 am »


               <looking confused...>

AstoundingArcaneArcher wrote...

Thing is, you'll have to tell me how to do that script-wise. This is the script I'm using at the moment, generated by Lilac Soul's good old script generated.
...

   // Have the PC perform a sequence of actions.
   AssignCommand(oPC, ActionPlayAnimation(ANIMATION_FIREFORGET_SPASM));

Double line... and not much chance to spasm before you clear it.
Would ClearAllActions stop a fire and forget anim?

   // Have the PC perform a sequence of actions.
   AssignCommand(oPC, ClearAllActions());
   AssignCommand(oPC, ActionPlayAnimation(ANIMATION_FIREFORGET_SPASM));
   AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 1.0, 5.0));
   AssignCommand(oPC, ActionSpeakString("Ugh... Attacked... Mugged"));
   AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 1.0, 5.0));

   // Apply a visual effect.
   eVFX = EffectVisualEffect(VFX_COM_BLOOD_CRT_RED);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);
   eVFX = EffectVisualEffect(VFX_FNF_PWKILL);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);
   eVFX = EffectVisualEffect(491);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);
   eVFX = EffectVisualEffect(VFX_COM_CHUNK_RED_SMALL);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);

   // Cause damage.
   eDamage = EffectDamage(d12(), DAMAGE_TYPE_SLASHING);
   eVFX = EffectVisualEffect(VFX_COM_BLOOD_LRG_RED);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX   , oPC);

   // Cutscene functions:
   BlackScreen(oPC);

   // Cutscene functions:
   StopFade(oPC);


}


Good start, I think :-)

You might either use a "harm" effect (so you don't kill the PC) or set the PC to immortal first... clear it later.

Also, you might mix the blood splatters in ahead of the PC speaking...

<...and talking confuseder>
               
               

               


                     Modifié par Rolo Kipp, 29 août 2011 - 01:16 .
                     
                  


            

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #9 on: August 29, 2011, 02:35:40 am »


               Thanks for the suggestion. It is noted. All I need to do now is to build on that script. The generator can be limiting sometimes... But harm effect is now up, so pcs beware! Heh.
               
               

               


                     Modifié par AstoundingArcaneArcher, 29 août 2011 - 01:50 .
                     
                  


            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #10 on: August 29, 2011, 02:16:33 pm »


               

AstoundingArcaneArcher wrote...

Yep. But due to my hatred of cutscene abuse (playing too much Metal Gear Solid 4.) and I would rather this be simple as possible.I would rather it happen in-game. As with the effects, as much gore as realisticly possible.


OFF-TOPIC

YOU are not alone in the hatred of cut-scene & movie modes, I'm so sick of game makers thinking that we like that stuff, when in fact, we don't!  But not enough people speak up about it.  It's ok to have them at critical points in the game for "maximum effect" but outside of that, they are largely overrated, an all too often clearly abused or overused.

Just saying, yeah, I completely hear you on that one.. '<img'>
               
               

               
            

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #11 on: August 29, 2011, 03:27:37 pm »


               Thanks for the support. I guess the only opening cutscene I liked in NWN was the Witch's Wake one since it was strictly in-game. Cutscenes, I think just bottleneck the story. It's the creator saying, "Ok, this really has to happen now and you can't do a thing abour it". But anyway, that's for another topic. I would like to be told how to set the pc's commable state to false, so no players interupt the bleeding and collapsing. Which would make no sense. Scripting emergency!
               
               

               


                     Modifié par AstoundingArcaneArcher, 29 août 2011 - 09:06 .
                     
                  


            

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #12 on: August 29, 2011, 10:07:53 pm »


               Funny how it takes so long on here to get help...
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #13 on: August 30, 2011, 01:45:04 am »


               SetCommandable(FALSE, oPlayer);
               
               

               
            

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #14 on: August 30, 2011, 08:07:01 pm »


               Thank you!