Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

force restrict force

Page: 1 of 1
 Darth Essence
04-19-2007, 10:33 AM
#1
so .. the idea .. how do i make a force power restrict the use of the force to the target while the effect lasts? pretty much appreciated .. :)

And while youre at it .. could someone tell me how can i set a timer for a script ... dah .. for example ... a force power .. visual effect at the beginning ... the same visual effect after 30 seconds (force effect ends) ... ? even more pretty much appreciated :)

EDIT: Thank you so much ... :)
 stoffe
04-19-2007, 12:26 PM
#2
so .. the idea .. how do i make a force power restrict the use of the force to the target while the effect lasts? pretty much appreciated .. :)

And while youre at it .. could someone tell me how can i set a timer for a script ... dah .. for example ... a force power .. visual effect at the beginning ... the same visual effect after 30 seconds (force effect ends) ... ?

Hi,

Something like this might work to use as an impact script for such a spell. It also includes an example of your second question, using the DelayCommand() function to delay something for a set amount of seconds (in this case applying a visual effect when the force effect should end).


int ST_ResistForce(object oTarget);
int ST_SavingThrows(object oTarget, int nSaveType, int nSaveCat = SAVING_THROW_TYPE_ALL, int nDC = 0);


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// MAIN FUNCTION
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void main() {
object oTarget = GetSpellTargetObject();

// ST: Inform the victim a hostile force power was used on them.
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), TRUE));

// ST: The Power was resisted, don't do anything...
if (ST_ResistForce(oTarget)) {
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceFizzle(), OBJECT_SELF);
return;
}

// ST: Set duration... 30 on a failed save, half if successful.
float fDur = ( !ST_SavingThrows(oTarget, SAVING_THROW_WILL) ? 30.0 : 15.0 );

effect eRegen = EffectFPRegenModifier(0);
effect eDrain = EffectDamageForcePoints(GetCurrentForcePoints(oTarget));
effect eVisFx = EffectVisualEffect(VFX_IMP_SUPPRESS_FORCE);

// ST: Drain force pool and reduce regeneration
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eRegen, oTarget, fDur);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDrain, oTarget);

// Play visual effect at the start and end of the effect.
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisFx, oTarget);
DelayCommand(fDur, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisFx, oTarget));

}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// SUPPORT FUNCTIONS
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

// ST: Check for Force Resistance
int ST_ResistForce(object oTarget) {
if(ResistForce(OBJECT_SELF, oTarget)) {
DisplayFeedBackText(oTarget, 0);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceResisted(OBJECT_SELF), oTarget);
return TRUE;
}
return FALSE;
}


// ST: Do saving throw check
int ST_SavingThrows(object oTarget, int nSaveType, int nSaveCat = SAVING_THROW_TYPE_ALL, int nDC = 0) {
nDC = (nDC > 0 ? nDC : GetSpellSaveDC());

// ST: Modifiers due to force user's form
if (IsFormActive( OBJECT_SELF, FORM_FORCE_IV_MASTERY ))
nDC += 2;

// ST: Modifiers due to target's form
if (IsFormActive( oTarget, FORM_SABER_II_MAKASHI ) || IsFormActive( oTarget, FORM_FORCE_I_FOCUS ))
nDC -= 2;
else if (IsFormActive( oTarget, FORM_SABER_VI_NIMAN ))
nDC -= 1;
else if (IsFormActive( oTarget, FORM_SABER_VII_JUYO ) || IsFormActive( oTarget, FORM_FORCE_IV_MASTERY ))
nDC += 4;

nDC = (nDC < 1 ? 1 : nDC);

int nSave;
switch (nSaveType) {
case SAVING_THROW_FORT: nSave = FortitudeSave(oTarget,nDC, nSaveCat); break;
case SAVING_THROW_REFLEX: nSave = ReflexSave(oTarget, nDC, nSaveCat); break;
case SAVING_THROW_WILL: nSave = WillSave(oTarget, nDC, nSaveCat); break;
}

if (nSave > 0) {
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceResisted(OBJECT_SELF), oTarget);

if (nSave == 1)
DisplayFeedBackText(oTarget, 2);
else if (nSave == 2)
DisplayFeedBackText(oTarget, 1);
}
return nSave;
}
 Darth Essence
04-19-2007, 3:12 PM
#3
aam .. sorry .. but the 'EffectFPRegenModifier(0)' thingy kinda doesnt work ... *confused* ...
 stoffe
04-19-2007, 4:33 PM
#4
aam .. sorry .. but the 'EffectFPRegenModifier(0)' thingy kinda doesnt work ... *confused* ...

It's an effect that only exists in KOTOR2:TSL, which I assume people are talking about if they don't say which game it is for. :)

Can't be done as easily for KOTOR1 as far as I know, since I don't think you can modify the Force Regeneration rate of a character in that game. You'd have to run a loop or recursive function each second that nukes their force pool instead, and hope they haven't managed to regenerate enough in that time to use a power. Something like this might work:


int ST_ResistForce(object oTarget);
int ST_SavingThrows(object oTarget, int nSaveType, int nSaveCat = SAVING_THROW_TYPE_ALL, int nDC = 0);


void ST_KillForcePoints(object oTarget, float fDur) {
if ((fDur > 0.0) && GetIsEnemy(oTarget) && !GetIsDead(oTarget)) {
// ST: Drain force pool
effect eDrain = EffectDamageForcePoints( GetCurrentForcePoints(oTarget) );
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDrain, oTarget);

DelayCommand(1.0, ST_KillForcePoints(oTarget, fDur - 1.0));
}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// MAIN FUNCTION
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void main() {
object oTarget = GetSpellTargetObject();

SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), TRUE));

// The Power was resisted, don't do anything...
if (ST_ResistForce(oTarget)) {
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceFizzle(), OBJECT_SELF);
return;
}

// ST: Set duration... 30 on a failed save, half if successful.
float fDur = ( !ST_SavingThrows(oTarget, SAVING_THROW_WILL) ? 30.0 : 15.0 );

effect eVisFx = EffectVisualEffect(VFX_IMP_SUPPRESS_FORCE);

// ST: Continually drain the force pool of target for the duration of the power.
ST_KillForcePoints(oTarget, fDur);

// Play visual effect at the start and end of the effect.
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisFx, oTarget);
DelayCommand(fDur, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisFx, oTarget));

}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// SUPPORT FUNCTIONS
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

// Check for Force Resistance
int ST_ResistForce(object oTarget) {
if(ResistForce(OBJECT_SELF, oTarget)) {
DisplayFeedBackText(oTarget, 0);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceResisted(OBJECT_SELF), oTarget);
return TRUE;
}
return FALSE;
}


// Do saving throw check
int ST_SavingThrows(object oTarget, int nSaveType, int nSaveCat = SAVING_THROW_TYPE_ALL, int nDC = 0) {
nDC = (nDC > 0 ? nDC : GetSpellSaveDC());
nDC = (nDC < 1 ? 1 : nDC);

int nSave;
switch (nSaveType) {
case SAVING_THROW_FORT: nSave = FortitudeSave(oTarget,nDC, nSaveCat); break;
case SAVING_THROW_REFLEX: nSave = ReflexSave(oTarget, nDC, nSaveCat); break;
case SAVING_THROW_WILL: nSave = WillSave(oTarget, nDC, nSaveCat); break;
}


if (nSave > 0) {
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceResisted(OBJECT_SELF), oTarget);

if (nSave == 1)
DisplayFeedBackText(oTarget, 2);
else if (nSave == 2)
DisplayFeedBackText(oTarget, 1);
}
return nSave;
}
 Darth Essence
04-20-2007, 8:55 AM
#5
It's an effect that only exists in KOTOR2:TSL, which I assume people are talking about if they don't say which game it is for. :)

yees ... i'm very sorry .. guess i was so frustrated that i completely forgot to tell that it is for TSL ... and that is the problem ...
Page: 1 of 1