Skip to content

Drop Rates, NWNVault, and other toolset questions

Hey everyone, I've been working on a new PW but I've been out of the game for about 10 years. Last thing I did was a moderately successful NWN2 PW (Legends of Arcadia). So I'm making good progress but I have lots of questions I would appreciate help with..

1 - It seems like the NWNVault with its sample areas and scripts and all that is gone and no one else really has it hosted. Is there any other good place for this stuff?

2 - When you make a monster drop items, is there a way to specify drop rate? Like if I want to make a baddie Wizard drop the occasional magic wand instead of having your inventory full of 100 of them after 20 minutes.

3 - Whats the best way to make an item kick off a script or conversation? For example if I wanted to make a binding/teleportation stone. So when you got to a totally new section of the map you could get a stone for that area and just teleport back to it.

I appreciate any suggestions you have - thanks

Comments

  • Sylvus_MoonbowSylvus_Moonbow Member Posts: 1,085
    The NWNVault is here.
  • SherincallSherincall Member Posts: 387
    2 - Add or remove items from your dead dudes inventory in the OnDeath creature event.

    3 - NWN "Tag based scripting" might be of interest. Primer: https://nwnlexicon.com/index.php/Grimlar_-_Introduction_To_Tag_Based_Scripting
  • Dreadlord_AnwynDreadlord_Anwyn Member Posts: 48
    edited January 2018
    2 - I wrote this script for my PW mod, The Time of Atlantis. You splice it into the OnSpawn event of the creature, found under the scripts tab. It could easily be modified to include various item tags. Im currently working on a version of it that uses an invisible object chest to be placed where players cannot access it. I then just put every item I want to drop in that area in that chest and use the tag of the chest, the rand() command (to generate a number from 1-25 (basically representing part of a percent), the float to int command to determine what item is plucked from the percent number, and then set a variable on the chest thats an int that is equal to the number of items in the chest (which is where the percent and the float to int (rounds off the decimal) comes in). So basically, then there would be four scripts for any creature on spawn and four scripts for any loot container placeable on open in all areas, one low, one med, one high, one boss. The invisible chest would decide all the loot drops for the area. I got the idea from the old DMFI intiative treasure system.

    But I still have to get to making that series of scripts anyway, this is the simpler version. It uses getting local variables set on the creature to drop a fire beetle eye, and you place it on a fire beetle's on spawn. In a similar fashion, as I mentioned before - you can just modify it to drop whatever by putting the tag of what you want to randomly drop in its variables as a string with the variable named BODYDROP_TAG. You can also change the "drop rate" from 1 in 6 to whatever.

    Oh, and it makes critters that do drop something have a lootable corpse. Its important to not have a module OnSpawn that generates a small amount of treasure. The default expansion scripts are good for that, they generate no treasure for anything. If you dont want the lootable corpse to happen, just comment out the last two lines of SetIsDestroyable and DelayCommand.

    // NAME TA_dropbodybag written for Atlantis mod

    // Function: random chance to drop an item specific to the critter = 1 in 6
    // Examples: fire beetle might drop a fire beetle eye, wolf might drop a wolf skin, goblin might drop a goblin ear....

    //placed OnSpawn, makes corpse lootable if special item is created as loot, otherwise they act normally

    // purpose: some creatures like fire beetles dont have treasure, but might produce something valuable from their corpse
    //set a string variable on the creature named BODYDROP_TAG and set it to the tag of the item to drop



    //inserted scripts into standard on spawn

    //::///////////////////////////////////////////////
    -----------generic onspawn lines here

    //////////////////
    //
    //
    /////BEGINNING OF INSERTED SCRIPT LINES
    //
    //
    // Roll the dice

    int iBodyDrops = d6(1); // change this line if you want different odds

    // Only return if dice roll is a 1

    if(iBodyDrops != 1) //if this is a one, the NPC has a lootable corpse and drops its special item
    { return; }

    // Gets the variable off of the NPC that tells what the tag of the loot item is.

    string sItemTemplate = GetLocalString(OBJECT_SELF, "BODYDROP_TAG");

    CreateItemOnObject(sItemTemplate, OBJECT_SELF, 1);


    SetIsDestroyable(TRUE, FALSE, TRUE);
    DelayCommand(1.0, SetLootable(OBJECT_SELF, TRUE));



    }

    https://neverwintervault.org/project/nwn1/module/gameworld/time-atlantis
  • RifkinRifkin Member Posts: 141
    It's probably more fair to generate droppable items on spawn, and use their local strings for the item list.

    Doing it on spawn will allow rogues to pickpocket it as well, which is a nice feature that rogues can actually utilize.

    Piggy backing off local variables is a great way to make a reuseable script, instead of hard coding your item resrefs, and having 10 million scripts for each and every spawn.


    If you need an example I can grab one of my old scripts and post it here.
  • SherincallSherincall Member Posts: 387
    Rifkin said:

    Piggy backing off local variables is a great way to make a reuseable script, instead of hard coding your item resrefs, and having 10 million scripts for each and every spawn.

    I'd suggest keeping potential items in a chest in a special unreachable area. Then use local variables to decide which chest to pick from; then get a random item from that chest.

    This makes it easier to modify the drop tables - Either edit the chest inventory through the GUI in the toolset, or if you're a PW the DMs can dynamically add/remove items from these chests. No need to mess around with item resrefs, just chest tags, which can be pretty descriptive. E.g.: "loot_mundane", "loot_plusone", "loot_unique", etc..

  • Dreadlord_AnwynDreadlord_Anwyn Member Posts: 48
    edited January 2018
    Yeah, thats how the DMFI did it years ago, they had a special area just for the treasure and monsters one could summon with the wand.

    My personal view is to make a chest for each area, and have four scripts that divide that one chest up into four chunks, as I mentioned above. But this is more of a choice to make each area have its own "loot personality" (since I am making a PW thats open world exploration with different places of origin based on starting PC class and race - thus a ranger/druid place would drop ranger/druid elf stuff and an evil wizard/monk place would drop evil wizard/monk stuff) plus, some areas like non-adventure areas in towns and newbie areas (with stuff like the aforementioned fire beetles) would then not have chests or junk items chests - so they would be safe for DM events because you could spawn high CR creatures and they would then drop none to negligible treasure unless you ploinked it into their inventory from the DM interface.

    At some point, Ill get those scripts done and when I put them on the vault, Ill link it here, It sounds complicated but its not much more than what I did up there with the 'bodybag' script (I have a dark sense of humor and sometimes it shows up in script names).
  • RifkinRifkin Member Posts: 141
    edited February 2018

    Rifkin said:

    Piggy backing off local variables is a great way to make a reuseable script, instead of hard coding your item resrefs, and having 10 million scripts for each and every spawn.

    I'd suggest keeping potential items in a chest in a special unreachable area. Then use local variables to decide which chest to pick from; then get a random item from that chest.

    This makes it easier to modify the drop tables - Either edit the chest inventory through the GUI in the toolset, or if you're a PW the DMs can dynamically add/remove items from these chests. No need to mess around with item resrefs, just chest tags, which can be pretty descriptive. E.g.: "loot_mundane", "loot_plusone", "loot_unique", etc..

    A combination of both would be ideal. If you use a chest, you'll need one for every type of creature/spawn table you need. That, and it opens it up for abuse by other DM's... (Yes, we're supposed to trust our DM team aren't we? Well, you tell that to reality).

    You could have a way to add things to a spawn table if it used Local Variables, you just need to add something to the module variables, and match against tag or resref.

    Anyway, just trying to give me 2 cents on scripting for reusability, and also effective scripting. The container idea is a great addition for the DM interoperability. (You could also make a DM tool that the DM could use and add to a specific tag/resref of creature's spawn table, via SetLocalObject on the module, no need to go to a special area and drop items in a container)
  • henesuahenesua Member Posts: 62
    I have a loot system that allows you to identify one or more merchants as a source for items on each creature or placeable to be looted.

    https://neverwintervault.org/project/nwn1/script/magus-loot-system
Sign In or Register to comment.