Author Topic: "Dance Of Doom" spell-script woes...  (Read 860 times)

Legacy_Monsieur T

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
"Dance Of Doom" spell-script woes...
« on: March 05, 2012, 07:00:31 pm »


               I wonder if anyone would be kind enough to take a look at the mess I've made of a custom spell script, and show me why I get an "Unknown State In Compiler" error, or if the script is so bad that it's unusable.


///////////////////////////////////////////////////
// Dance Of Doom
// pt_dancedoom.nss
//
// The victim loses 3pts of Con for 2 minutes and
// has to perform a very silly dance.
//
///////////////////////////////////////////////////

/// The Unequip-Dance-Equip Function (taken from ShadowM's hr_speak file)

void EmoteDance(object oTarget)
{
object oRightHand = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oTarget);
object oLeftHand =  GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oTarget);
AssignCommand(oTarget,ActionUnequipItem(oRightHand));
AssignCommand(oTarget,ActionUnequipItem(oLeftHand));
AssignCommand(oTarget,ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY2,1.0));
//AssignCommand(oTarget,ActionDoCommand(PlayVoiceChat(VOICE_CHAT_LAUGH,oPC)));
AssignCommand(oTarget,ActionPlayAnimation( ANIMATION_LOOPING_TALK_LAUGHING, 2.0, 2.0));
AssignCommand(oTarget,ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY1,1.0));
AssignCommand(oTarget,ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY3,2.0));
AssignCommand(oTarget,ActionPlayAnimation( ANIMATION_LOOPING_GET_MID, 3.0, 1.0));
AssignCommand(oTarget,ActionPlayAnimation( ANIMATION_LOOPING_TALK_FORCEFUL,1.0));
AssignCommand(oTarget,ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY2,1.0));
//AssignCommand(oTarget,ActionDoCommand(PlayVoiceChat(VOICE_CHAT_LAUGH,oPC)));
AssignCommand(oTarget,ActionPlayAnimation( ANIMATION_LOOPING_TALK_LAUGHING, 2.0, 2.0));
AssignCommand(oTarget,ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY1,1.0));
AssignCommand(oTarget,ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY3,2.0));
//AssignCommand(oTarget,ActionDoCommand(PlayVoiceChat(VOICE_CHAT_LAUGH,oPC)));
AssignCommand(oTarget,ActionPlayAnimation( ANIMATION_LOOPING_GET_MID, 3.0, 1.0));
AssignCommand(oTarget,ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY2,1.0));
AssignCommand(oPC,ActionDoCommand(ActionEquipItem(oLeftHand,INVENTORY_SLOT_LEFTHAND)));
AssignCommand(oPC,ActionDoCommand(ActionEquipItem(oRightHand,INVENTORY_SLOT_RIGHTHAND)));
}

/// The main function for the spell's impact script

void main()
{

    //Declare major variables
    object oTarget = GetSpellTargetObject();
    int nDuration = 2;
    int nLoss     = 3;
    effect eVis  = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);
    effect eFeeb = EffectAbilityDecrease(ABILITY_CONSTITUTION, nLoss);
    effect eVis1 = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
    // maybe add a knockdown later on
    //effect eTrip = EffectKnockdown();
    effect eLink1 = EffectLinkEffects(eFeeb, eVis1);

    //Fire cast spell at event for the specified target
    //1536 is spells 2da number for Dance of Doom
    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, 1536));

    //Apply the VFX impact and effects
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink1, oTarget, TurnsToSeconds(nDuration));
    EmoteDance(object oTarget);
}

Any help will be very much appreciated,
Many thanks,
PT
               
               

               
            

Legacy_Alex Warren

  • Sr. Member
  • ****
  • Posts: 326
  • Karma: +0/-0
"Dance Of Doom" spell-script woes...
« Reply #1 on: March 05, 2012, 07:14:58 pm »


               Instead of:
EmoteDance(object oTarget);
put:
EmoteDance(oTarget);

and replace oPC with oTarget in EmoteDance() function.
               
               

               
            

Legacy_Monsieur T

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
"Dance Of Doom" spell-script woes...
« Reply #2 on: March 10, 2012, 01:45:01 am »


               Thanks, Alex, for your help - it worked perfectly!
However, I have found that the targeted PC can simply click the screen and end the dance animation. Is there some way to force the animations to play out?
If this means using cut-scene stuff then I'm going to die inside, since I don't understand all that stuff!
Here's hoping for an easier answer, if you or anyone else on the forum would be so kind!
If it's any help, perhaps I should say that this is an NPC-only spell.
Thanks again,
PT
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
"Dance Of Doom" spell-script woes...
« Reply #3 on: March 10, 2012, 03:59:55 am »


               you could try SetCommandable:
// Set whether oTarget's action stack can be modified
void SetCommandable(int bCommandable, object oTarget=OBJECT_SELF)

You just have to remember to make them commandable at the end with an ~  ActionDoCommand (SetCommandable(TRUE, oPC));   ~ or such.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
"Dance Of Doom" spell-script woes...
« Reply #4 on: March 10, 2012, 05:58:59 pm »


               Add faild.bards sugestion, add a clear all actions the effect is not delayed and turn the function into an action that runs on OBJECT_SELF and you end up with something like this. 

///////////////////////////////////////////////////
// Dance Of Doom
// pt_dancedoom.nss
//
// The victim loses 3pts of Con for 2 minutes and
// has to perform a very silly dance.
//
///////////////////////////////////////////////////

/// The Unequip-Dance-Equip Function (taken from ShadowM's hr_speak file)

void ActionEmoteDance()
{
  object oTarget = OBJECT_SELF;
  object oRightHand = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oTarget);
  object oLeftHand =  GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oTarget);

  ClearAllActions(TRUE);
  ActionUnequipItem(oLeftHand);
  ActionUnequipItem(oRightHand);
  ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY2,1.0);
  //ActionDoCommand(PlayVoiceChat(VOICE_CHAT_LAUGH));
  ActionPlayAnimation( ANIMATION_LOOPING_TALK_LAUGHING, 2.0, 2.0);
  ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY1,1.0);
  ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY3,2.0);
  ActionPlayAnimation( ANIMATION_LOOPING_GET_MID, 3.0, 1.0);
  ActionPlayAnimation( ANIMATION_LOOPING_TALK_FORCEFUL,1.0);
  ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY2,1.0);
  //ActionDoCommand(PlayVoiceChat(VOICE_CHAT_LAUGH));
  ActionPlayAnimation( ANIMATION_LOOPING_TALK_LAUGHING, 2.0, 2.0);
  ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY1,1.0);
  ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY3,2.0);
  ActionDoCommand(PlayVoiceChat(VOICE_CHAT_LAUGH));
  ActionPlayAnimation( ANIMATION_LOOPING_GET_MID, 3.0, 1.0);
  ActionPlayAnimation( ANIMATION_FIREFORGET_VICTORY2,1.0);
  ActionEquipItem(oRightHand,INVENTORY_SLOT_RIGHTHAND);
  ActionEquipItem(oLeftHand,INVENTORY_SLOT_LEFTHAND);
  ActionDoCommand(SetCommandable(TRUE));
  SetCommandable(FALSE);
}

/// The main function for the spell's impact script

void main()
{

    //Declare major variables
    object oTarget = GetSpellTargetObject();
    int nDuration = 2;
    int nLoss     = 3;
    effect eVis  = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);
    effect eFeeb = EffectAbilityDecrease(ABILITY_CONSTITUTION, nLoss);
    effect eVis1 = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
    // maybe add a knockdown later on
    //effect eTrip = EffectKnockdown();
    effect eLink1 = EffectLinkEffects(eFeeb, eVis1);

    //Fire cast spell at event for the specified target
    //1536 is spells 2da number for Dance of Doom
    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, 1536));

    //Apply the VFX impact and effects
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink1, oTarget, TurnsToSeconds(nDuration));
 
   AssignCommand(oTarget,ActionEmoteDance());

 

EDIT:Corrected my error of the action que being locked before it was filled.
EDIT2: Corrected the equip order per Faild bards observation.
EDIT3: *hangs head* 'Image
               
               

               


                     Modifié par Lightfoot8, 11 mars 2012 - 12:56 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
"Dance Of Doom" spell-script woes...
« Reply #5 on: March 10, 2012, 08:02:46 pm »


               

 ActionEquipItem(oLeftHand,INVENTORY_SLOT_LEFTHAND);
 ActionEquipItem(oRightHand,INVENTORY_SLOT_RIGHTHAND);

 You need to equip the right hand again before the left hand, in case both were weapons.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
"Dance Of Doom" spell-script woes...
« Reply #6 on: March 10, 2012, 08:21:35 pm »


               Edited: the above post per Failed.Bards  Correction.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
"Dance Of Doom" spell-script woes...
« Reply #7 on: March 10, 2012, 11:35:52 pm »


               

ActionEquipItem(oRightHand,INVENTORY_SLOT_LEFTHAND);
ActionEquipItem(oLeftHand,INVENTORY_SLOT_RIGHTHAND);

Still not quite right, inventory slot constants are reversed now.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
"Dance Of Doom" spell-script woes...
« Reply #8 on: March 11, 2012, 12:57:11 am »


               

Failed.Bard wrote...

ActionEquipItem(oRightHand,INVENTORY_SLOT_LEFTHAND);
ActionEquipItem(oLeftHand,INVENTORY_SLOT_RIGHTHAND);

Still not quite right, inventory slot constants are reversed now.


'Image
               
               

               
            

Legacy_Monsieur T

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
"Dance Of Doom" spell-script woes...
« Reply #9 on: March 26, 2012, 03:54:54 pm »


               Very sorry for not replying sooner, but I've been very busy with examinations.
Massive thanks to Lightfoot8 & Failed.Bard !!!!!
This spell now works like...well....a charm!!!
Thanks so much again for all your help.
T.