I am not very good at scripting but I finally compiled an animation script I have a few questions I want to replace the Animation of existing passive force power with a new default animation to make a new power. How would I combine these two scripts below .Also is there anyway to restrict the usage of force powers in the same manner, that items can be restricted to a specify character or Gender?
Also, how could I assign the animation to a armband?
Here are the Scripts
Twilek Dance Animation
void main()
{
object oPlayer = GetFirstPC();
float fDuration = 10.0f; // 100s
AssignCommand (oPlayer, ClearAllActions());
AssignCommand (oPlayer,ActionPlayAnimation(ANIMATION_LOOPING_DAN CE1, 1.0,-1.0));
}
Heal
/*
HEAL
*/
//MODIFIED by Preston Watamaniuk March 28
//Cut the heal in half
case FORCE_POWER_HEAL:
{
SWFP_HARMFUL = FALSE;
int nHeal = GetAbilityModifier(ABILITY_WISDOM) + GetAbilityModifier(ABILITY_CHARISMA) + 10 + GetHitDice(OBJECT_SELF);
effect eVis = EffectVisualEffect(VFX_IMP_HEAL);
int nCnt = 0;
object oParty;
if(IsObjectPartyMember(OBJECT_SELF))
{
oParty = GetPartyMemberByIndex(nCnt);
}
else
{
oParty = OBJECT_SELF;
}
while(nCnt < 3)
{
if(GetIsObjectValid(oParty) &&
GetRacialType(oParty) != RACIAL_TYPE_DROID &&
GetDistanceBetween(OBJECT_SELF, oParty) < 15.0)
{
SignalEvent(oParty, EventSpellCastAt(OBJECT_SELF, GetSpellId(), SWFP_HARMFUL));
Sp_RemoveSpecificEffect(EFFECT_TYPE_POISON, oParty);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oParty);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(nHeal), oParty);
}
nCnt++;
if(IsObjectPartyMember(OBJECT_SELF))
{
oParty = GetPartyMemberByIndex(nCnt);
}
else
{
oParty = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_FRIEND, OBJECT_SELF, nCnt, CREATURE_TYPE_RACIAL_TYPE, RACIAL_TYPE_HUMAN);
}
}
}
I want to replace the Animation of existing passive force power with a new default animation to make a new power.
I'm not sure I understand what you mean by this? What animation do you want to replace?
How would I combine these two scripts below.
Make a healing dance of the Heal script and dance action script? Something like this would probably work...
void main() {
object oTarget = GetSpellTargetObject();
if (GetRacialType(oTarget) == RACIAL_TYPE_DROID)
return;
int nHeal = GetAbilityModifier(ABILITY_WISDOM) + GetAbilityModifier(ABILITY_CHARISMA) + 10 + GetHitDice(OBJECT_SELF);
effect eVis = EffectVisualEffect(VFX_IMP_HEAL);
effect eHeal = EffectHeal(nHeal);
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));
effect eEff = GetFirstEffect(oTarget);
while (GetIsEffectValid(eEff)) {
if (GetEffectType(eEff) == EFFECT_TYPE_POISON)
RemoveEffect(oTarget, eEff);
eEff = GetNextEffect(oTarget);
}
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget);
AssignCommand(oTarget, ClearAllActions());
AssignCommand(oTarget, ActionPlayAnimation(ANIMATION_LOOPING_DANCE1, 1.0, 10.0));
}
Where you just combine the relevant parts from both scripts and make some slight adjustments to make them work together.
Note however that there is nothing preventing the target of the power from aborting the dance action and doing something else by clearing their action queue if you just combine things like this.
Also is there anyway to restrict the usage of force powers in the same manner, that items can be restricted to a specify character or Gender?
Not to prevent them from being cast alltogether, unless you want to prevent the character of a specific gender from being able to pick the power at levelup. (This could probably be done by giving the power a passive prerequisite power that you give automatically to all characters of a specific gender in their AI Scripts. Then only those who have that power as the prerequisite to pick the power at levelup.)
The best you can do to restrict its use is to put in a condition in the impact script of the power that checks the gender of the caster and if it's an invalid gender for the purpose of the power you refund the force-points they spend on casting the power and skip the rest of the script. Note that the impact script is run after the power is cast though, so you won't prevent them from using it, the power just won't do anything if the conditions aren't met.
Also, how could I assign the animation to a armband?
The Dance animation? You could make a simple spell that just makes the object running the script do a dance animation with PlayAnimation(). Then you assign the spell as a "Cast Spell" property on an item (UTI template) after you've added it to spells.2da. Then the spell/power will be activated when the item is used.
Hm Yeah that might work ,Basically wanted to create a Healing +Dance Script