Darth Balor Posted September 25, 2006 Share Posted September 25, 2006 hi guys im working on a new force power based of the for choke anyone power made by darth333 and tlk. i have everthing except the script i cant seem to get it right. When using the power the charecter acts like she is going to zap you but the choke glow apears but no attack. here it the script: /*********************** Force Lighting Anyone by Darth Balor v1.0 ************************/ #include "k_inc_force" int FORCE_POWER_LIGHTINGF = 335; void RepeatingDamage(effect eDamage, int nSecondsRemaining, int nDamage, object oTarget, object oCaster); void main() { effect eVFXShock=EffectVisualEffect(VFX_IMP_SHOCK); effect eShock=EffectShock(); eShock=ExtraordinaryEffect(eShock); int nDamage=GetHitDice(OBJECT_SELF)*2/3; effect eDamage=EffectDamage(nDamage,DAMAGE_TYPE_BLUDGEONING); effect eAttrib_Link=EffectAbilityDecrease(ABILITY_CONSTITUTION,4); eAttrib_Link=EffectLinkEffects(eAttrib_Link, EffectAbilityDecrease(ABILITY_STRENGTH, 4)); eAttrib_Link=EffectLinkEffects(eAttrib_Link, EffectAbilityDecrease(ABILITY_DEXTERITY, 4)); effect eLink1=EffectAbilityIncrease(ABILITY_CHARISMA, 4); eLink1 = EffectLinkEffects(eLink1, EffectAbilityIncrease(ABILITY_INTELLIGENCE, 4)); eLink1 = EffectLinkEffects(eLink1, EffectAbilityIncrease(ABILITY_WISDOM, 4)); object oClosest; object oPC=GetFirstPC(); object oPC2=GetPartyMemberByIndex(1); object oPC3=GetPartyMemberByIndex(2); float fMaxDistance=8.0; float fClosestDistance=fMaxDistance; location lPC=GetLocation(OBJECT_SELF); object oThisTarget; float fThisDistance; // first we look for the nearest living, non-party member oThisTarget=GetFirstObjectInShape( SHAPE_SPHERE, fMaxDistance, lPC, TRUE, OBJECT_TYPE_CREATURE ); while (GetIsObjectValid(oThisTarget)) { if ((oThisTarget!=oPC) && (oThisTarget!=oPC2) && (oThisTarget!=oPC3) && (GetRacialType(oThisTarget)!=RACIAL_TYPE_DROID) && (!GetIsPuppet(oThisTarget))&& (!GetIsDead(oThisTarget)) ) { fThisDistance=GetDistanceBetween(OBJECT_SELF,oThisTarget); if (fThisDistance<fClosestDistance) { fClosestDistance=fThisDistance; oClosest=oThisTarget; } } oThisTarget = GetNextObjectInShape( SHAPE_SPHERE, fMaxDistance, lPC, TRUE, OBJECT_TYPE_CREATURE ); } if (!GetIsObjectValid(oClosest)) { return ; } void RepeatingDamage(effect eDamage, int nSecondsRemaining, int nDamage, object oTarget, object oCaster) { if(GetIsObjectValid(oTarget)) { if(!GetIsConversationActive() && !GetIsDead(oTarget) && !IsObjectPartyMember(oTarget)) { if(nSecondsRemaining % 2 == 0) { if (GetCurrentHitPoints(oTarget)<=nDamage) { // creature about to die... if (GetGoodEvilValue(oCaster)>25) {AdjustAlignment(oCaster,ALIGNMENT_DARK_SIDE,5);} } ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget); } --nSecondsRemaining; if(nSecondsRemaining > 0) { DelayCommand(1.0f, RepeatingDamage(eDamage, nSecondsRemaining, nDamage, oTarget, oCaster)); } else { if (GetGoodEvilValue(oCaster)>25) {AdjustAlignment(oCaster,ALIGNMENT_DARK_SIDE,5);} } } } } Link to comment Share on other sites More sharing options...
stoffe Posted September 25, 2006 Share Posted September 25, 2006 There were a few oddities in that script from what I could see: The FORCE_POWER_LIGHTINGF global variable is declared but never used anywhere, and is thus unneccesary. EffectShock() is not a standard script function, and you are never declaring it anywhere as a custom function from what I can see. If you want to create a lightning beam effect you should use EffectBeam() instead. The part that looks like: object oPC=GetFirstPC(); object oPC2=GetPartyMemberByIndex(1); object oPC3=GetPartyMemberByIndex(2); ...is unreliable, since the main character can be present in any of the party member slots depending on what character the player is currently controlling, You should probably use GetPartyMemberByIndex(0); as the first assignment. But then you could just use IsObjectPartyMember() instead to check if the object is a member of the player's party. You are implementing the function RepeatingDamage() inside the main() function. AFAIK NWScript does not support local functions. You are also never calling this function from anywhere. All your script currently do it pick out the nearest creature to the caster, but doesn't do anything with that creature. You never apply any effects to it. If you just want to apply damage to the victim when the lightning hits you don't need this function anyway, it's meant to apply damage over time, like with the choke/kill powers. VFX_IMP_SHOCK, used as function parameter to EffectVisualEffect(), is not a valid constant or defined variable. (You also used Bludgeoning damage instead of Electrical, but that's not really a scripting error ) Fixing those things the script might look something like: #include "k_inc_force" void main() { int nDamage = GetHitDice(OBJECT_SELF) * 2 / 3; effect eShock = EffectBeam(VFX_BEAM_LIGHTNING_DARK_L, OBJECT_SELF, BODY_NODE_HAND); effect eDamage = EffectDamage(nDamage, DAMAGE_TYPE_ELECTRICAL); eDamage = EffectLinkEffects(eDamage, EffectVisualEffect(VFX_PRO_LIGHTNING_L)); effect eAttrib_Link = EffectAbilityDecrease(ABILITY_CONSTITUTION,4); eAttrib_Link = EffectLinkEffects(eAttrib_Link, EffectAbilityDecrease(ABILITY_STRENGTH, 4)); eAttrib_Link = EffectLinkEffects(eAttrib_Link, EffectAbilityDecrease(ABILITY_DEXTERITY, 4)); effect eLink1 = EffectAbilityIncrease(ABILITY_CHARISMA, 4); eLink1 = EffectLinkEffects(eLink1, EffectAbilityIncrease(ABILITY_INTELLIGENCE, 4)); eLink1 = EffectLinkEffects(eLink1, EffectAbilityIncrease(ABILITY_WISDOM, 4)); object oClosest, oThisTarget; float fMaxDistance = 8.0; float fClosestDistance = fMaxDistance; location lPC = GetLocation(OBJECT_SELF); float fThisDistance; // first we look for the nearest living, non-party member oThisTarget = GetFirstObjectInShape(SHAPE_SPHERE, fMaxDistance, lPC, TRUE); while (GetIsObjectValid(oThisTarget)) { if (!IsObjectPartyMember(oThisTarget) && (GetRacialType(oThisTarget)!= RACIAL_TYPE_DROID) && !GetIsPuppet(oThisTarget) && !GetIsDead(oThisTarget)) { fThisDistance = GetDistanceBetween(OBJECT_SELF, oThisTarget); if (fThisDistance < fClosestDistance) { fClosestDistance = fThisDistance; oClosest = oThisTarget; } } oThisTarget = GetNextObjectInShape(SHAPE_SPHERE, fMaxDistance, lPC, TRUE); } if (GetIsObjectValid(oClosest)) { ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eShock, oClosest, 1.0); ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oClosest); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eAttrib_Link, oClosest, 12.0); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink1, OBJECT_SELF, 12.0); } } This is something of a "super force power" though since it'll go straight trough any force resistance the victim might have, and it offers to saving throw to avoid or lessen its effects. Those checks are not too hard to add on though if you want to make it work like the other force powers in the game does. As it currently is though you are not using anything from the k_inc_force include file and might as well remove that line. Link to comment Share on other sites More sharing options...
Darth Balor Posted September 25, 2006 Author Share Posted September 25, 2006 whoah thanks i see where i messed up Link to comment Share on other sites More sharing options...
goldberry Posted September 25, 2006 Share Posted September 25, 2006 That script is brilliant. I've replaced the d3_choke.ncs with this script renamed to have the same name. It's the best way to kill everyone on Citadel Station. I would release it in a mod, but it's clear that Darth Balor intends to do just that... so i won't Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.