You are here

Remove concealment

6 posts / 0 new
Last post
Imperator
Imperator's picture
Remove concealment

So I'm trying to make a weapon that removes any kind of spell based concealment effect on a target when its condition is satisfied, but I'm having trouble doing it. Would anyone know how to?

  • up
    50%
  • down
    50%
VahnHaunt

You can give the weapon with "On Hit Cast Spell: Unique Spell". This, however, requires a 2da and packed in a hak for it to work.

Or...

In the editing window of a creature, in the scripts tab, you can use "OnDamaged" and it'll trigger a script. This may cause tiny issues but it'll get the job done. Plus, you'll do this to every creature if you want to use the script. Which can be tedious.

  • up
    50%
  • down
    50%
Imperator
Imperator's picture

I have tag based scripts turned on and I'm using scripted onhits for weapons, I just need a way to do it with that.

 

#include "x2_inc_switches"

void main()
{
    int nEvent = GetUserDefinedItemEventNumber();
    object oSelf;
    object oItem;

    if (nEvent ==X2_ITEM_EVENT_ONHITCAST)
    {
        oItem  =  GetSpellCastItem();
        object oSpellOrigin = OBJECT_SELF ;
        object oSpellTarget = GetSpellTargetObject();
        object oPC = GetPCItemLastEquippedBy();

    effect eVFX;
    SetLocalInt(OBJECT_SELF, "SHADOW_STACK", GetLocalInt(OBJECT_SELF, "SHADOW_STACK")+1);
    SetLocalInt(oSpellTarget, "LIGHT_STACK", GetLocalInt(oSpellTarget, "LIGHT_STACK")+1);


    if(GetLocalInt(OBJECT_SELF, "SHADOW_STACK")>=10 && GetLocalInt(OBJECT_SELF, "SHADOW_COOLDOWN")!=1)
    {
    effect eConceal = EffectConcealment(50, MISS_CHANCE_TYPE_NORMAL);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eConceal, OBJECT_SELF, 30.0);
    eVFX = EffectVisualEffect(SPELL_SHADOW_SHIELD);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, OBJECT_SELF, 1.0);
    eVFX = EffectVisualEffect(VFX_DUR_AURA_PULSE_GREY_BLACK);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, OBJECT_SELF, 30.0);
    eVFX = EffectVisualEffect(VFX_DUR_INVISIBILITY);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, OBJECT_SELF, 30.0);
    effect eSkill = EffectSkillIncrease(SKILL_HIDE, 50);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSkill, OBJECT_SELF, 30.0);
    SetLocalInt(OBJECT_SELF, "SHADOW_COOLDOWN", 1);
    DelayCommand(60.0, SetLocalInt(OBJECT_SELF, "SHADOW_COOLDOWN", 0));
    SetLocalInt(OBJECT_SELF, "SHADOW_STACK", 0);
    }

    if(GetLocalInt(oSpellTarget, "LIGHT_STACK")>=10 && GetLocalInt(oSpellTarget, "LIGHT_COOLDOWN")!=1)
    {
    effect eConceal = EffectConcealment(-50, MISS_CHANCE_TYPE_NORMAL);  //this is what I need help with
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eConceal, oSpellTarget, 30.); 

    effect eSkill = EffectSkillDecrease(SKILL_HIDE, 25);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSkill, oSpellTarget, 30.0);
    eVFX = EffectVisualEffect(VFX_DUR_GLOW_WHITE);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, oSpellTarget, 30.0);
    eVFX = EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSpellTarget);
    SetLocalInt(oSpellTarget, "LIGHT_COOLDOWN", 1);
    DelayCommand(30.0, SetLocalInt(oSpellTarget, "LIGHT_COOLDOWN", 0));
    SetLocalInt(oSpellTarget, "LIGHT_STACK", 0);
    }

     string GetStackValue2 = IntToString(GetLocalInt(OBJECT_SELF, "SHADOW_STACK"));
     string sMessage = "Target has " + GetStackValue2 + " stack(s) of shade";
     SendMessageToPC(oPC, sMessage);

     string GetCDValue = IntToString(GetLocalInt(oSpellTarget, "SHADOW_COOLDOWN"));
     sMessage = "Target has " +GetCDValue + " stack(s) of shadow cooldown.";
     SendMessageToPC(oPC, sMessage);

     string GetStackValue = IntToString(GetLocalInt(oSpellTarget, "LIGHT_STACK"));
     sMessage = "Target has " + GetStackValue + " stack(s) of light";
     SendMessageToPC(oPC, sMessage);

     GetCDValue = IntToString(GetLocalInt(oSpellTarget, "LIGHT_COOLDOWN"));
     sMessage = "Target has " +GetCDValue + " stack(s) of light cooldown.";
     SendMessageToPC(oPC, sMessage);

     sMessage = "If target has 1 stack, then the ability is on cooldown. If the target has 0 stacks then the ability is not on cooldown.";
     SendMessageToPC(oPC, sMessage);




    }

    else if (nEvent ==X2_ITEM_EVENT_EQUIP)
    {
       object oPC = GetPCItemLastEquippedBy();
       object oItem = GetPCItemLastEquipped();
       string sMessage = "Upon gaining ten stacks of shadow the user will acquire a 50% concealment bonus, and a +50 skill increase to their hide ranks. These effects last for half a turn each and the cooldown for this ability is one turn.";
       SendMessageToPC(oPC, sMessage);
       sMessage = "Upon inflicting ten stacks of light on a target that target will have their concealment reduced by 50% for 30 seconds. They'll also have their hide reduced by 25 for the same duration.";
       SendMessageToPC(oPC, sMessage);
       string noImbue = "Cannot be imbued with flame weapon!";
       SendMessageToPC(oPC, noImbue);
    }
}

  • up
    50%
  • down
    50%
VahnHaunt

effect eConceal = EffectConcealment(-50, MISS_CHANCE_TYPE_NORMAL); <- Mind you that the percentage value (the -50) can't have a negative number, it must be 1 to 100.

Replace those lines (you've highlighted) and try this:

effect eLoop = GetFirstEffect(oSpellTarget);
 
while (GetIsEffectValid(eLoop))
   {
   if (GetEffectType(eLoop) == EFFECT_TYPE_CONCEALMENT)
         RemoveEffect(oSpellTarget, eLoop);
 
   eLoop = GetNextEffect(oSpellTarget);
   }

This will remove any concealment effect from the target. I'm not sure about items or feats that grant permament concealment, such as Self Concealment. It may or may not work in those cases.

  • up
    50%
  • down
    50%
Imperator
Imperator's picture

thank you so much, yeah this is really only supposed to remove spell based concealment.

  • up
    50%
  • down
    50%
VahnHaunt

You're most welcome.

  • up
    50%
  • down
    50%