Author Topic: Whipper & Whippy  (Read 473 times)

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Whipper & Whippy
« on: September 29, 2014, 03:02:04 am »


               

I have tried creating a Slaver that will whip the slave, but for some reason the whipper isn't whipping the whippy. Here is my script, and tags on NPC.


_______________________________________________________________________________________________________


 


Tag: Whipper


// Whipper On_HeartBeat script: whipper_onhrtbet

void main()

{

    object oArea = GetArea(OBJECT_SELF);

    int sPCINAREA = FALSE;

    object oObject = GetFirstObjectInArea(oArea);


    while(GetIsObjectValid(oObject))

    {

        if(GetIsPC(oObject))

        {

            sPCINAREA = FALSE;

        }

        oObject = GetNextObjectInArea(oArea);

    }


    if(sPCINAREA == TRUE)

    {

        string sWhippy = "WHIPPY";

        object oWhippy = GetNearestObjectByTag(sWhippy);

        if(GetIsObjectValid(oWhippy))

        {

           AssignCommand (OBJECT_SELF, ActionAttack(oWhippy));

           ActionAttack(oWhippy);

           ClearAllActions(TRUE);

        }

    }

}


 


_________________________________________________________________________________________________________


 


Tag: Whippy


// Whippy On_HeartBeat script: whippy_onhrtbet

void main()

{

    string sYell;

    object oArea = GetArea(OBJECT_SELF);

    int sPCINAREA = FALSE;

    object oObject = GetFirstObjectInArea(oArea);

    while(GetIsObjectValid(oObject))

    {

        if(GetIsPC(oObject))

        {

            sPCINAREA = TRUE;

        }

        oObject = GetNextObjectInArea(oArea);

    }


    if(sPCINAREA == TRUE)

    {

        // Make sure were still on the ground.

        int iAnim;

        int iAnimRoll = d4();

        switch (iAnimRoll)

        {

            case 1: iAnim = ANIMATION_LOOPING_DEAD_FRONT; break;

            case 2: iAnim = ANIMATION_LOOPING_DEAD_BACK; break;

            case 3: iAnim = ANIMATION_LOOPING_WORSHIP; break;

            case 4: iAnim = ANIMATION_LOOPING_MEDITATE; break;

            default: iAnim = ANIMATION_LOOPING_DEAD_FRONT; break;


            DelayCommand(3.0f,PlayAnimation(iAnim));

        }

        AssignCommand(OBJECT_SELF, PlayAnimation(iAnim, 1.0, 6.0));


        int iRand = d8();

        switch (iRand)

        {

            case 1: sYell = "OUCH!"; break;

            case 2: sYell = "OOF!"; break;

            case 3: sYell = "MAMMA!"; break;

            case 4: sYell = "PLEASE!"; break;

            case 5: sYell = "OOHH!"; break;

            case 6: sYell = "AHHH!"; break;

            case 7: sYell = "GRRR!"; break;

            case 8: sYell = "ACK!"; break;

            default: sYell = "OUCH!"; break;


            DelayCommand(3.0f,SpeakString(sYell));

        }

        ClearAllActions();

    }

}


_________________________________________________________________________________________________________


 


Any Help would be greatly appreciated. Thank you in advance!



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Whipper & Whippy
« Reply #1 on: September 29, 2014, 03:07:59 am »


               

You are placing actions on the action queue and then removing them before the actions can take place.  Put ClearAllActions() before you start assigning actions so that the actions you assign are not removed.



               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Whipper & Whippy
« Reply #2 on: September 29, 2014, 04:36:14 am »


               

and : 



        if(GetIsPC(oObject))
        {
            sPCINAREA = FALSE;
        }

should be making it TRUE not FALSE.  It also would not hurt to add a break in the loop. 


 


 



        if(GetIsPC(oObject))
        {
            sPCINAREA = TRUE;
            break;
        }

               
               

               
            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Whipper & Whippy
« Reply #3 on: September 29, 2014, 04:56:34 am »


               

Thanks, I placed the ClearAllActions() but still the slaver stands their. While the slave does all his commands. I might be putting that command in the wrong spot.


// Whipper On_HeartBeat script: whipper_onhrtbet

void main()

{

    object oArea = GetArea(OBJECT_SELF);

    int sPCINAREA = FALSE;

    object oObject = GetFirstObjectInArea(oArea);


    while(GetIsObjectValid(oObject))

    {

        if(GetIsPC(oObject))

        {

            sPCINAREA = FALSE;

        }

        oObject = GetNextObjectInArea(oArea);

    }


    if(sPCINAREA == TRUE)

    {

        string sWhippy = "WHIPPY";

        object oWhippy = GetNearestObjectByTag(sWhippy);

        ClearAllActions();


    if(GetIsObjectValid(oWhippy))

        {

           AssignCommand (OBJECT_SELF, ActionAttack(oWhippy));

           ActionAttack(oWhippy);

           ClearAllActions(TRUE);

        }

    }

}



               
               

               
            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Whipper & Whippy
« Reply #4 on: September 29, 2014, 04:59:57 am »


               


 


and : 



        if(GetIsPC(oObject))
        {
            sPCINAREA = FALSE;
        }

should be making it TRUE not FALSE.  It also would not hurt to add a break in the loop. 


 


 



        if(GetIsPC(oObject))
        {
            sPCINAREA = TRUE;
            break;
        }



Changed and thanks


               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Whipper & Whippy
« Reply #5 on: September 29, 2014, 05:28:27 am »


               


    if(GetIsObjectValid(oWhippy))

        {

           AssignCommand (OBJECT_SELF, ActionAttack(oWhippy));

           ActionAttack(oWhippy);

           ClearAllActions(TRUE);

        }




 


Replace this with this:


 



    if(GetIsObjectValid(oWhippy))

        {


           ClearAllActions(TRUE);

           AssignCommand (OBJECT_SELF, ActionAttack(oWhippy));

           ActionAttack(oWhippy);

        }



               
               

               
            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Whipper & Whippy
« Reply #6 on: September 29, 2014, 06:00:08 am »


               

Thanks WhiZard


 


Hmm, She still stands there.. Maybe do a faction thing would make a difference.



               
               

               
            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Whipper & Whippy
« Reply #7 on: September 29, 2014, 11:52:32 pm »


               

Apparently it seems my script for the whipper isn't working. Can someone write one for me? Thanks



               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Whipper & Whippy
« Reply #8 on: September 30, 2014, 03:28:39 am »


               

Tag: Whipper
// Whipper On_HeartBeat script: whipper_onhrtbet
void main()
{
    object oArea = GetArea(OBJECT_SELF);
    int sPCINAREA = FALSE;
    object oObject = GetFirstObjectInArea(oArea);

    while(GetIsObjectValid(oObject))
    {
        if(GetIsPC(oObject))
        {
            sPCINAREA = TRUE;
            break;
        }
        oObject = GetNextObjectInArea(oArea);
    }

    if(sPCINAREA == TRUE)
    {
        string sWhippy = "WHIPPY";
        object oWhippy = GetNearestObjectByTag(sWhippy);
        if(GetIsObjectValid(oWhippy))
        {
           ClearAllActions(TRUE);
           ActionAttack(oWhippy);
          
        }
    }
}
 



Tag: Whippy
// Whippy On_HeartBeat script: whippy_onhrtbet
void main()
{
    string sYell;
    object oArea = GetArea(OBJECT_SELF);
    int sPCINAREA = FALSE;
    object oObject = GetFirstObjectInArea(oArea);
    while(GetIsObjectValid(oObject))
    {
        if(GetIsPC(oObject))
        {
            sPCINAREA = TRUE;
            break;

        }
        oObject = GetNextObjectInArea(oArea);
    }

    if(sPCINAREA == TRUE)
    {
        ClearAllActions(TRUE);
        // Make sure were still on the ground.
        int iAnim;
        int iAnimRoll = d4();
        switch (iAnimRoll)
        {
            case 1: iAnim = ANIMATION_LOOPING_DEAD_FRONT; break;
            case 2: iAnim = ANIMATION_LOOPING_DEAD_BACK; break;
            case 3: iAnim = ANIMATION_LOOPING_WORSHIP; break;
            case 4: iAnim = ANIMATION_LOOPING_MEDITATE; break;
            default: iAnim = ANIMATION_LOOPING_DEAD_FRONT; break;

            DelayCommand(3.0f,PlayAnimation(iAnim));
        }
       

        int iRand = d8();
        switch (iRand)
        {
            case 1: sYell = "OUCH!"; break;
            case 2: sYell = "OOF!"; break;
            case 3: sYell = "MAMMA!"; break;
            case 4: sYell = "PLEASE!"; break;
            case 5: sYell = "OOHH!"; break;
            case 6: sYell = "AHHH!"; break;
            case 7: sYell = "GRRR!"; break;
            case 8: sYell = "ACK!"; break;
            default: sYell = "OUCH!"; break;

            DelayCommand(3.0f,SpeakString(sYell));
        }
       
    }
}


               
               

               
            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Whipper & Whippy
« Reply #9 on: September 30, 2014, 08:59:32 pm »


               Many thanks Lightfoot8! Also see where my mistakes are at. Will test it out tonight.
               
               

               
            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Whipper & Whippy
« Reply #10 on: October 03, 2014, 09:32:05 pm »


               

Well.. they both stand their..