Author Topic: beams won't shut off...  (Read 435 times)

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
beams won't shut off...
« on: June 12, 2014, 07:12:03 am »


               

so the script works and compiles but the beams won't shut off and the peaceables are still useable. i've tried messing with this myself and only get compile errors. anyone see what i missed and can help?


 


#include "pqj_inc"

void main()

{

   object oPC = GetLastUsedBy();

   if (!GetIsPC(oPC)) return;

   if(RetrieveQuestState("q_chalice", oPC) != 40) return;

   if(GetLocalInt(OBJECT_SELF, "Activated") == 1) return;

    //Checktag and assign VFX

    string sTag = GetTag(OBJECT_SELF);

    int nBeam;

    if(sTag == "rune_ice") nBeam = VFX_BEAM_COLD;

    else if(sTag == "rune_fire") nBeam = VFX_BEAM_FIRE;

    else if(sTag == "rune_evil") nBeam = VFX_BEAM_EVIL;

    else if(sTag == "rune_holy") nBeam = VFX_BEAM_HOLY;

    //Set a local int to indicate the rune is activated

    SetLocalInt(OBJECT_SELF, "Activated", 1);

    object oTarget = GetObjectByTag("rune_black");

    ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectBeam(nBeam, GetObjectByTag("rune_black"), BODY_NODE_CHEST), GetObjectByTag(sTag));

    //If all four are activated activate the rune pillar

    if(GetLocalInt(GetObjectByTag("rune_ice"), "Activated") == 1 &&

       GetLocalInt(GetObjectByTag("rune_fire"), "Activated") == 1 &&

       GetLocalInt(GetObjectByTag("rune_evil"), "Activated") == 1 &&

       GetLocalInt(GetObjectByTag("rune_holy"), "Activated") == 1)

       {

       SetLocalObject(oTarget, "PC", oPC);

       ExecuteScript("ap_rune_pillar", oTarget);

       ExecuteScript("ap_pillar_summon", OBJECT_SELF);

       SetUseableFlag(OBJECT_SELF, FALSE);

       DelayCommand(900.0, SetUseableFlag(OBJECT_SELF, TRUE));

       }

}

 

 

any help is welcome. thanks.


               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
beams won't shut off...
« Reply #1 on: June 12, 2014, 09:49:37 am »


               

Are you getting any scripting errors with either ap_pillar_summon or ap_rune_pillar?



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
beams won't shut off...
« Reply #2 on: June 12, 2014, 03:16:29 pm »


               

Am I right in saying that the above script is attached to each of the following
 
rune_evil
rune_fire
rune_holy
rune_ice
 
 
If thats the case, then the reason your placeable remains usable is because the line to disable it lies within the if statement to check if they are ALL activated.
 
Eg: You will probably find that the 4th rune tower/object you use does actually disable itself.
 


if(GetLocalInt(GetObjectByTag("rune_ice"), "Activated") == 1 &&
       GetLocalInt(GetObjectByTag("rune_fire"), "Activated") == 1 &&
       GetLocalInt(GetObjectByTag("rune_evil"), "Activated") == 1 &&
       GetLocalInt(GetObjectByTag("rune_holy"), "Activated") == 1)
       {
       SetLocalObject(oTarget, "PC", oPC);
       ExecuteScript("ap_rune_pillar", oTarget);
       ExecuteScript("ap_pillar_summon", OBJECT_SELF);
       SetUseableFlag(OBJECT_SELF, FALSE);
       DelayCommand(900.0, SetUseableFlag(OBJECT_SELF, TRUE));
       }

From the snippet above, it looks like it will only set the usable flag to be False, if all 4 pillars are activated.

This will not happen within the context of a single use of the script

As such, you will find  the 4th pillar gets disabled, while the 3 that came before it remain enabled.

 

To fix it, you should set the usable flag to be false, outside of the If Statement, around where the vfx is applied

Also , you have got your vfx being applied permanently, which is why the beams persist.

 

If you want to remove the beams, you will need to apply the following function to the beams target object.

 

http://www.nwnlexico...oveEffectOfType

 

I recommend calling it with EFFECT_TYPE_VISUALEFFECT

As a consequence, this will remove ALL visual effects from the target of the beams, not just the beams themselves.
 


               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
beams won't shut off...
« Reply #3 on: June 12, 2014, 04:15:47 pm »


               

There is also the possibility that the beam effect may be being applied after you are scheduling to remove it.



               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
beams won't shut off...
« Reply #4 on: June 12, 2014, 08:23:47 pm »


               

WhiZard -


both ap_rune_pillar and ap_pillar_summon work fine.


the beams show activation one at a time when each rune stone is used.


gonna guess that being set on after is not the issue.


 


Baaleos -


yes, each of the 4 rune stones have this script in the OnUsed tab.


they are activated one at a time emitting a beam to a 5th rune stone,


which then sends a final beam to a rune pillar, thus summoning the guardian.


 


i noticed when i tested the process again the 5th beam dose not show,


would this possibly make the other beams stay on??


 


as for the script itself, it was made by shadow or lightfoot some time ago, as i'm not so much a scripter.


i've learned how to read script and can understand what most does,


but reproducing it is another story, as i stated originally with all my compile errors i got messing with it myself.


i will however try to figure it out myself if help is not available here.


 


i do hope that help is still available on these forums,


tho i'm sure it's not as abundant as it once was on the old forums.



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
beams won't shut off...
« Reply #5 on: June 13, 2014, 12:24:22 am »


               Hi Zero-Feeling.
Do you have other scripts that attempt to turn the beams off?

If so, they must call some form of RemoveEffect on the target of the beams.
The code you show above doesnt look like it attempts to turn beams off within it.

Is that segment elsewhere?
               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
beams won't shut off...
« Reply #6 on: June 13, 2014, 01:02:56 am »


               

ok, here is the full set.


 


ap_rune_chain


 


#include "pqj_inc"

void main()

{

   object oPC = GetLastUsedBy();

   if (!GetIsPC(oPC)) return;

   if(RetrieveQuestState("q_chalice", oPC) != 40) return;

   if(GetLocalInt(OBJECT_SELF, "Activated") == 1) return;

    //Checktag and assign VFX

    string sTag = GetTag(OBJECT_SELF);

    int nBeam;

    if(sTag == "rune_ice") nBeam = VFX_BEAM_COLD;

    else if(sTag == "rune_fire") nBeam = VFX_BEAM_FIRE;

    else if(sTag == "rune_evil") nBeam = VFX_BEAM_EVIL;

    else if(sTag == "rune_holy") nBeam = VFX_BEAM_HOLY;

    //Set a local int to indicate the rune is activated

    SetLocalInt(OBJECT_SELF, "Activated", 1);

    object oTarget = GetObjectByTag("rune_black");

    ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectBeam(nBeam, GetObjectByTag("rune_black"), BODY_NODE_CHEST), GetObjectByTag(sTag));

    //If all four are activated activate the rune pillar

    if(GetLocalInt(GetObjectByTag("rune_ice"), "Activated") == 1 &&

       GetLocalInt(GetObjectByTag("rune_fire"), "Activated") == 1 &&

       GetLocalInt(GetObjectByTag("rune_evil"), "Activated") == 1 &&

       GetLocalInt(GetObjectByTag("rune_holy"), "Activated") == 1)

       {

       SetLocalObject(oTarget, "PC", oPC);

       ExecuteScript("ap_rune_pillar", oTarget);

       ExecuteScript("ap_pillar_summon", OBJECT_SELF);

       SetUseableFlag(OBJECT_SELF, FALSE);

       DelayCommand(900.0, SetUseableFlag(OBJECT_SELF, TRUE));

       }

}

 

 

ap_rune_pillar

 

#include "pqj_inc"

#include "nw_i0_2q4luskan"

void main()

{

   object oPC = GetLocalObject (OBJECT_SELF, "PC");

   if (!GetIsPC(oPC)) return;

   int nInt = RetrieveQuestState("q_helden",oPC);

   if (nInt == 40)

      return;

   object oTarget;

      oTarget = OBJECT_SELF;

      nInt = GetObjectType(oTarget);

 

   if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_SUNSTRIKE), oTarget);

   else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_SUNSTRIKE), GetLocation(oTarget));

      oTarget = GetObjectByTag("rune_pillar");

      nInt = GetObjectType(oTarget);

 

   effect eEffect;

      eEffect = EffectVisualEffect(VFX_COM_CHUNK_STONE_MEDIUM);

 

   if (nInt != OBJECT_TYPE_WAYPOINT)

      DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget));

   else

      DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eEffect, GetLocation(oTarget)));

      DelayCommand(1.0, DestroyObject(oTarget, 3.0));

      oTarget = GetObjectByTag("invis_rune");

      nInt = GetObjectType(oTarget);

 

   if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_FIRESTORM), oTarget);

   else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_FIRESTORM), GetLocation(oTarget));

   location lTarget;

      oTarget = GetWaypointByTag("WP_summon");

      lTarget = GetLocation(oTarget);

      DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "dragon_h_guard", lTarget));

      eEffect = EffectVisualEffect(VFX_FNF_SUMMON_CELESTIAL);

      DelayCommand(2.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eEffect, lTarget));

      {

         effect eVFX = GetFirstEffect(OBJECT_SELF);

         while(GetIsEffectValid(eVFX))

         {

            if(GetEffectType(eVFX) == EFFECT_TYPE_VISUALEFFECT) RemoveEffect(OBJECT_SELF, eVFX);

            eVFX = GetNextEffect(OBJECT_SELF);

         }

         DeleteLocalInt(GetObjectByTag("rune_ice"), "Activated");

         DeleteLocalInt(GetObjectByTag("rune_fire"), "Activated");

         DeleteLocalInt(GetObjectByTag("rune_evil"), "Activated");

         DeleteLocalInt(GetObjectByTag("rune_holy"), "Activated");

      }

}

 

 

ap_pillar_summon

 

#include "nw_i0_generic"

void main()

{

 

   object oPC = GetLastUsedBy();

 

   if (!GetIsPC(oPC)) return;

 

   object oTarget;

   object oSpawn;

   location lTarget;

      oTarget = GetWaypointByTag("watcher_one");

      lTarget = GetLocation(oTarget);

      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "heldenwatcher", lTarget);

      oTarget = oSpawn;

         SetIsTemporaryEnemy(oPC, oTarget);

         AssignCommand(oTarget, ActionAttack(oPC));

         AssignCommand(oTarget, DetermineCombatRound(oPC));

 

   int nInt;

      nInt = GetObjectType(oTarget);

 

   if (nInt != OBJECT_TYPE_WAYPOINT) DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_EPIC_UNDEAD), oTarget));

   else DelayCommand(0.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_EPIC_UNDEAD), GetLocation(oTarget)));

      oTarget = GetWaypointByTag("helden_two");

      lTarget = GetLocation(oTarget);

      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "heldenwatcher", lTarget);

      oTarget = oSpawn;

         SetIsTemporaryEnemy(oPC, oTarget);

         AssignCommand(oTarget, ActionAttack(oPC));

         AssignCommand(oTarget, DetermineCombatRound(oPC));

 

      nInt = GetObjectType(oTarget);

 

   if (nInt != OBJECT_TYPE_WAYPOINT) DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_EPIC_UNDEAD), oTarget));

   else DelayCommand(0.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_EPIC_UNDEAD), GetLocation(oTarget)));

}

 

as i said before, the scripts work, just not the part with the beams.


               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
beams won't shut off...
« Reply #7 on: June 13, 2014, 06:25:33 am »


               

You have created the beam effect on the four runes, and are trying to remove the visual effects from the black rune.  The beam connects the four runes to the black rune but the effect is found on the four runes, not on the black rune.



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
beams won't shut off...
« Reply #8 on: June 13, 2014, 09:25:26 am »


               

Well spotted - because it went onto the next line, I missed that bit


 


ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectBeam(nBeam, GetObjectByTag("rune_black"), BODY_NODE_CHEST), GetObjectByTag(sTag));

 


You are applying this effect to each pillar.


Instead of applying to each pillar, you could swap it round, to make it apply it to the rune_black target. This would be the path of least resistance, since the beams will more a less look identical whether they are coming from or going to the rune_black.


It should also allow the existing code to remove the beams.


 


Try changing the above line to be


 


 


ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectBeam(nBeam, OBJECT_SELF, BODY_NODE_CHEST),GetObjectByTag("rune_black"));


               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
beams won't shut off...
« Reply #9 on: June 13, 2014, 03:44:46 pm »


               

same results, fire, ice, divine, evil...


still showing no black and all runes are still usable with beams still on.


is this: DURATION_TYPE_PERMANENT causing the beams to stay on?


should it be this: DURATION_TYPE_TEMPORARY??


just a thought, my logic would think they should only be temporary....


i don't know if it would make a difference, but will still try just to cover that base.


.


EDIT: found out what temporary does... makes it so nothing shows...


put it back to permanent.



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
beams won't shut off...
« Reply #10 on: June 13, 2014, 05:22:35 pm »


               

Can  you put the following line within the ap_rune_pillar


script and re-test so we can see where it is running


 


 


SpeakString("01-Got here");


 


Change 01 to be a new number each time.


This will let us know if the script is firing, and where it is going in the logic



               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
beams won't shut off...
« Reply #11 on: June 13, 2014, 05:44:01 pm »


               

would be happy to, anywhere in particular?


.


please keep in mind i'm not a scripter and debugging definitely is not my strong suit.