Author Topic: Need help with nifty doorbash script for PW  (Read 504 times)

Legacy_SuperFly_2000

  • Hero Member
  • *****
  • Posts: 1292
  • Karma: +0/-0
Need help with nifty doorbash script for PW
« on: November 04, 2010, 01:42:10 pm »


               I saw this on a PW (Cormanthor) and got the code for it (at least I hope that is all of it). I think it is pretty nifty. So you just put this code on the OnDisturbed event on the door...and then beside unlocking the door normally as a rogue..you can also bash it....but don't have to respawn the door....



//Door HP is determined either by:
//varint  Bash int ##
//Or the close lock DC, if the above wasn't found.
void MyShoutDisturbed(object oAttacker)
{
  if (GetLocalInt(OBJECT_SELF,"DamageTaken") > 0)
    {
        object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF), FALSE, OBJECT_TYPE_CREATURE);
        //Cycle through the targets within the spell shape until an invalid object is captured.
        while (GetIsObjectValid(oTarget))
        {
           if (GetFactionEqual(oTarget, OBJECT_SELF) == TRUE)
           {
        // * Make anyone who is a member of my faction hostile if I am violated
             SetIsTemporaryEnemy(oAttacker,oTarget,TRUE,60.0);
             AssignCommand(oTarget, ActionAttack(oAttacker));
           }
           oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF), FALSE, OBJECT_TYPE_CREATURE);
        }
    }
}
void main()
{
  int iDC = GetLocalInt(OBJECT_SELF,"Bash");
  if (!iDC) iDC = GetLockLockDC(OBJECT_SELF);
  int iDamage = GetLocalInt(OBJECT_SELF,"DamageTaken");
  object oPC = GetLastAttacker();
  if (GetLockKeyRequired(OBJECT_SELF))
  {
    DelayCommand(0.1, FloatingTextStringOnCreature("*This lock cannot be bashed.*", oPC, FALSE));
  }
  else
  {
    if (iDamage <= iDC)
    {
      if (GetLocked(OBJECT_SELF))
      {
        MyShoutDisturbed(oPC);
        if (iDamage < 0)  iDamage = 0;
        iDamage = iDamage + 1;
        DelayCommand(0.1, FloatingTextStringOnCreature("*Lock damage done: " + IntToString(iDamage) + " of " + IntToString(iDC)+"*", oPC, FALSE));
        if (iDamage >=  iDC)
        {
          iDamage = iDC;
          SetLocked(OBJECT_SELF, FALSE);
          DelayCommand(0.1, FloatingTextStringOnCreature("*The lock breaks!*", oPC, FALSE));
          AssignCommand(oPC,ClearAllActions());
          DelayCommand(60.0,DeleteLocalInt(OBJECT_SELF,"DamageTaken"));
        }
        SetLocalInt(OBJECT_SELF,"DamageTaken",iDamage);
      }
      else
      {
        SetLocalInt(OBJECT_SELF,"DamageTaken",iDC);
      }
    }
    else
    {
      SetLocalInt(OBJECT_SELF,"DamageTaken",iDC+1);
      //DelayCommand(0.1, FloatingTextStringOnCreature("*Not locked.*", oPC, FALSE));
      AssignCommand(oPC,ClearAllActions());
    }
  }
}


I am just not sure how to configure it. How to set the time until it resets....or how many hits the door takes before it breaks...because it is not really HP is it? ...and then also if it is possible to add some "soak" to this...hmm...actually...I guess I could just put the amount of soak on the normal properties on the door?

Bit confused here....

They didn't have time to help me further..so any further information about this would be great...
               
               

               


                     Modifié par SuperFly_2000, 04 novembre 2010 - 01:42 .
                     
                  


            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Need help with nifty doorbash script for PW
« Reply #1 on: November 04, 2010, 02:57:19 pm »


               I believe that would go on the onbashed of the door, and you would probably set the door to plot so as not to be destroyed, lock the door, then set an integer of "Bash" on the door with the amount of damage you would wish for it to be able to withstand.



If you do not set the "Bash" integer it will default to using the locks DC to reference the amount of damage the lock can take.

               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Need help with nifty doorbash script for PW
« Reply #2 on: November 04, 2010, 07:58:11 pm »


               Looks like the same script from PW helper which would be an easy download from the Vault. Also has a read me about it or you could even use one of these which all do the same thing as well.





Bashable Doors And Containers With Persistent Traps

Stormsong

03-27-2004 / 11-22-2006
I've pulled together some ideas and work from around the vault and forums and put it together to per...

Rowell's Bashable FairPlay Door

Rowell

08-09-2004 / 11-22-2006
This is Rowell's Play Fair Door. This special PLOT door will allow Players to: - Gain XP when the...

Bashable Door System

Fudder_Elm

12-15-2004 / 11-22-2006
Now that the EffectHeal() works to heal doors. I figured I would do my part to help those who are un...
               
               

               


                     Modifié par TSMDude, 04 novembre 2010 - 07:59 .
                     
                  


            

Legacy_SuperFly_2000

  • Hero Member
  • *****
  • Posts: 1292
  • Karma: +0/-0
Need help with nifty doorbash script for PW
« Reply #3 on: November 04, 2010, 10:03:04 pm »


               Thanks Baragg, but when does it regain its "lock"? ..and how to change that time...

By the way...it is the regular trap skills to spot it ... and to unlock it right? ...if you're a rogue for example...(because it would probably be faster and more elegant to do it that way).
               
               

               


                     Modifié par SuperFly_2000, 04 novembre 2010 - 10:03 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Need help with nifty doorbash script for PW
« Reply #4 on: November 05, 2010, 01:37:02 am »


               The script looks like it never resets the door to locked. It unlocks it with the line:
 
SetLocked(OBJECT_SELF, FALSE);

You can add a line right after it with a delay to relock the door after the number of seconds you want. 


 DelayCommand(60.0,SetLocked(OBJECT_SELF, TRUE) );


 

//Door HP is determined either by:
//varint  Bash int ##
//Or the close lock DC, if the above wasn't found.
void MyShoutDisturbed(object oAttacker)
{
  if (GetLocalInt(OBJECT_SELF,"DamageTaken") > 0)
    {
        object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF), FALSE, OBJECT_TYPE_CREATURE);
        //Cycle through the targets within the spell shape until an invalid object is captured.
        while (GetIsObjectValid(oTarget))
        {
           if (GetFactionEqual(oTarget, OBJECT_SELF) == TRUE)
           {
        // * Make anyone who is a member of my faction hostile if I am violated
             SetIsTemporaryEnemy(oAttacker,oTarget,TRUE,60.0);
             AssignCommand(oTarget, ActionAttack(oAttacker));
           }
           oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF), FALSE, OBJECT_TYPE_CREATURE);
        }
    }
}
void main()
{
  int iDC = GetLocalInt(OBJECT_SELF,"Bash");
  if (!iDC) iDC = GetLockLockDC(OBJECT_SELF);
  int iDamage = GetLocalInt(OBJECT_SELF,"DamageTaken");
  object oPC = GetLastAttacker();
  if (GetLockKeyRequired(OBJECT_SELF))
  {
    DelayCommand(0.1, FloatingTextStringOnCreature("*This lock cannot be bashed.*", oPC, FALSE));
  }
  else
  {
    if (iDamage <= iDC)
    {
      if (GetLocked(OBJECT_SELF))
      {
        MyShoutDisturbed(oPC);
        if (iDamage < 0)  iDamage = 0;
        iDamage = iDamage + 1;
        DelayCommand(0.1, FloatingTextStringOnCreature("*Lock damage done: " + IntToString(iDamage) + " of " + IntToString(iDC)+"*", oPC, FALSE));
        if (iDamage >=  iDC)
        {
          iDamage = iDC;
          [color=green]SetLocked(OBJECT_SELF, FALSE);[/color]
          [color=cornflowerblue]DelayCommand([/color][color=red]60.0[/color][color=cornflowerblue],SetLocked(OBJECT_SELF, TRUE) );[/color]
          DelayCommand(0.1, FloatingTextStringOnCreature("*The lock breaks!*", oPC, TRUE));
          AssignCommand(oPC,ClearAllActions());
          DelayCommand(60.0,DeleteLocalInt(OBJECT_SELF,"DamageTaken"));
        }
        SetLocalInt(OBJECT_SELF,"DamageTaken",iDamage);
      }
      else
      {
        SetLocalInt(OBJECT_SELF,"DamageTaken",iDC);
      }
    }
    else
    {
      SetLocalInt(OBJECT_SELF,"DamageTaken",iDC+1);
      //DelayCommand(0.1, FloatingTextStringOnCreature("*Not locked.*", oPC, FALSE));
      AssignCommand(oPC,ClearAllActions());
    }
  }
}

               
               

               


                     Modifié par Lightfoot8, 05 novembre 2010 - 01:48 .
                     
                  


            

Legacy_SuperFly_2000

  • Hero Member
  • *****
  • Posts: 1292
  • Karma: +0/-0
Need help with nifty doorbash script for PW
« Reply #5 on: November 05, 2010, 09:04:12 am »


               I'm finding it very hard to find that the guy on Cormanthor gave me the wrong script. What I suspect however is that he left out some other script or setting that I need to do.



I would think that the door woould need to have a re-close and re-lock script on it on the OnOpen event.



So I think that is the way to do it actually....



(The re-close and re-lock script I think I have already.)



Thanks for trying to help though :-)
               
               

               
            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
Need help with nifty doorbash script for PW
« Reply #6 on: November 05, 2010, 03:41:39 pm »


               What exactly is the behavior you are after with the door?

Why don't you write a list of the behavior that you want? There are a lot of good scripters on these forums who could probably roll something up for you.
               
               

               
            

Legacy_SuperFly_2000

  • Hero Member
  • *****
  • Posts: 1292
  • Karma: +0/-0
Need help with nifty doorbash script for PW
« Reply #7 on: November 05, 2010, 04:13:40 pm »


               I think I have all I need on this subject for now. I will try it out to see if it works.

Thanks to all so far.
               
               

               


                     Modifié par SuperFly_2000, 05 novembre 2010 - 04:14 .
                     
                  


            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Need help with nifty doorbash script for PW
« Reply #8 on: November 05, 2010, 08:40:29 pm »


               Yea you could go with the onopen event to close and lock the door, that would probably be the best. We use a very similar script on Shadow Mountain with our guild territory halls that persons in guilds can attack and claim for their guilds.

If you feel like goin with more scripts you could use a delay in the onopen to close the door, and the onclosed event to lock the door. Just ensure when you do the close/lock thing you also reset the int DamageTaken to zero, or delete it so the next come along basher doesn't get a head start.

Also remember door closing is not close to the top of things the engine does in its' cycle, so mayhap have a delay that checks to ensure the door is closed.':bandit:'
               
               

               


                     Modifié par Baragg, 05 novembre 2010 - 08:42 .