Author Topic: Help with encounterless encounters needed, Please  (Read 390 times)

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Help with encounterless encounters needed, Please
« on: September 29, 2014, 02:44:22 pm »


               

I am currently trying to develop a trick/trap/puzzle and have hit a problem. I need to have some means of spawning an encounter that will automatically scale in difficulty without the pc having to actually walk into a trigger. I need the encounter to be able to be triggered an arbitrary number of times, once for each time the pc messes up.


Is either of these possible?


 


  1. To activate and trigger an inactive encounter trigger purely by scripting or

  2.    
  3. To activate the scripts behind an encounter without an encounter trigger being present


If not, is there some script system that I could use, that is already available?


Thanks for any help


TR



               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Help with encounterless encounters needed, Please
« Reply #1 on: September 29, 2014, 03:55:14 pm »


               

1) Do you want the encounter(s) to scale based on the PCs CR rating or simply their level?


 


2) Will this fire based on the wrong choice made in a conversation or will something else trigger it?


 


3) Will the encounters be a single creature, group of creatures or a mix of either based on CR/level of the PC?


 


4) What levels/CRs do the encounters need to scale through? I.e., is the puzzle something unlikely to ever be encountered by a PC below 10th level? If so, then we'd set the lowest scale to 10 or lower and go up from there. On the other hand, if there's a maximum level of 20th in the area, it doesn't make sense to scale the system clear to 40th (at least in this instance).


               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Help with encounterless encounters needed, Please
« Reply #2 on: September 29, 2014, 07:57:12 pm »


               

Thanks for the response.


  1. Their CR as I want it to be as close to an ordinary encounter as possible

  2.    
  3. This is not a conversion based script but determined at the end of a sequence of actions (natural language not programming)

  4.    
  5. I'll be quite specific here as it is intended to spawn a group of undead. The number and type of which to be determined by the PC's CR

  6.    
  7. There are no level limits at either end.

This is something that I am trying to build for this month's ravenloft ccc. I only had the idea for it in the last week and it may well end up being an addendum to it. I have determined all the pieces needed for it and what scripts I need to write. I thought that I had a script to do what I am asking here but obviously I mis-remembered. If you would like a more detailed explanation of what I am trying to do, please pm me.


 


Thanks again


 


TR



               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Help with encounterless encounters needed, Please
« Reply #3 on: September 30, 2014, 01:07:44 am »


               

Here's a quick small example using a conversation node. You'll just need to redefine object oPC if you use another method. The creatures appear at a waypoint tagged "SPAWNHERE". I generally use a half second delay in these type of scripts to limit chances of -invis bugs- on the NPCs spawning in too fast and close as well. Keep in mind that "GetChallengeRating" also returns a float and takes a little thought to apply at times.


 


Example A:



void CreateObjectVoid(int nObjectType, string sTemplate, location lLoc, int bUseAppearAnimation = FALSE)

{

    object oVoid = CreateObject(nObjectType, sTemplate, lLoc, bUseAppearAnimation);

}

void main()

{

object oPC = GetPCSpeaker(); //or whatever else you define oPC as

if (!GetIsPC(oPC)) return;

object oTarget = GetNearestObjectByTag("SPAWNHERE");

location lTarget = GetLocation(oTarget);

float fPCCR = GetChallengeRating(oPC);


if (fPCCR <= 1.0)

   {

   CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget);

   return;

   }

else if (fPCCR <= 2.0 && fPCCR >= 1.01)

   {

   CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget);

   DelayCommand(0.5, CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget));

   return;

   }

else if (fPCCR <= 3.0 && fPCCR >= 2.01)

   {

   CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget);

   DelayCommand(0.5, CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget));

   DelayCommand(1.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget));

   return;

   }


////incomplete, fill in as desired

else if (fPCCR <= 40.0 && fPCCR >= 36.0)

   {

   CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget);

   DelayCommand(0.5, CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget));

   DelayCommand(1.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget));

   DelayCommand(1.5, CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget));

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

   return;

   }

   }


 


If you'd rather deal in whole numbers, we can round the float values to the nearest whole number and do something like below.


 


Example B:



void CreateObjectVoid(int nObjectType, string sTemplate, location lLoc, int bUseAppearAnimation = FALSE)

{

    object oVoid = CreateObject(nObjectType, sTemplate, lLoc, bUseAppearAnimation);

}

void main()

{

object oPC = GetPCSpeaker(); //or whatever else you define oPC as

if (!GetIsPC(oPC)) return;

object oTarget = GetNearestObjectByTag("SPAWNHERE");

location lTarget = GetLocation(oTarget);

int iPCCR = FloatToInt(GetChallengeRating(oPC));


if (iPCCR <= 1)

   {

   CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget);

   return;

   }

else if (iPCCR <= 3 && iPCCR >= 2)

   {

   CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget);

   DelayCommand(0.5, CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget));

   return;

   }

else if (iPCCR <= 5 && iPCCR >= 4)

   {

   CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget);

   DelayCommand(0.5, CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget));

   DelayCommand(1.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget));

   return;

   }

////incomplete, fill in as desired

else if (iPCCR <= 40 && iPCCR >= 36)

   {

   CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget);

   DelayCommand(0.5, CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget));

   DelayCommand(1.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget));

   DelayCommand(1.5, CreateObjectVoid(OBJECT_TYPE_CREATURE, "nw_zombie01", lTarget));

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

   return;

   }

   }


 


Lemme know if you need help with getting it to fire via something other than a convo.



               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Help with encounterless encounters needed, Please
« Reply #4 on: September 30, 2014, 01:29:37 am »


               

Thank you so much. I will let you know if I need further help with this. I just want to ask if you have any sort of a problem with me including this (with full attribution) as part of a submission for the custom content challenge that I mentioned in my previous post?


 


BTW If you use (without the extra spaces) [ c o d e ] at the start and [ / c o d e ] at the end of any code you post, that code will have syntax colouring as seen in my post containing code in this thread.


 


Again, Thank you


 


TR



               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Help with encounterless encounters needed, Please
« Reply #5 on: September 30, 2014, 03:35:43 am »


               


Thank you so much. I will let you know if I need further help with this. I just want to ask if you have any sort of a problem with me including this (with full attribution) as part of a submission for the custom content challenge that I mentioned in my previous post?


 


BTW If you use (without the extra spaces) [ c o d e ] at the start and [ / c o d e ] at the end of any code you post, that code will have syntax colouring as seen in my post containing code in this thread.


 


Again, Thank you


 


TR




Use it as you you will, with or without a credit. '<img'>


 


As for how to post code here, I prefer the non-colored result of doing it as a quote as apposed to the hard to read (for me at least) display the way you mentioned. I find myself having to highlight most code posts here to better read them when they are multicolored. Just my preferences though.


               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Help with encounterless encounters needed, Please
« Reply #6 on: October 01, 2014, 10:37:02 pm »


               

I think I have something that should work for my ccc project. What I need now are comments not so much on the code itself but rather whether I have set the progression of difficulty right. Don't get me wrong, I'll still welcome constructive criticism of the code. It's just that it is the rate of increase of difficulty that I have set within the code that I am more unsure of.


 


What I have done is create a spreadsheet with the name, tag, resref and CR of each of the standard undead monsters that are part of NwN 1.69. I then sorted them by the CR's from smallest to largest and used the result to determine the progression of difficulty. In the code, as the PC's CR is a floating point number, I use half a CR (0.5) increments to determine what undead to unleash on the player. I have put the xls file along with a plain text version of the code into a 7z archive and placed that into my dropbox public folder. It can be downloaded from here.


 


One little word of warning - the code is not commented at all. That will come when I am satisfied with it. Also there are quite a few lines to it.  '<img'>


 


Thanks in advance.


 


TR



               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Help with encounterless encounters needed, Please
« Reply #7 on: October 02, 2014, 11:22:10 pm »


               

A few of your selections might have some issues, mainly the vampires/gaseous clouds as those need coffins to work properly.


 


Scaling and CR gets kind of broken in NWN, especially from 20 on so I'd suggest just scaling from 1-20+ instead of a full 40 progression, unless you plan on creating some custom creatures for the module too.



               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Help with encounterless encounters needed, Please
« Reply #8 on: October 03, 2014, 10:46:01 am »


               

Actually as I am only going up in 0.5 of a PC's CR I am only going from 0.5 to 20 (I checked the CR of some NPCs and some 1st level thieves only had a CR of <= .5). I'll double check on the gaseous clouds but for what I am attempting to make "solid" vampires are OK.


 


Thanks for the feedback.


 


TR