Author Topic: NWN scripting help/question  (Read 406 times)

Legacy_John Draugr

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
NWN scripting help/question
« on: July 02, 2014, 06:38:48 am »


               

Hi all.


 


I've gotten the itch to play NWN again. Actually, it started when a concept came to me and I thought about how to implement it in a game. NWN was an obvious choice because of its ability to create custom modules and scripts.


 


Anyhow, I wanted to ask if the following concepts might be possible via scripting. I am not a programmer or scripter, but hopefully I can figure this out. What I'd like to know is this...


 


1. Is it possible to script code that will run a timer countdown and when the timer reaches 0 (zero) the script would teleport the PC and any henchmen, or pets back to a specific starter area?


 


2. Would it be possible to create an item that randomly spawns in chests or other containers that when used would add time (5 sec for example) to the countdown timer so one can extend the timer as explained in #1 above?


 


3. The final script I'd need I imagine would be the most complex. Is it possible to...


 


Have the player enter a doorway that would run a script that would then randomly pull a pre-made area and place the hero at the entrance to the randomly chosen area? This would sort of create a random dungeon or area path for the hero.


 


The goal is to have the player start in a central area/town then enter a portal to a dungeon challenge "Dungeon 1 (Low Level Challenge)". Upon stepping through the portal the script would randomly pick an area from a list and place the hero at the start location for that area. The countdown timer would then begin and the hero would either have to defeat all the monsters within time, or escape through another portal, or doorway which would then randomly pick another area from a totally different set of pre-made areas.


 


The goal would be to have the player enter Area 1 (randomly chosen), then exit Area 1 and enter Area 2 (Again randomly chosen by a different set of pre-made areas). Finally when exiting area 2, a script would pick a 3rd and final (BOSS) area for the hero to enter and fight off the spawned boss before exiting back to the town via the exit portal that would appear only after the boss monster is dead.


 


I know this might not be too complex to create, or perhaps it is. If anyone has any advice that might help me accomplish these scripts I'd appreciate it. I'm especially hoping to find out whether these scripts can be coded in NWN or whether or not they are impossible due to the limitations of the game.


 


Any help is appreciated. If I can get this scripting part done, I feel I have a pretty cool concept for a module that might entertain players.


 


Some possible features if the above scripting can be accomplished might be...


 


1. High Score Tables


 


2. A multiplayer HUB (City) where players can chat, trade items, etc... before entering one of the many "Challenge Dungeons".


 


3. A long shot, but perhaps the ability to form a party and have the entire party work together in a challenge. I think this would make the above scripts too complex and thus, I don't think this would be possible.


 


Anyhow, thanks for reading my post.


 


John



               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
NWN scripting help/question
« Reply #1 on: July 02, 2014, 10:20:35 am »


               

Actually EVERYTHING you mentioned above is completely doable in NWN.


 


The 3rd one is actually probably the easiest. Could do someting as simple as:


 


void main()

{

    object oPC = GetEnteringObject();

    string sDestination;

    switch (Random(6)+1)

    {

        case 1: sDestination = "waypoint_1" ;break;

        case 2: sDestination = "waypoint_2" ;break;

        case 3: sDestination = "waypoint_3" ;break;

        case 4: sDestination = "waypoint_4" ;break;

        case 5: sDestination = "waypoint_5" ;break;

        case 6: sDestination = "waypoint_6" ;break;

    }


    object oWP = GetObjectByTag(sDestination);

    if (GetIsObjectValid(oWP))

    {

        AssignCommand(oPC, ActionJumpToObject(oWP));

    }

}


 


But you could also make it a little more complex to where you put everything into one script. Maybe depending on the area the player is in or a variable on them, the one script could be reused to just keep taking them to the next random area from the area they are cuttently in, etc.



               
               

               
            

Legacy_John Draugr

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
NWN scripting help/question
« Reply #2 on: July 02, 2014, 12:08:45 pm »


               

Wait... Is that actual NWN script code? If so it looks like C++ or Turbo Pascal. Been close to 2 decades since I used them in college. If NWN scripting is that robust, I can definitely see making those features doable. Is there a place to get NWN scripting commands or such? NWN Vault sadly seems to be gone and was the only place I used to go to for modules and stuff in the past.


 


Thanks for the above info. I'll try to make a go of it.


 


John


               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
NWN scripting help/question
« Reply #3 on: July 02, 2014, 12:17:22 pm »


               

You want the Lexicon - http://palmergames.c...xicon_1_69.html



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
NWN scripting help/question
« Reply #4 on: July 02, 2014, 12:58:37 pm »


               The current version is here.

The new vault is worth a visit, too.
               
               

               
            

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
NWN scripting help/question
« Reply #5 on: July 02, 2014, 03:57:25 pm »


               

The randomized dungeon system is very doable, though as with anything, the devil is in the details.  I created a system we use on Arenthyor to run our dungeons.


 


A few things to consider:


1)  When a PC enters the dungeon, any PCs who follow should follow the same path through the dungeon.  In essence, the first PC acts as a trailblazer while other PCs following travel in his path.


2)  If PCs turn around while inside the dungeon, they should exit in the reverse order of the doors and maps they went in through


3)  You should decide if you want to prevent duplicate instances of maps during a dungeon crawl.  If a PC goes through a map, should that map no longer be considered for use again in that instance of the dungeon?  There's a risk of getting PCs stuck in loops if an area's exit accidentally leads back to the area's entrance.


4)  When all PCs leave the dungeon, you should reset the links between maps so that the next PC/party gets a random experience.


5)  Do all dungeons have an 'ending' or do you want to allow for dead ends?


 


Take a look at the Infinite Dungeon premium module which has a very basic random dungeon generator in it.



               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
NWN scripting help/question
« Reply #6 on: July 03, 2014, 01:58:06 pm »


               


The current version is here.


The new vault is worth a visit, too.




 


Thanks Proleric, I'll update my links. Is that version downloadable?


               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
NWN scripting help/question
« Reply #7 on: July 03, 2014, 05:44:36 pm »


               The latest version is a wiki, online by design.


I keep an old download around for offline reference, but rarely need it, these days.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
NWN scripting help/question
« Reply #8 on: July 03, 2014, 06:46:39 pm »


               


Thanks Proleric, I'll update my links. Is that version downloadable?




Wiki admin (Squatting Monk) should be able to make this possible. Try contact him.