Skip to content

Traps?

By what process can one make a UNDETECTABLE Trap that does not engage until a certain point into said trap?

9zfb7ma563ul.jpg

Namely, have a Blade Barrier appear in ALL. THREE. Trigger areas, but ONLY once the middle area is entered.

Also, I am aware of the Detectable check box available, it does not work. The trap is still seen to a L1 PC.



Comments

  • CeyarrecksCeyarrecks Member Posts: 44
    also noticing, that setting the DC for Detect & Disarm to 99 has not effect on visibility. Trap is still seen.
  • CalgacusCalgacus Member Posts: 273
    edited October 2020
    You could try something like this:
    Create the three traps as generic triggers - not as traps. Then in the middle trigger (with the tag TRAP002) use this script for the onenter script:
    #include "x0_i0_position"
    
    void main()
    {
    
             object t1 = GetObjectByTag("TRAP001");
             object t2 = GetObjectByTag("TRAP002");
             object t3 = GetObjectByTag("TRAP003");
           
             effect eAOE = EffectAreaOfEffect(AOE_PER_WALLBLADE, "customonenterscr");
    
             location lTarget1 =  GetLocation(t1);
    
             lTarget1 = GenerateNewLocationFromLocation(lTarget1, 0.0, 0.0, 90.0 );
             location lTarget2 =  GetLocation(t2);
             lTarget2 = GenerateNewLocationFromLocation(lTarget2, 0.0, 0.0, 90.0 );
             location lTarget3 =  GetLocation(t3);
             lTarget3 = GenerateNewLocationFromLocation(lTarget3, 0.0, 0.0, 90.0 );
             int nDuration = 5;
             //Create an instance of the AOE Object using the Apply Effect function
             ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAOE, lTarget1, RoundsToSeconds(nDuration));
             ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAOE, lTarget2, RoundsToSeconds(nDuration));
             ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAOE, lTarget3, RoundsToSeconds(nDuration));
    
    }
    

    and the customonenterscr script like so:
    void main()
    {
        object oTarget = GetFirstInPersistentObject(OBJECT_SELF,OBJECT_TYPE_CREATURE | OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_DOOR);
        int nDamage = d6(6);// Whatever damage you want
        effect eVis = EffectVisualEffect(VFX_COM_BLOOD_LRG_RED);
        while(GetIsObjectValid(oTarget))
        {
    
               {
                    //Adjust damage according to Reflex Save, Evasion or Improved Evasion
                    nDamage = GetReflexAdjustedDamage(nDamage, oTarget, GetSpellSaveDC());
    
                    //Set damage effect
                    effect eDam = EffectDamage(nDamage, DAMAGE_TYPE_SLASHING);
                    //Apply damage and VFX
                    ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
                    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
               }
    
            oTarget = GetNextInPersistentObject(OBJECT_SELF,OBJECT_TYPE_CREATURE | OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_DOOR);
         }
    }
    

    You'll need to tweak this but it might be a good start.

    For ref: https://nwnlexicon.com/index.php?title=GenerateNewLocationFromLocation

    Post edited by Calgacus on
  • CeyarrecksCeyarrecks Member Posts: 44
    ooo! thank you,.. will look into this immediately :D
  • CeyarrecksCeyarrecks Member Posts: 44
    ok,.. well, umm, this is WAY over my head, as I just received the following error:

    aoe_object.nss(12): ERROR: UNDEFINED IDENTIFIER (GenerateNewLocationFromLocation)

    I made the three trigger areas similar to the above picture, obtained the X,Y locations and plugged them into the above script (not sure if 90 degrees means anything at this point)

    and the wiki is not helping my understanding,...

    way back in the day I tinkered with basic HTML, and kinda got to the point of understanding and writing in a real rudimentary way,... this is so far over my head I can not even see daylight,...
  • CalgacusCalgacus Member Posts: 273
    edited October 2020
    Sorry, when I copied the script I missed an #include line - try the first script again and note the update.
    The '90' in the script is to rotate the blade barrier so it faces the right direction - otherwise it might be oriented north-south instead of east-west in my area. You will have to experiment with the parameters to GenerateNewLocationFromLocation function to place the barrier where you want it in your area. Also I don't know of an easy way to change the size of the blade barrier.

    Some scripting tips for new scripters:
    Also make sure to use the right tags for the objects - in my area the triggers have tags of TRAP001, TRAP002 and TRAP003, in yours they might be different. Hence I need to call
    GetObjectByTag("TRAP001");
    etc.
    The second script needs to be called customonenterscr when you save it unless you want to change the line which assigns the script to the EffectAreaOfEffect call. So if you save the script as mytrapscript you will need to update the call to be
    eAOE = EffectAreaOfEffect(AOE_PER_WALLBLADE, "mytrapscript");
    

    PS: another tip for this script - make the three triggers you draw on the floor very very small - the south-west corner of each trigger area is used in the script to define its location but the blade barrier will appear with that spot as its centre, so a small trigger area with its corner right on the spot you want to be the center of the barrier is easier to work with since you also have to think about rotating the barrier.
    Now use a fourth trigger area but only as the one which the pc walks on to trigger the trap - this trigger area and be as larger as you want. Just remember to give your trigger areas different tags and call the right ones in your script. The fourth area is the only one which needs to have it's OnEnter script set.


    Post edited by Calgacus on
  • CeyarrecksCeyarrecks Member Posts: 44
    Thank you Calgacus for the input.
    I am sorry, but I can not understand what seems like a thorough amount of information.
    I apologize further, for which I basically wasted yours (and others whom may have read this post) time.
    maybe someday, but certainly not today.
  • CalgacusCalgacus Member Posts: 273
    edited October 2020
    No problem, try this link - it is an example module with the code working. https://drive.google.com/file/d/1DdJ1wDhMjZ-74_S4DbKqTxFD-EcjjsYg/view?usp=sharing
    Post edited by Calgacus on
Sign In or Register to comment.