Help with Random Loot Drops
#1
Posté 06 avril 2015 - 05:45
#2
Posté 06 avril 2015 - 06:23
Loot generation is usually done in the On Spawn script, so that rogues don't get that annoying "Target has no items or gold" message when they try to pickpocket them, only to find loot magically appearing on them when they die.
- GCoyote aime ceci
#3
Posté 06 avril 2015 - 06:28
#4
Posté 06 avril 2015 - 06:35
That sounds like such a special case that I would personally probably go with a special heartbeat script that checks the quest stage and generates the appropriate item for that stage if one doesn't already exist, and makes sure that no other stage's items exist. This is assuming that you consider pickpocketing a valid means of acquiring the item*. Otherwise, you can go with the simpler solution of generating the stage-appropriate item on the creature's death.
* For instance, in my campaign, I put a quest item on a boss that was difficult, but not impossible, to pickpocket, and by doing so you could bypass an entire scripted boss battle, or at least prevent the boss from summoning reinforcements.
- GCoyote aime ceci
#5
Posté 06 avril 2015 - 07:53
#6
Posté 07 avril 2015 - 03:18
the call to generate loot 'specially.
#7
Posté 07 avril 2015 - 12:15
If you are interested, the base module is here http://neverwinterva...-evil-revisited
Nearly all the scripts are still the same as this original work. Scripting is the part I'm least comfortable with so I don't touch anything that still works.
#8
Posté 07 avril 2015 - 10:34
I need mod/area/creature info.
#9
Posté 11 avril 2015 - 01:58
Well it turns out that the original author used nw_c2_default9 to generate the loot drops.
The problem is that it generates really random treasure, e.g. my Lizardman Berzerkers occasionally drop one or more scrolls they obviously cannot cast. However, since this isn't a short custom script I can fix in thirty minutes, I'm going to move this to the "do later" list.
// NW_C2_DEFAULT9
/*
Default OnSpawn handler
To create customized spawn scripts, use the "Custom OnSpawn" script template.
*/
//:://////////////////////////////////////////////////
//:: Copyright © 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 12/11/2002
//:://////////////////////////////////////////////////
//:: Updated 2003-08-20 Georg Zoeller: Added check for variables to active spawn in conditions without changing the spawnscript
// ChazM 6/20/05 ambient anims flag set on spawn for encounter cratures.
// ChazM 1/6/06 modified call to WalkWayPoints()
// DBR 2/03/06 Added option for a spawn script (AI stuff, but also handy in general)
// ChazM 8/22/06 Removed reference to "kinc_globals".
// ChazM 3/8/07 Added campaign level creature spawn modifications script. Moved excess commented code out to template.
// ChazM 4/5/07 Incorporeal creatures immune to non magic weapons
// JSH-OEI 5/1/08 - Check creature type before spawning random treasure.
#include "x0_i0_anims"
#include "x0_i0_treasure"
#include "x2_inc_switches"
void main()
{
// Run this campaign's standard creature spawn modifications script (set in module load)
string sScriptSpawnCreature = GetGlobalString("N2_SCRIPT_SPAWN_CREATURE");
if (sScriptSpawnCreature != "")
{
ExecuteScript(sScriptSpawnCreature, OBJECT_SELF);
}
// ***** Spawn-In Conditions ***** //
// See x2_inc_switches for more information about these
// Enable stealth mode by setting a variable on the creature
// Great for ambushes
if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_USE_SPAWN_STEALTH) == TRUE)
{
SetSpawnInCondition(NW_FLAG_STEALTH);
}
// Make creature enter search mode after spawning by setting a variable
// Great for guards, etc
if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_USE_SPAWN_SEARCH) == TRUE)
{
SetSpawnInCondition(NW_FLAG_SEARCH);
}
// Enable immobile ambient animations by setting a variable
if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_USE_SPAWN_AMBIENT_IMMOBILE) == TRUE)
{
SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS);
}
// Enable mobile ambient animations by setting a variable
if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_USE_SPAWN_AMBIENT) == TRUE)
{
SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);
}
// ***** DEFAULT GENERIC BEHAVIOR ***** //
// * Goes through and sets up which shouts the NPC will listen to.
SetListeningPatterns();
// * Walk among a set of waypoints if they exist.
// * 1. Find waypoints with the tag "WP_" + NPC TAG + "_##" and walk
// * among them in order.
// * 2. If the tag of the Way Point is "POST_" + NPC TAG, stay there
// * and return to it after combat.
//
// * If "NW_FLAG_DAY_NIGHT_POSTING" is set, you can also
// * create waypoints with the tags "WN_" + NPC Tag + "_##"
// * and those will be walked at night. (The standard waypoints
// * will be walked during the day.)
// * The night "posting" waypoint tag is simply "NIGHT_" + NPC tag.
WalkWayPoints(FALSE, "spawn");
//* Create a small amount of treasure on the creature
if (GetLocalInt(GetModule(), "X2_L_NOTREASURE") == FALSE
&& GetLocalInt(OBJECT_SELF, "X2_L_NOTREASURE") == FALSE
&& GetRacialType(OBJECT_SELF) != RACIAL_TYPE_ANIMAL
&& GetRacialType(OBJECT_SELF) != RACIAL_TYPE_BEAST
&& GetRacialType(OBJECT_SELF) != RACIAL_TYPE_CONSTRUCT
&& GetRacialType(OBJECT_SELF) != RACIAL_TYPE_ELEMENTAL
&& GetRacialType(OBJECT_SELF) != RACIAL_TYPE_VERMIN)
{
if (GetChallengeRating(OBJECT_SELF) <= 5.0)
{
CTG_GenerateNPCTreasure(TREASURE_TYPE_LOW, OBJECT_SELF);
}
else if (GetChallengeRating(OBJECT_SELF) >5.0 && GetChallengeRating(OBJECT_SELF) <=10.0)
{
CTG_GenerateNPCTreasure(TREASURE_TYPE_MED, OBJECT_SELF);
}
else
{
CTG_GenerateNPCTreasure(TREASURE_TYPE_HIGH, OBJECT_SELF);
}
}
// encounter creatures use ambient animations
if (GetIsEncounterCreature())
SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS, TRUE);
// * If Incorporeal, apply changes
if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_IS_INCORPOREAL) == TRUE)
{
effect eConceal = EffectConcealment(50, MISS_CHANCE_TYPE_NORMAL);
eConceal = ExtraordinaryEffect(eConceal);
effect eGhost = EffectCutsceneGhost();
eGhost = ExtraordinaryEffect(eGhost);
effect eImmuneToNonMagicWeapons = EffectDamageReduction(1000, DAMAGE_POWER_PLUS_ONE, 0, DR_TYPE_MAGICBONUS);
eImmuneToNonMagicWeapons = ExtraordinaryEffect(eImmuneToNonMagicWeapons);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eConceal, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eImmuneToNonMagicWeapons, OBJECT_SELF);
}
if (GetLocalInt(OBJECT_SELF, "NX2_NO_ORIENT_ON_DIALOG"))
SetOrientOnDialog(OBJECT_SELF, FALSE);
//DBR 2/03/06 - added option for a spawn script (ease of AI hookup)
string sSpawnScript=GetLocalString(OBJECT_SELF,"SpawnScript");
if (sSpawnScript!="")
ExecuteScript(sSpawnScript,OBJECT_SELF);
}
#10
Posté 11 avril 2015 - 03:02
//* Create a small amount of treasure on the creature
if ( GetLocalInt(GetModule(), "X2_L_NOTREASURE") == FALSE
&& GetLocalInt(OBJECT_SELF, "X2_L_NOTREASURE") == FALSE
&& GetRacialType(OBJECT_SELF) != RACIAL_TYPE_ANIMAL
&& GetRacialType(OBJECT_SELF) != RACIAL_TYPE_BEAST
&& GetRacialType(OBJECT_SELF) != RACIAL_TYPE_CONSTRUCT
&& GetRacialType(OBJECT_SELF) != RACIAL_TYPE_ELEMENTAL
&& GetRacialType(OBJECT_SELF) != RACIAL_TYPE_VERMIN)
{
if (GetChallengeRating(OBJECT_SELF) <= 5.0)
{
CTG_GenerateNPCTreasure(TREASURE_TYPE_LOW, OBJECT_SELF);
}
else if (GetChallengeRating(OBJECT_SELF) > 5.0
&& GetChallengeRating(OBJECT_SELF) <= 10.0)
{
CTG_GenerateNPCTreasure(TREASURE_TYPE_MED, OBJECT_SELF);
}
else
{
CTG_GenerateNPCTreasure(TREASURE_TYPE_HIGH, OBJECT_SELF);
}
}generation is separated into 3 categories based on the ChallengeRating that's set on the creature's instance/blueprint
CR < 5, do TREASURE_TYPE_LOW
CR < 10, do TREASURE_TYPE_MED
CR < bazillion, do TREASURE_TYPE_HIGH
(in that order) So, check the CR on those blueprints/instances. If those look okay,
CTG_GenerateNPCTreasure() is a function in #include "x0_i0_treasure". There is a bunch of documentation in that file about this default treasure system ... there are ofc other treasure systems around. but to stick with this one atm:
if you copy 'nw_c2_default9' to your Campaign or module directory, you could edit the GetChallengeRating() conditions, like
- give LOW treasure to CR < 3
- give MED treasure to CR < 8
- give HIGH to any CR above that
( but yeh, i don't think too much about the default treasures either )
... this looks interesting in the docs
// Major treasure categories int TREASURE_TYPE_LOW = 1; int TREASURE_TYPE_MED = 2; int TREASURE_TYPE_HIGH = 3; int TREASURE_TYPE_UNIQUE = 4; int TREASURE_TYPE_MONSTER = 5;
- GCoyote aime ceci
#11
Posté 11 avril 2015 - 04:20
Yeah, I noticed that part and it would be about that easy. However, I'd really like to increase both the variety and relevance of the loot to the context of the campaign. I've already modified all of the non-random treasure to align with the theme of the module.
Second problem is running out of time. If I don't get the first build up soon, I'm going to get into the summer travel season and it will be six more months.
#13
Posté 11 avril 2015 - 04:48
I'd really like to increase both the variety and relevance of the loot to the context of the campaign.
unless you find what you like in SoZ, i figur you're looking at long hours and long tables of item-tags. Or you could rely mostly on one of the stock systems but write a smaller table w/ more relevant loot, that gets called at some probability instead
- GCoyote aime ceci
#14
Posté 11 avril 2015 - 07:38
If you want to create specific random loot tables for specific creatures, I'd recommend the SoZ loot system, which I documented in a tutorial.
The original module only required the OC to be installed but I've already decided to add some features from the expansions. So the SoZ loot system looks like the way to go when I get to the final release. I have a couple more bugged quests to sort out but the project is otherwise playable as-is.





Retour en haut






