Aller au contenu

Photo

Yet another plead for scripting help...


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

#1
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
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.

#2
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<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 .


#3
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
 <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 .


#4
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
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.

#5
WhiZard

WhiZard
  • Members
  • 1 204 messages

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.

#6
AstoundingArcaneArcher

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

#7
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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.

#8
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
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);


}

#9
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<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 .


#10
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
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 .


#11
_Guile

_Guile
  • Members
  • 685 messages

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.. :D

#12
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
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 .


#13
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
Funny how it takes so long on here to get help...

#14
WhiZard

WhiZard
  • Members
  • 1 204 messages
SetCommandable(FALSE, oPlayer);

#15
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
Thank you!

#16
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
Anyway, here a new problem: the vfx are bring lazy and are not showing up, niether are the cutscene effects :(. Still using previous script as before. Plus, my test subject Adam Allswell is begining to feel the pain and is getting fed up (joke).

#17
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Hmm. Might have something to do with setting the "do once" variable. If the script is seeing the variable set, it already happened and wont finish the whole script again. Is this a single or multiplayer? You can temporarily comment out "//" that check for the do once variable for testing purposes. You should also comment out the line that sets the variable until you are done testing it. See if that gets it working again.

Modifié par GhostOfGod, 31 août 2011 - 12:46 .


#18
Fester Pot

Fester Pot
  • Members
  • 1 393 messages
The script works fine - I just tested it - from the paste above. Only fires once of course, strips the character, knocks them down, fires the speakstring and done.

FP!

#19
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
Which one? The one form the wuote above or the one unquoted from me?

#20
Fester Pot

Fester Pot
  • Members
  • 1 393 messages
The one you posted of course.

FP!

#21
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
Anways, there was meant to be bleeding vfx. They didn't turn up to the party.

Modifié par AstoundingArcaneArcher, 31 août 2011 - 05:10 .


#22
Fester Pot

Fester Pot
  • Members
  • 1 393 messages
It is showing up as soon as the script fires - in fact, they all fire all at the very same time, which may account for why you see some and not another.

You'll need to add a series of DelayCommand functions in the order in which you want each VFX to fire for them to display one after the other, rather than all at once.

Do you want the character to spasm twice and then show some blood?

Or have the character spasm once, show some blood and spasm again?

Then what fires after? Does the character fall on their face, followed by VFX_FNF_PWKILL or does that fire at the start of the script, followed by spasms and blood or one spasm, blood and a spasm?

Things to think about when putting such scripts together.

Once you know the order, add the DelayCommand function before applying each effect.

eVFX = EffectVisualEffect(VFX_COM_BLOOD_CRT_RED);
DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC));

The number represents how many seconds it will fire. So the next effect might be 5.0 or 2.0 or 3.0, all depending on how long the effect plays and the order in which you want each effect to display.

So after panning it out, your SpeakString line might not fire until 12.0 seconds.

DelayCommand(12.0, AssignCommand(oPC, ActionSpeakString("Ugh... Attacked... Mugged")));

Possibly followed by a few more effects.

eVFX = EffectVisualEffect(VFX_COM_BLOOD_LRG_RED);
DelayCommand(14.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC));

And finally applying the damage after all the blood and sparks have flown off.

// Cause damage.
DelayCommand(15.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC));

That's just an example of course. Your own script might have a delay longer or shorter, depending on your needs and how the visuals look once they have been played in a particular order.

FP!

Modifié par Fester Pot, 31 août 2011 - 01:06 .


#23
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
Thanks, the main problem with programming like this is that you are telling the computer wat to do in a weird language Thanks for help. I'll try it out and see if it works.

#24
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
Just a note on the DelayCommand() function - the timer is based off the script first firing, not since the last or some other command happened. So delayed 5.0 (seconds) means it will happen 5 seconds after the script itself is triggered.

#25
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
Visual effects are working fine to the mastery of DelayCommand. I'm just wondering how to cast the spell harm on the player (accounting for different amounts of HPs.) without having to miss since the spell does need a melee touch attack to hit for it to work. Countless times it has missed due to failing the roll. FYI, a placeable currently casts the spell. There must be blood with pain, dammit!