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

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #15 on: August 31, 2011, 12:57:40 am »


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

               
            

Legacy_GhostOfGod

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


               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 .
                     
                  


            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #17 on: August 31, 2011, 02:01:28 am »


               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!
               
               

               
            

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #18 on: August 31, 2011, 03:30:00 am »


               Which one? The one form the wuote above or the one unquoted from me?
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #19 on: August 31, 2011, 04:06:47 am »


               The one you posted of course.

FP!
               
               

               
            

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #20 on: August 31, 2011, 04:21:26 am »


               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 .
                     
                  


            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #21 on: August 31, 2011, 01:58:04 pm »


               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 .
                     
                  


            

Legacy_AstoundingArcaneArcher

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


               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.
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #23 on: August 31, 2011, 11:08:49 pm »


               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.
               
               

               
            

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #24 on: August 31, 2011, 11:45:10 pm »


               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!
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #25 on: September 01, 2011, 12:01:32 am »


               Do you need to cast the Harm spell at them? You could just script in damage to them a bring them down to a few hit points left. Example is the following which should leave them with 2 hitpoints remaining:

int nHPs = GetMaxHitPoints(oPC); // Get PC's max Hitpoint total
effect eDamage = EffectDamage(nHPs - 2); // Damage = max Hitpoints - 2
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC); // Apply damage

As alternate, you could replace the first line there with:

int nHPs = GetCurrentHitPoints(oPC); // Get PC's current Hitpoint total

That way you won't kill them if they are already damaged.
               
               

               


                     Modifié par _Knightmare_, 01 septembre 2011 - 02:40 .
                     
                  


            

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #26 on: September 01, 2011, 12:16:45 am »


               int nHPs = GetCurrentHitpoints(oPC); // Get PC's current Hitpoint total
With this line I get a ERROR: PARSING VARIABLE LIST.

Current script:

/*   Script generated byLilac Soul's NWN Script Generator, v. 2.3
For download info, please visit:http://nwvault.ign.com/View.php?view=Other.Detail&id=4683&id=625    */
//Put this script OnEntervoid main(){
effect eVFX;
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
int DoOnce = GetLocalInt(oPC, GetTag(OBJECT_SELF));
if (DoOnce==TRUE) return;
SetLocalInt(oPC, GetTag(OBJECT_SELF), TRUE);
object oItem;oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))   {   if (GetPlotFlag(oItem))      SetPlotFlag(oItem, FALSE);
   DestroyObject(oItem);
   oItem = GetNextItemInInventory(oPC);   }
int nInt;for (nInt=0; nInt<NUM_INVENTORY_SLOTS; nInt++)   {   oItem = GetItemInSlot(nInt, oPC);
   if (GetPlotFlag(oItem))         SetPlotFlag(oItem, FALSE);
   DestroyObject(oItem);   }
AssignCommand(oPC, TakeGoldFromCreature(GetGold(oPC), oPC, TRUE));
SetCutsceneMode(oPC, TRUE);
FadeFromBlack(oPC, FADE_SPEED_SLOW);
eVFX = EffectVisualEffect(VFX_COM_BLOOD_CRT_RED);DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC));
// Apply a visual effect.    eVFX = EffectVisualEffect(491);    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);    DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC));
// Apply a visual effect.    eVFX = EffectVisualEffect(VFX_COM_BLOOD_LRG_RED);    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);    DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC));

AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_SPASM, 1.0f, 5.0f));
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 1.0f, 15.0f));
AssignCommand(oPC, ActionSpeakString("Ugh...Mugged..."));
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 1.0f, 15.0f));
object oTarget;oTarget = oPC;
// Apply a visual effect.    eVFX = EffectVisualEffect(491);    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);    DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC));
// Apply a visual effect.    eVFX = EffectVisualEffect(VFX_COM_BLOOD_LRG_RED);    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);    DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC));
SetCutsceneMode(oPC, FALSE);
int nHPs = GetCurrentHitpoints(oPC); // Get PC's current Hitpoint totaleffect eDamage = EffectDamage(nHPs - 2); // Damage = max Hitpoints - 2ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC); // Apply damage
}
               
               

               


                     Modifié par AstoundingArcaneArcher, 31 août 2011 - 11:18 .
                     
                  


            

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #27 on: September 01, 2011, 02:59:05 am »


               Apologies for the messy paste. >.<
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #28 on: September 01, 2011, 03:14:20 am »


               Need to capitalize the "p".

GetCurrentHitPoints
               
               

               


                     Modifié par GhostOfGod, 01 septembre 2011 - 02:25 .
                     
                  


            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Yet another plead for scripting help...
« Reply #29 on: September 01, 2011, 03:36:54 am »


               

GhostOfGod wrote...

Need to capitalize the "p".

GetCurrentHitPoints



Oops my bad, sorry for the typo there. Editied last post to correct that in case somebody else wanders by and sees it.
               
               

               


                     Modifié par _Knightmare_, 01 septembre 2011 - 02:41 .