Author Topic: Speaking of concealment  (Read 368 times)

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
Speaking of concealment
« on: May 01, 2012, 07:52:01 am »


               D&D 3.0 gives us the following for concealment:
Concealment
               
               
                 Example
               
               
                 Miss Chance
               
             
             
               
                 One-quarter
               
               
                 Light fog; moderate darkness; light foliage.
               
               
                 10%
               
             
             
               
                 One-half
               
               
                 Blur spell; dense fog at 5 ft (such
                   as obscuring mist).
               
               
                 20%
               
             
             
               
                 Three-quarters
               
               
                 Dense foliage.
               
               
                 30%
               
             
             
               
                 Nine-tenths
               
               
                 Near total darkness.
               
               
                 40%
               
             
             
               
                 Total
               
               
                 Invisibility; attacker blind; total
                   darkness; dense fog at 10 ft.
               
               
                 50% *
And the following for Cover:
Degree of Cover
               
               
                 Example
               
               
                 AC Cover Bonus
               
               
                 Cover Ref Save Bonus
               
             
             
               
                 One-quarter
               
               
                 A human standing behind a 3 foot wall.
               
               
                 +2
               
               
                 +1
               
             
             
               
                 One-half
               
               
                 Fighting from around a corner or a tree; standing
                   at an open window; behind a creature of the same size.
               
               
                 +4
               
               
                 +2
               
             
             
               
                 Three-quarters
               
               
                 Peering around a corner or a tree.
               
               
                 +7
               
               
                 +3
               
             
             
               
                 Nine-tenths
               
               
                 Standing at an arrow slit; behind a door that
                   is slightly ajar.
               
               
                 +10
               
               
                 +4 *
               
             
             
               
                 Total
               
               
                 On the other side of a solid wall.
               
               
                 ---
               
               
                 ---

NWN does not alllow stacking armor modifiers however, so while you can set a trigger to apply a concealment effect to a person behind a parapet for instance, applying the AC bonus will only apply if it is greater than their already existing armor bonuses from gear. Also as one leaves the trigger, the concealment effect is removed by script in the on exit event, but it seems removing the AC bonus for cover would potentially remove all AC bonuses the pc/npc is getting from their gear, requiring them to re-equip their gear to get the AC bonus reset.

SO, when scripting cover, do you ignore the cover mechanic and go with concealment alone, or is there another way to work the AC bonus for cover that stacks properly?
               
               

               
            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
Speaking of concealment
« Reply #1 on: May 01, 2012, 07:54:51 am »


               It let me paste the tables fine, it fubar'ed them when posted though.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Speaking of concealment
« Reply #2 on: May 01, 2012, 01:35:37 pm »


               A dodge bonus would stack still, as long as it's under whatever the server's cap is (+20 without nwnx).

 As long as you know what object is applying the effect, it's easy to remove just that one as well.  If you're doing it in a triggers' OnEnter/OnExit, then the trigger will be the effect creator.  Just remove effects created only by OBJECT_SELF in the OnExit you'll be fine.
               
               

               
            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
Speaking of concealment
« Reply #3 on: May 01, 2012, 04:12:23 pm »


               One of the unfortunate things with using triggers to apply cover and concealment effects, by whatever mechanic, is that one must be careful to *not* allow melee combat in the same area, otherwise there is an easily exploitable ploy to navigate the fight so that one combatant is standing in the trigger (next to the parapet, for example) and benefiting from the cover effects, while the other is not.

Failed.Bard:
...As long as you know what object is applying the effect, it's easy to remove just that one as well. If you're doing it in a triggers' OnEnter/OnExit, then the trigger will be the effect creator. Just remove effects created only by OBJECT_SELF in the OnExit you'll be fine.


actually, I hadn't thought of that before.  I suppose I could set the script to check for the entering objects AC bonus, take that and then add the appropriate cover bonus to it, and reapply it as *the* AC bonus, then, I could strip off the effect applied by object when they leave the trigger.

My current on exit script isn't that sophisticated though:

void main()
{
object oPC=GetEnteringObject();

if (!GetIsPC(oPC)) return;

//Remove concealment from the PC
effect eLoop=GetFirstEffect(oPC);

while (GetIsEffectValid(eLoop))
   {
   if (GetEffectType(eLoop)==EFFECT_TYPE_CONCEALMENT)
         RemoveEffect(oPC, eLoop);

   eLoop=GetNextEffect(oPC);
   }
}

               
               

               
            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
Speaking of concealment
« Reply #4 on: May 01, 2012, 04:28:33 pm »


               


//remove all created by



void main()

{



    object oSelf = OBJECT_SELF;

    object oUser = GetLastUsedBy();



    // Remove all effects created by trigger

    effect eCheck = GetFirstEffect(oUser);

    while(GetIsEffectValid(eCheck))

        {

            if(GetEffectCreator(eCheck) == oSelf)

        {

            RemoveEffect(oUser, eCheck);

        }

        eCheck = GetNextEffect(oUser);

    }

}
so something like this to clean up the effects of concealment, and this has the charm of working on followers and npc/monsters too (so no risk of permanently buffed monsters strolling around).
               
               

               
            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
Speaking of concealment
« Reply #5 on: May 01, 2012, 05:01:23 pm »


               And to apply the gamut of cover and concealment bonuses:

// On Enter trigger to apply conceal effect on objects in trigger

/*Set Local Int (nConceal) on trigger for concealment% (per D&D 3.0):
  1/4       Light fog; moderate darkness; light foliage.            10%
  1/2       Blur spell; dense fog at 5 ft (obscuring mist)          20%
  3/4       Dense foliage                                           30%
  9/10      Near total darkness                                     40%
  Total     Invisibility; total dark; dense fog at 10 ft.           50%


 Set Local Int (nCover) on trigger for AC Bonus from cover (per D&D 3.0):
 Cover      Example                                      AC Bonus  Reflex Bonus
  1/4       A human standing behind 3 foot wall.            +2          +1
  1/2       Fighting around corner or tree; standing at
             open window; behind creature of same size.     +4          +2
  3/4       Peering around a corner or a tree.              +7          +3
  9/10      At arrow slit; behind door slightly ajar.       +10         +4
  Total     On the other side of a solid wall.              ---         ---

Will default to 1/4 conceal and cover (10% concealment, +2 AC *applied as dodge bonus)
if nConceal is not set on trigger.
*/

void main()
{
    object oUser = GetEnteringObject();
    effect eConceal;
    effect eDodge;
    effect eReflex;

    if(GetLocalInt(OBJECT_SELF,"nConceal"))
    {
        eConceal = EffectConcealment(10);
        eDodge = EffectACIncrease(2, AC_DODGE_BONUS);
        eReflex = EffectSavingThrowIncrease(SAVING_THROW_REFLEX, 5, SAVING_THROW_TYPE_ALL);

    }
    else
    {
        eConceal = EffectConcealment(GetLocalInt(OBJECT_SELF,"nConceal"));
        eDodge = EffectACIncrease((GetLocalInt(OBJECT_SELF,"nDodge")), AC_DODGE_BONUS);
        eReflex = EffectSavingThrowIncrease(SAVING_THROW_REFLEX,
                    (GetLocalInt(OBJECT_SELF,"nReflex")), SAVING_THROW_TYPE_ALL);
    }

    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eConceal, oUser);
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDodge, oUser);
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eReflex, oUser);
}


               
               

               
            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
Speaking of concealment
« Reply #6 on: May 01, 2012, 05:04:49 pm »


               I can see that needs to be cleaned up, btw, but it's going in the right direction... the statements in the if and else need to be swapped to get it to play properly... apologies.

edit: I went with the dodge modifier after all, because there was no way to sort out ac, and as suggested, it gets the same effect and stacks to +20.

edit: The clean-up on exit isn't working though...
               
               

               


                     Modifié par Leurnid, 01 mai 2012 - 04:13 .
                     
                  


            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
Speaking of concealment
« Reply #7 on: May 01, 2012, 05:24:14 pm »


               
//remove all created by

void main()
{
    object oSelf = OBJECT_SELF;
    object oUser = GetExitingObject();

    // Remove all effects created by trigger
    effect eCheck = GetFirstEffect(oUser);
    while(GetIsEffectValid(eCheck))
        {
            if(GetEffectCreator(eCheck) == oSelf)
        {
            RemoveEffect(oUser, eCheck);
        }
        eCheck = GetNextEffect(oUser);
    }
}

I was using GetLastUsedBy, I needed GetExitingObject... mystery solved, cover and conceal trigger working like a charm!
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Speaking of concealment
« Reply #8 on: May 01, 2012, 05:28:55 pm »


               object oUser = GetLastUsedBy();

Should be GetExitingObject() instead.

Edit:  You got it figured out while I was reading what you had, and before I got around to posting.  That'll teach me not to hit refresh before replying.
               
               

               


                     Modifié par Failed.Bard, 01 mai 2012 - 04:30 .
                     
                  


            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
Speaking of concealment
« Reply #9 on: May 01, 2012, 07:05:32 pm »


               just caught, the reflex modifier if there is no stored default should be 1, not 5.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Speaking of concealment
« Reply #10 on: May 03, 2012, 03:22:25 pm »


               Interesting & thanks for sharing..
               
               

               
            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
Speaking of concealment
« Reply #11 on: May 03, 2012, 04:24:22 pm »


               I posted working copies of the scripts and a preset trigger with vars and scripts. It's pending approval, but this link should work once it drops.