Aller au contenu

Photo

Yet another plead for scripting help...


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

#26
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
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 .


#27
AstoundingArcaneArcher

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


#28
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
Apologies for the messy paste. >.<

#29
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Need to capitalize the "p".

GetCurrentHitPoints

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


#30
_Knightmare_

_Knightmare_
  • Members
  • 643 messages

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 .


#31
AstoundingArcaneArcher

AstoundingArcaneArcher
  • Members
  • 70 messages
Just another example of how the script editor totally pukes on you for misspelled words. Cheers.