Code: |
//:///////////////////////// /////////////////////
//:: Heartbeat personnalise //:: RAV_ANIMHB //:///////////////////////// //////////////////// /* Animations personnalisees */ //:///////////////////////// //////////////////// //:: Created By: Serge GANDOLPHE //:: Created On: 13 fevrier 2003 //:///////////////////////// //////////////////// #include "NW_I0_GENERIC" #include "nw_i0_plot" void main() { //if(!GetIsInCombat() && !IsInConversation(OBJECT_SELF) ) // ActionRandomWalk(); if(GetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY)) { if(TalentAdvancedBuff(40.0)) { SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY, FALSE); return; } } if(GetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING)) { int nDay = FALSE; if(GetIsDay() || GetIsDawn()) { nDay = TRUE; } if(GetLocalInt(OBJECT_SELF, "NW_GENERIC_DAY_NIGHT") != nDay) { if(nDay == TRUE) { SetLocalInt(OBJECT_SELF, "NW_GENERIC_DAY_NIGHT", TRUE); } else { SetLocalInt(OBJECT_SELF, "NW_GENERIC_DAY_NIGHT", FALSE); } WalkWayPoints(); } } if(!GetHasEffect(EFFECT_TYPE_SLEEP)) { if(!GetIsPostOrWalking()) { if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget())) { if(!GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN))) { if(!GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL) && !IsInConversation(OBJECT_SELF)) { if(GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS) || GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS_AVIAN)) { PlayMobileAmbientAnimations(); } else if(GetIsEncounterCreature() && !GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN))) { PlayMobileAmbientAnimations(); } else if(GetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS) && !GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN))) { PlayImmobileAmbientAnimations(); } } else { DetermineSpecialBehavior(); } } else { //DetermineCombatRound(); } } } } else { if(GetSpawnInCondition(NW_FLAG_SLEEPING_AT_NIGHT)) { effect eVis = EffectVisualEffect(VFX_IMP_SLEEP); if(d10() > 6) { ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF); } } } if(GetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT)) { SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } //Ca se passe ici /*Le jour le pnj se ballade dans le village et a la tombee de la nuit il rentre chez lui*/ if(GetLocalInt(OBJECT_SELF,"isoutside")) { if((GetIsNight() || GetIsDusk()) && !GetLocalInt(OBJECT_SELF,"movedinside")){ SetLocalInt(OBJECT_SELF,"isoutside", FALSE); SetLocalInt(OBJECT_SELF,"movedoutside",FALSE); SetLocalInt(OBJECT_SELF,"movedinside",TRUE); ClearAllActions(TRUE); EscapeArea(FALSE,"EXIT_"+GetTag(OBJECT_SELF)); object OPnj = CreateObject(OBJECT_TYPE_CREATURE,GetResRef(OBJECT_SELF),GetLocation(GetWaypointByTag("NIGHT_"+GetTag(OBJECT_SELF)))); DestroyObject(OBJECT_SELF,10.0f);//Pour etre certain de ne pas avoir de clones } } else{ if((GetIsDay() || GetIsDawn()) && !GetLocalInt(OBJECT_SELF,"movedoutside")){ SetLocalInt(OBJECT_SELF,"isoutside", TRUE); SetLocalInt(OBJECT_SELF,"movedoutside",TRUE); SetLocalInt(OBJECT_SELF,"movedinside",FALSE); ClearAllActions(TRUE); EscapeArea(FALSE,"EXIT_"+GetTag(OBJECT_SELF)); object OPnj = CreateObject(OBJECT_TYPE_CREATURE,GetResRef(OBJECT_SELF),GetLocation(GetWaypointByTag("DAY_"+GetTag(OBJECT_SELF)))); DestroyObject(OBJECT_SELF,10.0f); } } } |
Code: |
//:///////////////////////// /////////////////////
//:: Default: On Spawn In //:: rav_os_commoner //:: Par Serge GANDOLPHE //:///////////////////////// //////////////////// /* Determines the course of action to be taken after having just been spawned in */ //:///////////////////////// //////////////////// //:: Created By: Preston Watamaniuk //:: Created On: Oct 25, 2001 //:///////////////////////// //////////////////// #include "NW_O2_CONINCLUDE" #include "NW_I0_GENERIC" void main() { //Ici il faut lister vos zones de JOUR!!!! //Remplacez simplement zone1 et zone2 par les tags de vos zones et rajoutez autant de || areaTag =="zonex" que vous avez de zones de jour string areaTag = GetTag(GetArea(OBJECT_SELF)); if(areaTag =="valkenas" || areaTag =="valkenasecurie" || areaTag =="valkenasmoulin" || areaTag =="valkenasferme" || areaTag =="valkenashouse1" || areaTag =="valkenashouse2" ){ SetLocalInt(OBJECT_SELF,"isoutside", TRUE); SetLocalInt(OBJECT_SELF,"movedoutside",TRUE); SetLocalInt(OBJECT_SELF,"movedinside",FALSE); } else{ SetLocalInt(OBJECT_SELF,"isoutside", FALSE); SetLocalInt(OBJECT_SELF,"movedoutside",FALSE); SetLocalInt(OBJECT_SELF,"movedinside",TRUE); } // OPTIONAL BEHAVIORS (Comment In or Out to Activate ) ****************************** ****************************** **************** //SetSpawnInCondition(NW_FLAG_ SPECIAL_CONVERSATION); //SetSpawnInCondition(NW_FLAG_ SPECIAL_COMBAT_CONVERSATION); // This causes the creature to say a special greeting in their conversation file // upon Perceiving the player. Attach the [NW_D2_GenCheck.nss] script to the desired // greeting in order to designate it. As the creature is actually saying this to // himself, don't attach any player responses to the greeting. //SetSpawnInCondition(NW_FLAG_ SHOUT_ATTACK_MY_TARGET); // This will set the listening pattern on the NPC to attack when allies call //SetSpawnInCondition(NW_FLAG_ STEALTH); // If the NPC has stealth and they are a rogue go into stealth mode //SetSpawnInCondition(NW_FLAG_ SEARCH); // If the NPC has Search go into Search Mode //SetSpawnInCondition(NW_FLAG_ SET_WARNINGS); // This will set the NPC to give a warning to non-enemies before attacking //SetSpawnInCondition(NW_FLAG_ SLEEP); //Creatures that spawn in during the night will be asleep. //SetSpawnInCondition(NW_FLAG_ DAY_NIGHT_POSTING); //SetSpawnInCondition(NW_FLAG_ APPEAR_SPAWN_IN_ANIMATION); //SetSpawnInCondition(NW_FLAG_ IMMOBILE_AMBIENT_ANIMATIONS); //SetSpawnInCondition(NW_FLAG_ AMBIENT_ANIMATIONS); //This will play Ambient Animations until the NPC sees an enemy or is cleared. //NOTE that these animations will play automatically for Encounter Creatures. // NOTE: ONLY ONE OF THE FOLOOWING ESCAPE COMMANDS SHOULD EVER BE ACTIVATED AT ANY ONE TIME. //SetSpawnInCondition(NW_FLAG_ ESCAPE_RETURN); // OPTIONAL BEHAVIOR (Flee to a way point and return a short time later.) //SetSpawnInCondition(NW_FLAG_ ESCAPE_LEAVE); // OPTIONAL BEHAVIOR (Flee to a way point and do not return.) //SetSpawnInCondition(NW_FLAG_ TELEPORT_LEAVE); // OPTIONAL BEHAVIOR (Teleport to safety and do not return.) //SetSpawnInCondition(NW_FLAG_ TELEPORT_RETURN); // OPTIONAL BEHAVIOR (Teleport to safety and return a short time later.) // CUSTOM USER DEFINED EVENTS /* The following settings will allow the user to fire one of the blank user defined events in the NW_D2_DefaultD. Like the On Spawn In script this script is meant to be customized by the end user to allow for unique behaviors. The user defined events user 1000 - 1010 */ //SetSpawnInCondition(NW_FLAG_ HEARTBEAT_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1001 //SetSpawnInCondition(NW_FLAG_ PERCIEVE_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1002 //SetSpawnInCondition(NW_FLAG_ ATTACK_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1005 //SetSpawnInCondition(NW_FLAG_ DAMAGED_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1006 //SetSpawnInCondition(NW_FLAG_ DISTURBED_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1008 //SetSpawnInCondition(NW_FLAG_ END_COMBAT_ROUND_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1003 //SetSpawnInCondition(NW_FLAG_ ON_DIALOGUE_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1004 //SetSpawnInCondition(NW_FLAG_ DEATH_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1007 // DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ****************************** ****************************** ***************************** SetListeningPatterns(); // Goes through and sets up which shouts the NPC will listen to. WalkWayPoints(); // Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0) // 1. Looks to see if any Way Points in the module have the tag "WP_" + NPC TAG + "_0X", if so walk them // 2. If the tag of the Way Point is "POST_" + NPC TAG the creature will return this way point after // combat. GenerateNPCTreasure(); //* Use this to create a small amount of treasure on the creature } |
Code: |
int GetIsPostOrWalking(object oWalker = OBJECT_SELF) { if (!GetWalkCondition(NW_WALK_FLAG_INITIALIZED, oWalker)) { AssignCommand(oWalker, LookUpWalkWayPoints(GetWWPController(oWalker))); } string sPrefix = GetWPPrefix(); if (GetLocalInt(oWalker, sPrefix +"NUM") > 0) return TRUE; return FALSE; } |
Code: |
// nw_i0_generic
/* //:://///////////////////////////////////////////// //:: Generic Scripting Include v1.0 //:: NW_I0_GENERIC //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// December 7 2002, Naomi Novik Many functions removed to separate libraries: x0_i0_behavior behavior constants SetBehaviorState GetBehaviorState x0_i0_anims PlayMobileAmbientAnimations_NonAvian PlayMobileAmbientAnimations_Avian (with PlayMobileAmbientAnimations changed to just a call to one of these two) PlayImmobileAmbientAnimations | x0_i0_walkway WalkWayPoints RunNextCircuit RunCircuit CheckWayPoints GetIsPostOrWalking | x0_i0_spawncond OnSpawn condition constants SetSpawnInCondition GetSpawnInCondition SetSpawnInLocals SetListeningPatterns | x0_i0_combat Combat Conditions and Special abilities | x0_i0_talent ALL the talent functions | nwn2_inc_talent Warlock and other new talents - mostly an addendum to x0_i0_talent | x0_inc_generic Pretty much everything else | x0_i0_equip Equipping functions | x0_i0_enemy Finding/Identifying Enemies | x0_i0_match Matching functions x0_i0_assoc associate constants (NW_ASC_...) GetPercentageHPLoss (only used in GetAssociateHealMaster) SetAssociateState GetAssociateState ResetHenchmenState AssociateCheck GetAssociateHealMaster GetFollowDistance SetAssociateStartLocation GetAssociateStartLocation x0_i0_debug MyPrintString DebugPrintTalentId newdebug ***********************************************' CHANGE SUMMARY February 6 2003: Commented out the Henchman RespondToShout because now using the newer bkRespondToShout function in x0_i0_henchman September 18 2002: DetermineCombatRound broken into smaller functions 19 : Removed randomness from Talent system. You can't have smart AI and random behavior. Only healing has the possiblity of being random. I may want to add the possibility of getting a random talent only in the Talent filter if something fails (*) ******************************************** WARNING THIS SCRIPT IS CHANGED AT YOUR PERIL ******************************************** This is the master generic script and currently handles all combat and some plot behavior within NWN. If this script is tampered with there is a chance of introducing game breaking bugs. But other than that enjoy. */ //:: Created By: Preston Watamaniuk //:: Created On: Sept 20, 2001 // 6/22/05 ChazM - changed commoners to always attempt to flee in chooseTactics() // 7/29/05 EPF (OEI) - Short circuited combat if creature is attacking a party member who's in a conversation // 3/10/06 BMA-OEI - modified GetIsInCutscene() to check only the PC party // 6/6/06 EPF - Incorporated new Warlock spellcasting AI, made additions for Warlock invisibility AI. // 6/6/06 ChazM - Incorporated prestige classes // 6/20/06 ChazM - Fixed Barbarian Rage. // 6/21/06 ChazM - Fixed Frenzy of Frenzied Berserker. Fix to DetermineClassToUse() // 9/07/06 DBR - To prevent knockdown overuse we moved it to a talent in chooseTactics() // 9/12/06 DBR - Removed MoveToPoint as a case where combat rounds are turned off. __IsInCombatRound() // 9/13/06 DBR - Moved random chance of knockdown from TalentKnockdown() in x0_i0_talent to chooseTactics(). // 9/19/06 ChazM - Removed excess commented code. // 9/22/06 DBR - Prevented BashDoorCheck() from letting a creature run standard tactics if oIntruder was a door. // - Also invalidated target if the creature was trying to attack a trigger or non-usable object (since they can't) // ChazM 1/16/07 - moved nwn2_inc_talent into the AI include chain below x0_i0_talent // ChazM 1/17/07 - moved InvisibleTrue() to x0_inc_generic // ChazM 1/18/07 - Added EvenFlw functions, re-org of chooseTactics() // ChazM 1/29/07 - modified CheckNonOffensiveMagic() // ChazM 2/16/07 - removed call to ResetModes() from chooseTactics(); commented out PrintMode(), ClearAIVariables, ResetModes() and EVENFLW_AI_MODE // ChazM 4/27/07 - removed a few hundred lines of commented code, structural enhancements. // ChazM 5/31/07 - added AssignDCR() // MDiekmann 6/27/07 - Modified DetermineActionFromTactics, to not make animal companions go into defensive casting mode. // MDiekmann 7/3/07 - Modified DetermineActionFromTactics, to not make anyone go into defensive casting mode who isn't capable. // MDiekmann 7/17/07 - Fixes for determing whether or not companions go into defensive casting mode //#include "x0_i0_assoc" - included in x0_inc_generic //#include "x0_inc_generic" - included in x0_i0_talent //#include "x0_i0_talent" - included in x0_i0_combat //#include "x0_i0_combat" - include in x0_i0_anims //#include "x0_i0_walkway" - include in x0_i0_anims #include "x0_i0_behavior" #include "x0_i0_anims" //#include "nwn2_inc_talent" - include in x0_i0_talent //============================================================== // CONSTANTS //============================================================== const string VAR_NW_GENERIC_LAST_ATTACK_TARGET = "NW_GENERIC_LAST_ATTACK_TARGET"; const string VAR_X2_NW_I0_GENERIC_INTRUDER = "X2_NW_I0_GENERIC_INTRUDER"; const string VAR_X2_SPECIAL_COMBAT_AI_SCRIPT = "X2_SPECIAL_COMBAT_AI_SCRIPT"; const string VAR_X2_SPECIAL_COMBAT_AI_SCRIPT_OK = "X2_SPECIAL_COMBAT_AI_SCRIPT_OK"; const string VAR_X2_L_MUTEXCOMBATROUND = "X2_L_MUTEXCOMBATROUND"; //const string EVENFLW_AI_MODE = "EVENFLW_AI_MODE"; //const string EVENFLW_AI_LAST_STATE = "EVENFLW_AI_LAST_STATE"; const string EVENFLW_NOT_SILENCE_SCARED = "EVENFLW_NOT_SILENCE_SCARED"; const string EVENFLW_SILENCE = "EVENFLW_SILENCE"; //============================================================== // Flee and move constants //============================================================== const int NW_GENERIC_FLEE_EXIT_FLEE = 0; const int NW_GENERIC_FLEE_EXIT_RETURN = 1; const int NW_GENERIC_FLEE_TELEPORT_FLEE = 2; const int NW_GENERIC_FLEE_TELEPORT_RETURN = 3; //============================================================== // Shout constants //============================================================== // NOT USED const int NW_GENERIC_SHOUT_I_WAS_ATTACKED = 1; //IN OnDeath Script const int NW_GENERIC_SHOUT_I_AM_DEAD = 12; //IN TalentMeleeAttacked const int NW_GENERIC_SHOUT_BACK_UP_NEEDED = 13; const int NW_GENERIC_SHOUT_BLOCKER = 2; //============================================================== // chooseTactics constants //============================================================== const int chooseTactics_MEMORY_OFFENSE_MELEE = 0; const int chooseTactics_MEMORY_DEFENSE_OTHERS = 1; const int chooseTactics_MEMORY_DEFENSE_SELF = 2; const int chooseTactics_MEMORY_OFFENSE_SPELL = 3; // MISCELLANEOUS CONSTANTS // This is the determine combat round script. // Used to decouple DCR from other scripts so that it can be updated independently. const string SCRIPT_DCR = "gr_dcr"; //============================================================== // STRUCTURES //============================================================== // instance Prefix for rTactics is tac // ex: // struct rTactics tacAI struct rTactics { // amount of each to use in decison making int nOffense; int nCompassion; int nMagic; int nMagicOld; int nStealth; int bScaredOfSilence; int bTacticChosen; }; //============================================================== // FUNCTION PROTOTYPES //============================================================== // * New Functions September - 2002 // * The class-specific tactics have been broken out from DetermineCombatRound // * for readability. This function determines the actual tactics each class // * will use. int chooseTactics(object oIntruder); // Adds all three of the class levels together. Used before // GetHitDice became available int GetCharacterLevel(object oTarget); //If using ambient sleep this will remove the effect void RemoveAmbientSleep(); //Searches for the nearest locked object to the master object GetLockedObject(object oMaster); //============================================================== // DetermineCombatRound subfunctions //============================================================== // Used in DetermineCombatRound to keep a // henchmen bashing doors. int BashDoorCheck(object oIntruder = OBJECT_INVALID); // Determines which of a NPCs three classes to // use in DetermineCombatRound int DetermineClassToUse(); //============================================================== // Core AI Functions //============================================================== // This function is the master function for the // generic include and is called from the main // script. This function is used in lieu of // any actual scripting. //:: Created By: Preston Watamaniuk //:: Created On: Oct 16, 2001 void DetermineCombatRound(object oIntruder = OBJECT_INVALID, int nAI_Difficulty = 10); //:://///////////////////////////////////////////// //:: Respond To Shouts //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// // Allows the listener to react in a manner // consistant with the given shout but only to one // combat shout per round //::////////////////////////////////////////////// //:: Created By: Preston Watamaniuk //:: Created On: Oct 25, 2001 //::////////////////////////////////////////////// //NOTE ABOUT COMMONERS // Commoners are universal cowards. If you attack anyone // they will flee for 4 seconds away from the attacker. // However to make the commoners into a mob, make a single // commoner at least 10th level of the same faction. // If that higher level commoner is attacked or killed then // the commoners will attack the attacker. They will disperse again // after some of them are killed. Should NOT make multi-class // creatures using commoners. // //NOTE ABOUT BLOCKERS // It should be noted that the Generic Script for On Dialogue // attempts to get a local set on the shouter by itself. // This object represents the LastOpenedBy object. It is this // object that becomes the oIntruder within this function. // //NOTE ABOUT INTRUDERS // The intruder object is for cases where a placable needs to // pass a LastOpenedBy Object or a AttackMyAttacker // needs to make his attacker the enemy of everyone. void RespondToShout(object oShouter, int nShoutIndex, object oIntruder = OBJECT_INVALID); //******** PLOT FUNCTIONS // NPCs who have warning status set to TRUE will allow // one 'free' attack by PCs from a non-hostile faction. void SetNPCWarningStatus(int nStatus = TRUE); // NPCs who have warning status set to TRUE will allow // one 'free' attack by PCs from a non-hostile faction. int GetNPCWarningStatus(); // * Presently Does not work with the current implementation // * of encounter triggers! // // This function works in tandem with an encounter // to spawn in guards to fight for the attacked // NPC. MAKE SURE THE ENCOUNTER TAG IS SET TO: // // "ENC_" + NPC TAG //:: Created By: Preston Watamaniuk //:: Created On: Oct 29, 2001 void SetSummonHelpIfAttacked(); // The target object flees to the specified // way point and then destroys itself, to be // respawned at a later point. For unkillable // sign post characters who are not meant to fight // back. // This function is used only because ActionDoCommand can // only accept void functions. void CreateSignPostNPC(string sTag, location lLocal); // The target object flees to the specified // way point and then destroys itself, to be // respawned at a later point. For unkillable // sign post characters who are not meant to fight // back. void ActivateFleeToExit(); // The target object flees to the specified // way point and then destroys itself, to be // respawned at a later point. For unkillable // sign post characters who are not meant to fight // back. int GetFleeToExit(); // Checks that an item was unlocked. //:: Created By: Preston Watamaniuk //:: Created On: Nov 19, 2001 void CheckIsUnlocked(object oLastObject); // This function is now just a wrapper around the functions // PlayMobileAmbientAnimations_Nonavian() and // PlayMobileAmbientAnimations_Avian(), in x0_i0_anims void PlayMobileAmbientAnimations(); // Determines the special behavior used by the NPC. // Generally all NPCs who you want to behave differently // than the defualt behavior. // For these behaviors, passing in a valid object will // cause the creature to become hostile the the attacker. void DetermineSpecialBehavior(object oIntruder = OBJECT_INVALID); // * Am I in a invisible or stealth state or sanctuary? //int InvisibleTrue(object oSelf = OBJECT_SELF); //::///////////////////////////////////////////////////////////////////////////////// //:: GetIsInCutscene() //:: Determines whether the target is a member of the PC's faction and if any member //:: is involved in a conversation -- this is a condition for short circuiting //:: DetermineCombatRound() so that hostile creatures can't attack conversing PCs or //:: their party. //:: //:: EPF, OEI 7/29/05 //:: DBR, OEI 5/30/06 - changed check to MP flagged cutscenes. //::///////////////////////////////////////////////////////////////////////////////// int GetIsInCutscene(object oTarget); //ChooseTacticsForDoor(oDoorIntruder) // This function is for choosing what tactics to use when fighting a door. // oDoorIntruder is the door to fight, and the function is run on the combating creature. // Returns 1 on a succesful choice of tactic (which should always occur) and 0 when no tactics were chosen. // Originally from BashDoorCheck(), taken out. int ChooseTacticsForDoor(object oDoorIntruder = OBJECT_INVALID); //void PrintMode(object party, int mode, object boss); //void ClearAIVariables(int all=FALSE); //void ResetModes(); int CheckForInvis(object oIntruder); int CheckNonOffensiveMagic(object oIntruder, int nOffense, int nCompassion, int nMagic, int iCastingMode); int GetScaledCastingMagic(int iCastingMode, int nMagic, int def, int random=FALSE); void InitializeSeed(int iCastingMode, object oIntruder); // New Functions used by chooseTactics() int GetHPPercentage(object oTarget=OBJECT_SELF); int GetCastingMode(int iMyHPPercentage); struct rTactics CreateTactics(int nOffense=0, int nCompassion=0, int nMagic=0, int nMagicOld=0, int nStealth=0, int bScaredOfSilence=0, int bTacticChosen=0); int TryClassTactic(object oIntruder, int nClass, int bNoFeats); struct rTactics CalculateTacticsByClass (struct rTactics tacAI, object oIntruder, int nClass, int iCastingMode); struct rTactics CalculateTactics(struct rTactics tacAI, object oIntruder, float fDistanceToIntruder, int nClass, int iCastingMode, int isSilenced); int DetermineActionFromTactics(struct rTactics tacAI, object oIntruder, float fDistanceToIntruder, int nClass, int iCastingMode, int isSilenced, int bNoFeats); //============================================================== // FUNCTION DEFINITIONS //============================================================== // Put on queue of creature to do a DCR. // Using this allows the DCR call to be decoupled from the script, allowing it to take // advantage of DCR enhancements without needing to be recompiled. void AssignDCR(object oCreature) { AssignCommand(oCreature, ExecuteScript(SCRIPT_DCR, oCreature)); } //:://///////////////////////////////////////////// //:: AdjustBehaviorVariable //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// // Overriding "behavior" variables. // If a variable has been stored on the creature it overrides the above // class defaults int AdjustBehaviorVariable(int nVar, string sVarName) { int nPlace =GetLocalInt(OBJECT_SELF, sVarName); if (nPlace > 0) { return nPlace; } //return nVar; // * return the original value return 0; } // A more intelligent invisibility solution, // along the lines of the one used in // the various end-user AIs. //:: Created By: Brent //:: Created On: June 14, 2003 // EPF 6/5/06 -- Added Warlock options for invisibility. int InvisibleBecome(object oSelf = OBJECT_SELF, int isInvis=FALSE) { if(GetLocalInt(oSelf, "X2_L_STOPCASTING") == 10) { if (GetHasFeat(FEAT_HIDE_IN_PLAIN_SIGHT, oSelf)) SetActionMode(OBJECT_SELF, ACTION_MODE_STEALTH, TRUE); return FALSE; } int hasDarkness = GetHasSpellEffect(SPELL_DARKNESS, oSelf) || GetHasSpellEffect(SPELL_I_DARKNESS, oSelf) || GetHasSpellEffect(SPELL_SHADOW_CONJURATION_DARKNESS, oSelf); int iWarlockDarkness = GetHasSpell(SPELL_I_DARKNESS, oSelf) && !hasDarkness; int iDarkness = GetHasSpell(SPELL_DARKNESS, oSelf) && !hasDarkness; if (GetHasSpell(SPELL_GREATER_INVISIBILITY, oSelf) || GetHasSpell(SPELL_INVISIBILITY, oSelf) || GetHasSpell(724, oSelf) || GetHasSpell(SPELL_INVISIBILITY_SPHERE, oSelf) || iDarkness || iWarlockDarkness || GetHasSpell(SPELL_SANCTUARY, oSelf) || GetHasSpell(SPELL_ETHEREALNESS, oSelf) || GetHasFeat(FEAT_HIDE_IN_PLAIN_SIGHT, oSelf) == TRUE || GetHasSpell(SPELL_I_RETRIBUTIVE_INVISIBILITY, oSelf) || GetHasSpell(SPELL_I_WALK_UNSEEN, oSelf)) { if(isInvis<=0) // close or not invisible { object oSeeMe = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, CREATURE_TYPE_HAS_SPELL_EFFECT, SPELL_TRUE_SEEING); if(!GetIsObjectValid(oSeeMe)) { int nDiff = GetCombatDifficulty(oSelf, TRUE); if (nDiff > -1) { if (GetHasSpell(SPELL_ETHEREALNESS, oSelf)) { ClearActions(1001); ActionCastSpellAtObject(SPELL_ETHEREALNESS, oSelf); return TRUE; } else if(GetHasSpell(724, oSelf)) { // ethereal jaunt ClearActions(1001); ActionCastSpellAtObject(724, oSelf); return TRUE; } if(!isInvis) { // don't do if close oSeeMe = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, CREATURE_TYPE_HAS_SPELL_EFFECT, SPELL_SEE_INVISIBILITY); if(!GetIsObjectValid(oSeeMe)) { ClearActions(1001); if(GetHasSpell(SPELL_I_RETRIBUTIVE_INVISIBILITY, oSelf)) { ActionCastSpellAtObject(SPELL_I_RETRIBUTIVE_INVISIBILITY, oSelf, METAMAGIC_NONE, TRUE); return TRUE; } else if(GetHasSpell(SPELL_GREATER_INVISIBILITY, oSelf)) { ActionCastSpellAtObject(SPELL_GREATER_INVISIBILITY, oSelf); return TRUE; } else if(GetHasSpell(SPELL_I_WALK_UNSEEN, oSelf)) { ActionCastSpellAtObject(SPELL_I_WALK_UNSEEN, oSelf, METAMAGIC_NONE, TRUE); return TRUE; } else if (GetHasSpell(SPELL_INVISIBILITY, oSelf)) { ActionCastSpellAtObject(SPELL_INVISIBILITY, oSelf); return TRUE; } else if (GetHasSpell(SPELL_INVISIBILITY_SPHERE, oSelf)) { ActionCastSpellAtObject(SPELL_INVISIBILITY_SPHERE, oSelf); return TRUE; } } } if (iWarlockDarkness) { ClearActions(1001); ActionCastSpellAtObject(SPELL_I_DARKNESS, oSelf, METAMAGIC_NONE, TRUE); return TRUE; } else if (iDarkness==TRUE) { ClearActions(1001); ActionCastSpellAtObject(SPELL_DARKNESS, oSelf); return TRUE; } else if (GetHasSpell(SPELL_SANCTUARY, oSelf)) { ClearActions(1001); ActionCastSpellAtObject(SPELL_SANCTUARY, oSelf); return TRUE; } else if (GetHasFeat(FEAT_HIDE_IN_PLAIN_SIGHT, oSelf)) { SetActionMode(OBJECT_SELF, ACTION_MODE_STEALTH, TRUE); } } } } } return FALSE; } // * Returns true if a wizard, warlock, or sorcerer and wearing armor int GetShouldNotCastSpellsBecauseofArmor(object oTarget, int nClass) { if (GetArcaneSpellFailure(oTarget) > 15 && (nClass == CLASS_TYPE_SORCERER || nClass == CLASS_TYPE_WIZARD || nClass == CLASS_TYPE_WARLOCK || nClass == CLASS_TYPE_BARD)) { return TRUE; } return FALSE; } // Tests to see if already running a determine // combatround this round. //:: Created By: Brent //:: Created On: July 11 2003 int __InCombatRound() { // * if just in attackaction, turn combat round off // * if simply fighting it is okay to turn the combat round off // * and try again because it doesn't hurt an attackaction // * to be reiniated whereas it does break a spell int nCurrentAction = GetCurrentAction(OBJECT_SELF); if (nCurrentAction == ACTION_ATTACKOBJECT || nCurrentAction == ACTION_INVALID)// || nCurrentAction == ACTION_MOVETOPOINT) { return FALSE; } if (GetLocalInt(OBJECT_SELF, VAR_X2_L_MUTEXCOMBATROUND) == TRUE) { //SpeakString("DEBUG:: In Combat Round, busy."); return TRUE; } return FALSE; } // Will set the exclusion variable on whether // in combat or not. // This is to prevent multiple firings // of determinecombatround in one round //:: Created By: Brent //:: Created On: July 11 2003 void __TurnCombatRoundOn(int bBool) { if (bBool == TRUE) { SetLocalInt(OBJECT_SELF, VAR_X2_L_MUTEXCOMBATROUND, TRUE); } else { // * delay it turning off like an action ActionDoCommand(SetLocalInt(OBJECT_SELF, VAR_X2_L_MUTEXCOMBATROUND, FALSE)); } } //::///////////////////////////////////////////////////////////////////////////////// //:: GetIsInCutscene() //:: Determines whether the target is a member of the PC's faction and if any member //:: is involved in a conversation -- this is a condition for short circuiting //:: DetermineCombatRound() so that hostile creatures can't attack conversing PCs or //:: their party. //:: //:: EPF, OEI 7/29/05 //:: DBR, OEI 5/30/06 - changed check to MP flagged cutscenes. //::///////////////////////////////////////////////////////////////////////////////// int GetIsInCutscene(object oTarget) { // BMA-OEI 3/10/06 object oPC = GetFirstPC(); // If oTarget is not in the PC faction if (GetFactionEqual(oTarget, oPC) == FALSE) { return (FALSE); } // For each member in PC faction object oMem = GetFirstFactionMember(oPC, FALSE); while (GetIsObjectValid(oMem) == TRUE) { // If any member is in conversation if (IsInMultiplayerConversation(oMem) == TRUE) { return (TRUE); } oMem = GetNextFactionMember(oPC, FALSE); } return (FALSE); } // This function is the master function for the // generic include and is called from the main // script. This function is used in lieu of // any actual scripting. //:: Created By: Preston Watamaniuk //:: Created On: Oct 16, 2001 void DetermineCombatRound(object oIntruder = OBJECT_INVALID, int nAI_Difficulty = 10) { //MyPrintString("************** DETERMINE COMBAT ROUND START *************"); //MyPrintString("************** " + GetTag(OBJECT_SELF) + " ************"); // Abort out of here, if petrified if (GetHasEffect(EFFECT_TYPE_PETRIFY, OBJECT_SELF) == TRUE) { return; } // Fix for ActionRandomWalk blocking the action queue under certain circumstances if (GetCurrentAction() == ACTION_RANDOMWALK) { ClearAllActions(); } // ---------------------------------------------------------------------------------------- // July 27/2003 - Georg Zoeller, // Added to allow a replacement for determine combat round // If a creature has a local string variable named X2_SPECIAL_COMBAT_AI_SCRIPT // set, the script name specified in the variable gets run instead // see x2_ai_behold for details: // ---------------------------------------------------------------------------------------- string sSpecialAI = GetLocalString(OBJECT_SELF, VAR_X2_SPECIAL_COMBAT_AI_SCRIPT); if (sSpecialAI != "") { SetLocalObject(OBJECT_SELF, VAR_X2_NW_I0_GENERIC_INTRUDER, oIntruder); ExecuteScript(sSpecialAI, OBJECT_SELF); if (GetLocalInt(OBJECT_SELF, VAR_X2_SPECIAL_COMBAT_AI_SCRIPT_OK)) { DeleteLocalInt(OBJECT_SELF, VAR_X2_SPECIAL_COMBAT_AI_SCRIPT_OK); return; } } // ---------------------------------------------------------------------------------------- // DetermineCombatRound: EVALUATIONS // ---------------------------------------------------------------------------------------- if(GetAssociateState(NW_ASC_IS_BUSY)) { return; } if(BashDoorCheck(oIntruder)) {return;} if (GetObjectType(oIntruder)==OBJECT_TYPE_TRIGGER) //Don't try to attack trigger. You will be unable to. oIntruder = OBJECT_INVALID; if ((GetObjectType(oIntruder)==OBJECT_TYPE_PLACEABLE) && (!GetUseableFlag(oIntruder))) //Don't try to attack non-usable placeables. You will be unable to. oIntruder = OBJECT_INVALID; // ---------------------------------------------------------------------------------------- // BK: stop fighting if something bizarre that shouldn't happen, happens // ---------------------------------------------------------------------------------------- if (bkEvaluationSanityCheck(oIntruder, GetFollowDistance()) == TRUE) return; // ** Store How Difficult the combat is for this round int nDiff = GetCombatDifficulty(); SetLocalInt(OBJECT_SELF, "NW_L_COMBATDIFF", nDiff); // MyPrintString("COMBAT: " + IntToString(nDiff)); // ---------------------------------------------------------------------------------------- // If no special target has been passed into the function // then choose an appropriate target // ---------------------------------------------------------------------------------------- if (GetIsObjectValid(oIntruder) == FALSE) oIntruder = bkAcquireTarget(); // ---------------------------------------------------------------------------------------- // 7/29/05 -- EPF, OEI // Due to the many, many plot-related cutscenes, we have decided to prevent anyone in the // PC faction from being attacked while they are in conversation. Eventually, this should // probably include a check to see if the conversation itself is a plot cutscene, but for // now that flag is NYI. Effectively, this is just a "pause" on combat until the // conversation ends. Then the PC party is fair game. // 5/30/06 -- DBR, OEI // Flag is IN! GetIsInCutscene() now only checks for multiplayer flagged cutscenes. // ---------------------------------------------------------------------------------------- if(GetIsInCutscene(oIntruder)) { PrintString("DetermineCombatRound(): In cutscene. Aborting function."); ClearAllActions(TRUE); ActionWait(3.f); ActionDoCommand(DetermineCombatRound()); return; } // If for some reason my target is dead, then leave // the poor guy alone. Jeez. What kind of monster am I? if (GetIsDead(oIntruder) == TRUE) { return; } // ---------------------------------------------------------------------------------------- // JULY 11 2003 // If in combat round already (variable set) do not enter it again. // This is meant to prevent multiple calls to DetermineCombatRound // from happening during the *same* round. // // This variable is turned on at the start of this function call. // It is turned off at each "return" point for this function // ---------------------------------------------------------------------------------------- if (__InCombatRound() == TRUE) { return; } __TurnCombatRoundOn(TRUE); // ---------------------------------------------------------------------------------------- // DetermineCombatRound: ACTIONS // ---------------------------------------------------------------------------------------- if(GetIsObjectValid(oIntruder)) { if(TalentPersistentAbilities()) // * Will put up things like Auras quickly { __TurnCombatRoundOn(FALSE); return; } // If a succesful tactic has been chosen then exit this function directly if (chooseTactics(oIntruder) == 99) { __TurnCombatRoundOn(FALSE); return; } // This check is to make sure that people do not drop out of // combat before they are supposed to. object oNearEnemy = GetNearestSeenEnemy(); DetermineCombatRound(oNearEnemy); return; } __TurnCombatRoundOn(FALSE); // ---------------------------------------------------------------------------------------- // This is a call to the function which determines which // way point to go back to. // ---------------------------------------------------------------------------------------- ClearActions(CLEAR_NW_I0_GENERIC_658); SetLocalObject(OBJECT_SELF, VAR_NW_GENERIC_LAST_ATTACK_TARGET, OBJECT_INVALID); WalkWayPoints(); } // Allows the listener to react in a manner // consistant with the given shout but only to one // combat shout per round //:: Created By: Preston Watamaniuk //:: Created On: Oct 25, 2001 //NOTE ABOUT COMMONERS // Commoners are universal cowards. If you attack anyone they will flee for 4 seconds away from the attacker. // However to make the commoners into a mob, make a single commoner at least 10th level of the same faction. // If that higher level commoner is attacked or killed then the commoners will attack the attacker. They will disperse again // after some of them are killed. Should NOT make multi-class creatures using commoners. // //NOTE ABOUT BLOCKERS // It should be noted that the Generic Script for On Dialogue attempts to get a local set on the shouter by itself. // This object represents the LastOpenedBy object. It is this object that becomes the oIntruder within this function. //NOTE ABOUT INTRUDERS // // The intruder object is for cases where a placable needs to pass a LastOpenedBy Object or a AttackMyAttacker // needs to make his attacker the enemy of everyone. void RespondToShout(object oShouter, int nShoutIndex, object oIntruder = OBJECT_INVALID) { // Pausanias: Do not respond to shouts if you've surrendered. int iSurrendered = GetLocalInt(OBJECT_SELF,"Generic_Surrender"); if (iSurrendered) return; switch (nShoutIndex) { case 1://NW_GENERIC_SHOUT_I_WAS_ATTACKED: { object oTarget = oIntruder; if(!GetIsObjectValid(oTarget)) { oTarget = GetLastHostileActor(oShouter); } if(!GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL)) { // if I am not a commoner, and not trying to attack something, and the shouter is a friend and the intruder is not a friend // then wake up and attack focus on the last person to be hostile to the shouter. if(!GetLevelByClass(CLASS_TYPE_COMMONER)) { if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget())) { if(GetIsObjectValid(oTarget)) { if(!GetIsFriend(oTarget) && GetIsFriend(oShouter)) { RemoveAmbientSleep(); //DetermineCombatRound(oTarget); DetermineCombatRound(GetLastHostileActor(oShouter)); } } } } // If I'm a commoner, and the shouter is a high level commoner, attack like mob! else if (GetLevelByClass(CLASS_TYPE_COMMONER, oShouter) >= 10) { WrapperActionAttack(GetLastHostileActor(oShouter)); } else // I'm a commoner - Determine combat round should result in me fleeing. { DetermineCombatRound(oIntruder); } } else { DetermineSpecialBehavior(); } } break; case 2://NW_GENERIC_SHOUT_MOB_ATTACK: { if(!GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL)) { //Is friendly check to make sure that only like minded commoners attack. if(GetIsFriend(oShouter)) { WrapperActionAttack(GetLastHostileActor(oShouter)); } //if(TalentMeleeAttack()) {return;} } else { DetermineSpecialBehavior(); } } break; case 3://NW_GENERIC_SHOUT_I_AM_DEAD: { if(!GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL)) { //Use I was attacked script above if(!GetLevelByClass(CLASS_TYPE_COMMONER)) { if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget())) { if(GetIsObjectValid(GetLastHostileActor(oShouter))) { if(!GetIsFriend(GetLastHostileActor(oShouter)) && GetIsFriend(oShouter)) { DetermineCombatRound(GetLastHostileActor(oShouter)); } } } } else if (GetLevelByClass(CLASS_TYPE_COMMONER, oShouter) >= 10) { WrapperActionAttack(GetLastHostileActor(oShouter)); } else { DetermineCombatRound(); } } else { DetermineSpecialBehavior(); } } break; //For this shout to work the object must shout the following //string sHelp = "NW_BLOCKER_BLK_" + GetTag(OBJECT_SELF); case 4: //BLOCKER OBJECT HAS BEEN DISTURBED { if(!GetLevelByClass(CLASS_TYPE_COMMONER)) { if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget())) { if(GetIsObjectValid(oIntruder)) { SetIsTemporaryEnemy(oIntruder); DetermineCombatRound(oIntruder); } } } else if (GetLevelByClass(CLASS_TYPE_COMMONER, oShouter) >= 10) { WrapperActionAttack(oIntruder); } else { DetermineCombatRound(); } } break; case 5: //ATTACK MY TARGET { AdjustReputation(oIntruder, OBJECT_SELF, -100); if(GetIsFriend(oShouter)) { SetIsTemporaryEnemy(oIntruder); ClearActions(CLEAR_NW_I0_GENERIC_834); DetermineCombatRound(oIntruder); } } break; case 6: //CALL_TO_ARMS { //This was once commented out. DetermineCombatRound(); } break; } } //:: Set and Get NPC Warning Status // This function sets a local int on OBJECT_SELF // which will be checked in the On Attack, On // Damaged and On Disturbed scripts to check if // the offending party was a PC and was friendly. // The Get will return the status of the local. //:: Created By: Preston Watamaniuk //:: Created On: Oct 29, 2001 // NPCs who have warning status set to TRUE will allow // one 'free' attack by PCs from a non-hostile faction. void SetNPCWarningStatus(int nStatus = TRUE) { SetLocalInt(OBJECT_SELF, "NW_GENERIC_WARNING_STATUS", nStatus); } // NPCs who have warning status set to TRUE will allow // one 'free' attack by PCs from a non-hostile faction. int GetNPCWarningStatus() { return GetLocalInt(OBJECT_SELF, "NW_GENERIC_WARNING_STATUS"); } // This function works in tandem with an encounter // to spawn in guards to fight for the attacked // NPC. MAKE SURE THE ENCOUNTER TAG IS SET TO: // "ENC_" + NPC TAG //:: Created By: Preston Watamaniuk //:: Created On: Oct 29, 2001 //Presently Does not work with the current implementation of encounter trigger void SetSummonHelpIfAttacked() { string sEncounter = "ENC_" + GetTag(OBJECT_SELF); object oTrigger = GetObjectByTag(sEncounter); if(GetIsObjectValid(oTrigger)) { SetEncounterActive(TRUE, oTrigger); } } //============================================================== // ESCAPE FUNCTIONS //============================================================== //:: Set, Get Activate,Flee to Exit // The target object flees to the specified // way point and then destroys itself, to be // respawned at a later point. For unkillable // sign post characters who are not meant to fight back. //:: Created By: Preston Watamaniuk //:: Created On: Oct 29, 2001 //This function is used only because ActionDoCommand can only accept void functions void CreateSignPostNPC(string sTag, location lLocal) { CreateObject(OBJECT_TYPE_CREATURE, sTag, lLocal); } void ActivateFleeToExit() { //minor optimizations - only grab these variables when actually needed //can make for larger code, but it's faster //object oExitWay = GetWaypointByTag("EXIT_" + GetTag(OBJECT_SELF)); //location lLocal = GetLocalLocation(OBJECT_SELF, "NW_GENERIC_START_POINT"); //string sTag = GetTag(OBJECT_SELF); //I suppose having this as a variable made it easier to change at one point.... //but it never changes, and is only used twice, so we don't need it //float fDelay = 6.0; int nPlot = GetLocalInt(OBJECT_SELF, "NW_GENERIC_MASTER"); if(nPlot & NW_FLAG_TELEPORT_RETURN || nPlot & NW_FLAG_TELEPORT_LEAVE) { //effect eVis = EffectVisualEffect(VFX_IMP_UNSUMMON); //ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF); if(nPlot & NW_FLAG_TELEPORT_RETURN) { location lLocal = GetLocalLocation(OBJECT_SELF, "NW_GENERIC_START_POINT"); string sTag = GetTag(OBJECT_SELF); DelayCommand(6.0, ActionDoCommand(CreateSignPostNPC(sTag, lLocal))); } ActionDoCommand(DestroyObject(OBJECT_SELF, 0.75)); } else { if(nPlot & NW_FLAG_ESCAPE_LEAVE) { object oExitWay = GetWaypointByTag("EXIT_" + GetTag(OBJECT_SELF)); ActionMoveToObject(oExitWay, TRUE); ActionDoCommand(DestroyObject(OBJECT_SELF, 1.0)); } else if(nPlot & NW_FLAG_ESCAPE_RETURN) { string sTag = GetTag(OBJECT_SELF); object oExitWay = GetWaypointByTag("EXIT_" + sTag); ActionMoveToObject(oExitWay, TRUE); location lLocal = GetLocalLocation(OBJECT_SELF, "NW_GENERIC_START_POINT"); DelayCommand(6.0, ActionDoCommand(CreateSignPostNPC(sTag, lLocal))); ActionDoCommand(DestroyObject(OBJECT_SELF, 1.0)); } } } int GetFleeToExit() { int nPlot = GetLocalInt(OBJECT_SELF, "NW_GENERIC_MASTER"); if(nPlot & NW_FLAG_ESCAPE_RETURN) { return TRUE; } else if(nPlot & NW_FLAG_ESCAPE_LEAVE) { return TRUE; } else if(nPlot & NW_FLAG_TELEPORT_RETURN) { return TRUE; } else if(nPlot & NW_FLAG_TELEPORT_LEAVE) { return TRUE; } return FALSE; } //============================================================== // PRIVATE FUNCTIONS //============================================================== //This is experimental and has not been looked at closely. void ExitAOESpellArea(object oAOEObject) { ClearActions(CLEAR_NW_I0_GENERIC_ExitAOESpellArea); ActionMoveAwayFromObject(oAOEObject, TRUE, 5.0); AssignCommand(OBJECT_SELF, DetermineCombatRound()); } // Returns the combined class levels of the target. int GetCharacterLevel(object oTarget) { return GetHitDice(oTarget); } // Checks if the NPC has sleep on them because // of ambient animations. Sleeping creatures // must make a DC 15 listen check. //:: Created By: Preston Watamaniuk //:: Created On: Feb 27, 2002 void RemoveAmbientSleep() { if(GetHasEffect(EFFECT_TYPE_SLEEP)) { effect eSleep = GetFirstEffect(OBJECT_SELF); while(GetIsEffectValid(eSleep)) { if(GetEffectCreator(eSleep) == OBJECT_SELF) { int nRoll = d20(); nRoll += GetSkillRank(SKILL_LISTEN); nRoll += GetAbilityModifier(ABILITY_WISDOM); if(nRoll > 15) { RemoveEffect(OBJECT_SELF, eSleep); } } eSleep = GetNextEffect(OBJECT_SELF); } } } // Finds the closest locked object to the object // passed in up to a maximum of 10 objects. //:: Created By: Preston Watamaniuk //:: Created On: March 15, 2002 object GetLockedObject(object oMaster) { int nCnt = 1; int bValid = TRUE; object oLastObject = GetNearestObjectToLocation(OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE, GetLocation(oMaster), nCnt); while (GetIsObjectValid(oLastObject) && bValid == TRUE) { //COMMENT THIS BACK IN WHEN DOOR ACTION WORKS ON PLACABLE. //object oItem = GetFirstItemInInventory(oLastObject); if(GetLocked(oLastObject)) { return oLastObject; } nCnt++; if(nCnt == 10) { bValid = FALSE; } oLastObject = GetNearestObjectToLocation(OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE, GetLocation(oMaster), nCnt); } return OBJECT_INVALID; } // Checks that an item was unlocked. void CheckIsUnlocked(object oLastObject) { if(GetLocked(oLastObject)) { ActionDoCommand(VoiceCuss()); } else { ActionDoCommand(VoiceCanDo()); } } //:: Play Mobile Ambient Animations //:: This function is now just a wrapper around //:: code from x0_i0_anims. void PlayMobileAmbientAnimations() { if(!GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS_AVIAN)) { // not a bird PlayMobileAmbientAnimations_NonAvian(); } else { // a bird PlayMobileAmbientAnimations_Avian(); } } // Determines the special behavior used by the NPC. // Generally all NPCs who you want to behave differently // than the defualt behavior. // For these behaviors, passing in a valid object will // cause the creature to become hostile the the attacker. // // MODIFIED February 7 2003: // - Rearranged logic order a little so that the creatures // will actually randomwalk when not fighting //:: Created By: Preston Watamaniuk //:: Created On: Dec 14, 2001 void DetermineSpecialBehavior(object oIntruder = OBJECT_INVALID) { object oTarget = GetNearestSeenEnemy(); if(GetBehaviorState(NW_FLAG_BEHAVIOR_OMNIVORE)) { int bAttack = FALSE; if(!GetIsObjectValid(oIntruder)) { if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget()) && !GetIsObjectValid(GetAttackTarget())) { if(GetIsObjectValid(oTarget) && GetDistanceToObject(oTarget) <= 8.0) { if(!GetIsFriend(oTarget)) { if(GetLevelByClass(CLASS_TYPE_DRUID, oTarget) == 0 && GetLevelByClass(CLASS_TYPE_RANGER, oTarget) == 0) { SetIsTemporaryEnemy(oTarget, OBJECT_SELF, FALSE, 20.0); bAttack = TRUE; DetermineCombatRound(oTarget); } } } } } else if(!IsInConversation(OBJECT_SELF)) { bAttack = TRUE; DetermineCombatRound(oIntruder); } // * if not attacking, the wander if (bAttack == FALSE) { ClearActions(CLEAR_NW_I0_GENERIC_DetermineSpecialBehavior1); ActionRandomWalk(); return; } } else if(GetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE)) { if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget()) && !GetIsObjectValid(GetAttackTarget())) { if(GetIsObjectValid(oTarget) && GetDistanceToObject(oTarget) <= 6.0) { if(!GetIsFriend(oTarget)) { if(GetLevelByClass(CLASS_TYPE_DRUID, oTarget) == 0 && GetLevelByClass(CLASS_TYPE_RANGER, oTarget) == 0) { TalentFlee(oTarget); } } } } else if(!IsInConversation(OBJECT_SELF)) { ClearActions(CLEAR_NW_I0_GENERIC_DetermineSpecialBehavior2); ActionRandomWalk(); return; } } } // This function is for choosing what tactics to use when fighting a door. // oDoorIntruder is the door to fight, and the function is run on the combating creature. // Returns 1 on a succesful choice of tactic (which should always occur) and 0 when no tactics were chosen. // Originally from BashDoorCheck(), taken out. int ChooseTacticsForDoor(object oDoorIntruder = OBJECT_INVALID) { if(GetHasFeat(FEAT_IMPROVED_POWER_ATTACK)) { ActionUseFeat(FEAT_IMPROVED_POWER_ATTACK, oDoorIntruder); return 1; } else if(GetHasFeat(FEAT_POWER_ATTACK)) { ActionUseFeat(FEAT_POWER_ATTACK, oDoorIntruder); return 1; } else { //WrapperActionAttack(oDoorIntruder); ActionAttack(oDoorIntruder); return 1; } return 0; //unreachable, technically } |
Code: |
// Used in DetermineCombatRound to keep a
// henchmen bashing doors. // // Also used to limit the tactics used when fighting a door. //:: Created By: Preston Watamaniuk //:: Created On: April 4, 2002 int BashDoorCheck(object oIntruder = OBJECT_INVALID) { int bDoor = FALSE; //This code is here to make sure that henchmen keep bashing doors and placables. object oDoor = GetLocalObject(OBJECT_SELF, "NW_GENERIC_DOOR_TO_BASH"); if (GetIsObjectValid(oDoor)) //run tests to see if we should bash this door that we received from a shout { if (!(!GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN)) || (!GetIsObjectValid(oIntruder) && !GetIsObjectValid(GetCurrentMaster())))) oDoor = OBJECT_INVALID; //That last check was to prevent a henchmen or creatures form attacking a door if they are in combat (and have bigger concerns) else if (GetIsTrapped(oDoor) ) oDoor = OBJECT_INVALID; //Don't attack a trapped door. else if (!GetLocked(oDoor)) oDoor = OBJECT_INVALID; //Don't attack a Locked door. } //From the original BashDoorCheck(), this handles the door that we were shouted to attack. if(GetIsObjectValid(oDoor)) { int nDoorMax = GetMaxHitPoints(oDoor); int nDoorNow = GetCurrentHitPoints(oDoor); int nCnt = GetLocalInt(OBJECT_SELF,"NW_GENERIC_DOOR_TO_BASH_HP");//this variable appears to be a misnomer, and is used to keep track of how many times we have tried to bash this door. if(nDoorMax == nDoorNow) { nCnt++; SetLocalInt(OBJECT_SELF,"NW_GENERIC_DOOR_TO_BASH_HP", nCnt); } if(nCnt <= 0) { bDoor = ChooseTacticsForDoor(oDoor); } if(bDoor == FALSE) { VoiceCuss(); DeleteLocalObject(OBJECT_SELF, "NW_GENERIC_DOOR_TO_BASH"); DeleteLocalInt(OBJECT_SELF, "NW_GENERIC_DOOR_TO_BASH_HP"); } return bDoor; } else //We either were not shouted to attack a door, or we decided that the shouted door is not good to attack. { //Now we check oIntruder to see if the object we were going to attack anyway is a door. if (GetObjectType(oIntruder)==OBJECT_TYPE_DOOR) { return ChooseTacticsForDoor(oIntruder); } } return FALSE; //did nothing } // Determines which of a NPCs three classes to // use in DetermineCombatRound //:: Created By: Preston Watamaniuk //:: Created On: April 4, 2002 // Creatures can now have 4 classes int DetermineClassToUse() { int nClass; int nTotal = GetHitDice(OBJECT_SELF); int nClass1 = GetClassByPosition(1); int nClass2 = GetClassByPosition(2); int nClass3 = GetClassByPosition(3); int nState1 = GetLevelByClass(nClass1) * 100 / nTotal; int nState2 = nState1 + GetLevelByClass(nClass2) * 100 / nTotal; int nState3 = nState2 + GetLevelByClass(nClass3) * 100 / nTotal; int nUseClass = d100(); //PrettyDebug("Hit Dice=" + IntToString(nTotal) + " D100 Roll=" + IntToString(nUseClass)); //PrettyDebug("nClass1=" + IntToString(nClass1) + " nClass2=" + IntToString(nClass2)+ " nClass3=" + IntToString(nClass3)); //PrettyDebug("nState1=" + IntToString(nState1) + " nState2=" + IntToString(nState2)+ " nState3=" + IntToString(nState3)); if(nUseClass <= nState1) { nClass = nClass1; } //else if(nUseClass > nState1 && nUseClass <= nState2) else if(nUseClass <= nState2) { nClass = nClass2; } else if(nUseClass <= nState3) { nClass = nClass3; } else { nClass = GetClassByPosition(4); } //PrettyDebug(GetName(OBJECT_SELF) + " Return Class = " + IntToString(nClass)); return nClass; } //======================================================= // EvenFlw functions //======================================================= int CheckForInvis(object oIntruder) { if(InvisibleTrue(oIntruder)==TRUE) return TRUE; object target=GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE, GetLocation(OBJECT_SELF)); int total=0; while(GetIsObjectValid(target) && total<5) { if(GetIsEnemy(target) && InvisibleTrue(target)==TRUE) return TRUE; total++; target=GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE, GetLocation(OBJECT_SELF)); } return FALSE; } int CheckNonOffensiveMagic(object oIntruder, int nOffense, int nCompassion, int nMagic, int iCastingMode) { if (nCompassion > 50) { SetLocalInt(OBJECT_SELF, "NW_L_MEMORY", chooseTactics_MEMORY_DEFENSE_OTHERS); if(TalentHeal() == TRUE) return 99; if(TalentResurrect()) return 99; if(TalentCureCondition() == TRUE) return 99; } if (nOffense<= 50 && nMagic > 50) { SetLocalInt(OBJECT_SELF, "NW_L_MEMORY", chooseTactics_MEMORY_DEFENSE_SELF); int nCaster = GetLevelByClass(CLASS_TYPE_WIZARD, oIntruder) + GetLevelByClass(CLASS_TYPE_SORCERER, oIntruder) + GetLevelByClass(CLASS_TYPE_BARD, oIntruder)+ GetLevelByClass(CLASS_TYPE_CLERIC, oIntruder) + GetLevelByClass(CLASS_TYPE_DRUID, oIntruder); if(iCastingMode==2) nCaster+=5; if (iCastingMode<2 || nCaster > GetHitDice(OBJECT_SELF)/2) { nCaster=1; if (TalentSelfProtectionMantleOrGlobe()) return 99; } else nCaster=0; int seed=d4(); if(seed!=1 && nCompassion<51 || seed>2) { if(TalentAdvancedBuff2(OBJECT_SELF, oIntruder, nCaster, iCastingMode) == TRUE) return 99; } else { if(TalentOthers(nCompassion, oIntruder, nCaster, iCastingMode)) return 99; } if(TalentSummonAllies() == TRUE) return 99; if(!(GetLocalInt(OBJECT_SELF, N2_TALENT_EXCLUDE)&0x1) && TalentBuffSelf() == TRUE) return 99; // potions if(CheckForInvis(oIntruder) && TalentSeeInvisible() == TRUE) return 99; } return 0; } int GetScaledCastingMagic(int iCastingMode, int nMagic, int def, int random=FALSE) { switch(iCastingMode) { case 1: nMagic=55; break; case 2: nMagic=45-GetHitDice(OBJECT_SELF)/3; break; case 3: if(random) nMagic=Random(nMagic)+1; else nMagic=40-GetHitDice(OBJECT_SELF)/2; break; default: if(random) nMagic=Random(def)+1; else nMagic=def; } return nMagic; } void InitializeSeed(int iCastingMode, object oIntruder) { int diff=20; if(iCastingMode>1) diff=GetHitDice(oIntruder); if(iCastingMode==2) diff+=5; if(diff>20) diff=20; if(d2()==1) { if(diff>GetHitDice(OBJECT_SELF)) diff=GetHitDice(OBJECT_SELF)+1; diff-=d4()+1; if(diff<4) diff=4; } SetLocalInt(OBJECT_SELF, "NW_L_COMBATDIFF", diff); } // *** sub function of chooseTactics() int GetMelee() { object weapon=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND); if(!GetIsObjectValid(weapon) || MatchMeleeWeapon(weapon)) return TRUE; return FALSE; } // returns percentage of hitpoints remaining int GetHPPercentage(object oTarget=OBJECT_SELF) { return ((GetCurrentHitPoints(oTarget)*100)/GetMaxHitPoints(oTarget)); } int GetCastingMode(int iMyHPPercentage) { int iCastingMode = 0; if(iMyHPPercentage < 50) iCastingMode=0; else if(GetAssociateState(NW_ASC_OVERKIll_CASTING)) iCastingMode=1; else if(GetAssociateState(NW_ASC_POWER_CASTING)) iCastingMode=2; else if(GetAssociateState(NW_ASC_SCALED_CASTING)) iCastingMode=3; return (iCastingMode); } struct rTactics CreateTactics(int nOffense=0, int nCompassion=0, int nMagic=0, int nMagicOld=0, int nStealth=0, int bScaredOfSilence=0, int bTacticChosen=0) { struct rTactics tacAI; tacAI.nOffense = nOffense; tacAI.nCompassion = nCompassion; tacAI.nMagic = nMagic; tacAI.nMagicOld = nMagicOld; tacAI.nStealth = nStealth; tacAI.bScaredOfSilence = bScaredOfSilence; tacAI.bTacticChosen = bTacticChosen; return (tacAI); } // Check if we can already determine from the class what to do. int TryClassTactic(object oIntruder, int nClass, int bNoFeats) { int bTacticChosen = FALSE; switch (nClass) { case CLASS_TYPE_COMMONER: bTacticChosen = TalentFlee(oIntruder); break; //------------------------------------------ case CLASS_TYPE_DRAGONDISCIPLE: if (!bNoFeats && GetHasFeat(FEAT_DRAGON_DIS_BREATH) && d4()==1) { ClearActions(2000); ActionCastSpellAtObject(690, GetNearestEnemy(), METAMAGIC_ANY, TRUE); DecrementRemainingFeatUses(OBJECT_SELF, FEAT_DRAGON_DIS_BREATH); bTacticChosen = TRUE; } break; //------------------------------------------ case CLASS_TYPE_BARD: if (!bNoFeats && TalentBardSong() == TRUE) { bTacticChosen = TRUE; } break; //------------------------------------------ case CLASS_TYPE_RANGER: case CLASS_TYPE_PALADIN: case CLASS_TYPE_ARCANE_ARCHER: if (!GetLocalInt(OBJECT_SELF, N2_COMBAT_MODE_USE_DISABLED) && GetHasFeat(FEAT_RAPID_SHOT)) { SetActionMode(OBJECT_SELF, ACTION_MODE_RAPID_SHOT, TRUE); bTacticChosen = FALSE; // still need to choose a tactic } break; //------------------------------------------ case CLASS_TYPE_BARBARIAN: if (!bNoFeats && !GetHasFeatEffect(FEAT_BARBARIAN_RAGE) && GetHasFeat(FEAT_BARBARIAN_RAGE)) { ClearAllActions(); ActionUseFeat(FEAT_BARBARIAN_RAGE, OBJECT_SELF); ActionAttack(oIntruder); bTacticChosen = TRUE; } break; //------------------------------------------ case CLASS_TYPE_FRENZIEDBERSERKER: if (!bNoFeats && !GetHasFeatEffect(FEAT_FRENZY_1) && GetHasFeat(FEAT_FRENZY_1)) { ClearAllActions(); ActionUseFeat(FEAT_FRENZY_1, OBJECT_SELF); ActionAttack(oIntruder); bTacticChosen = TRUE; } break; //------------------------------------------ case CLASS_TYPE_MONK: SetActionMode(OBJECT_SELF, ACTION_MODE_FLURRY_OF_BLOWS, TRUE); bTacticChosen = FALSE; // still need to choose a tactic break; //------------------------------------------ default: break; } return (bTacticChosen); } struct rTactics CalculateTacticsByClass (struct rTactics tacAI, object oIntruder, int nClass, int iCastingMode) { int nOffense = tacAI.nOffense; int nCompassion = tacAI.nCompassion; int nMagic = tacAI.nMagic; int nMagicOld = tacAI.nMagicOld; int nStealth = tacAI.nStealth; int bScaredOfSilence = tacAI.bScaredOfSilence; int bTacticChosen = tacAI.bTacticChosen; // this function should not choose a tactic. // Classes determine the "base" levels for the tactic types. // Thus the values are generally overridden, not modified switch (nClass) { case CLASS_TYPE_COMMONER: nOffense = 0; nCompassion = 0; nMagic = 0; break; //------------------------------------------ case CLASS_TYPE_PALEMASTER: case CLASS_TYPE_ARCANETRICKSTER: case CLASS_TYPE_WIZARD: case CLASS_TYPE_SORCERER: bScaredOfSilence = TRUE; nMagic = GetScaledCastingMagic(iCastingMode, 40, 100); if(iCastingMode ==1 ) nMagic = 100; nCompassion = 42; break; //------------------------------------------ case CLASS_TYPE_DRAGONDISCIPLE: case CLASS_TYPE_BARD: bScaredOfSilence = TRUE; // continue case CLASS_TYPE_HARPER: case CLASS_TYPE_ELDRITCH_KNIGHT: nMagic = GetScaledCastingMagic(iCastingMode, 40, 43); nCompassion = 43; break; //------------------------------------------ case CLASS_TYPE_CLERIC: if (GetHitDice(oIntruder) > GetHitDice(OBJECT_SELF)) nStealth = 70; bScaredOfSilence = TRUE; // continue case CLASS_TYPE_WARPRIEST: nMagic = GetScaledCastingMagic(iCastingMode, 40, 44); nCompassion = 45; break; //------------------------------------------ case CLASS_TYPE_DRUID: nMagic = GetScaledCastingMagic(iCastingMode, 40, 55); bScaredOfSilence = TRUE; nCompassion = 45; break; //------------------------------------------ case CLASS_TYPE_RANGER: case CLASS_TYPE_PALADIN: nCompassion = 43; // continue case CLASS_TYPE_ARCANE_ARCHER: case CLASS_TYPE_BLACKGUARD: nMagic = GetScaledCastingMagic(iCastingMode, 50, 50, TRUE); break; //------------------------------------------ case CLASS_TYPE_BARBARIAN: case CLASS_TYPE_FRENZIEDBERSERKER: nMagic = GetScaledCastingMagic(iCastingMode, 40, 40, TRUE); nOffense = 50; break; //------------------------------------------ case CLASS_TYPE_ROGUE: case CLASS_TYPE_SHADOWTHIEFOFAMN: case CLASS_TYPE_SHADOWDANCER: case CLASS_TYPE_ASSASSIN: nMagic = GetScaledCastingMagic(iCastingMode, 40, 40, TRUE); nStealth = 100; break; //------------------------------------------ case CLASS_TYPE_MONK: case CLASS_TYPE_WEAPON_MASTER: case CLASS_TYPE_DWARVENDEFENDER: case CLASS_TYPE_FIGHTER: case CLASS_NWNINE_WARDER: case CLASS_TYPE_DUELIST: nMagic = GetScaledCastingMagic(iCastingMode, 40, 40, TRUE); break; //------------------------------------------ case CLASS_TYPE_UNDEAD: nCompassion = 40; nMagic = 40; break; //------------------------------------------ case CLASS_TYPE_OUTSIDER: nMagic = 40; nCompassion = 0; if (GetAlignmentGoodEvil(OBJECT_SELF) == ALIGNMENT_GOOD) { nCompassion = 41; } break; //------------------------------------------ case CLASS_TYPE_CONSTRUCT: case CLASS_TYPE_ELEMENTAL: nCompassion = 0; nMagic = 40; break; //------------------------------------------ case CLASS_TYPE_DRAGON: nCompassion = 20; nMagic = 40; break; //------------------------------------------ case CLASS_TYPE_WARLOCK: bScaredOfSilence = TRUE; nCompassion = 0; nMagic = 80; break; //------------------------------------------ default: break; } return (CreateTactics(nOffense, nCompassion, nMagic, nMagicOld, nStealth, bScaredOfSilence, bTacticChosen)); } struct rTactics CalculateTactics(struct rTactics tacAI, object oIntruder, float fDistanceToIntruder, int nClass, int iCastingMode, int isSilenced) { int nPreviousMemory = GetLocalInt(OBJECT_SELF, "NW_L_MEMORY"); int nOffense = tacAI.nOffense; int nCompassion = tacAI.nCompassion; int nMagic = tacAI.nMagic; int nMagicOld = tacAI.nMagicOld; int nStealth = tacAI.nStealth; int bScaredOfSilence = tacAI.bScaredOfSilence; int bTacticChosen = tacAI.bTacticChosen; // tend toward stealthy if wounded if (GetHPPercentage()<50) nStealth += 10; // Racial adjustments if (GetRacialType(OBJECT_SELF) == RACIAL_TYPE_UNDEAD && nCompassion > 40 && GetHPPercentage() < 75) { nCompassion = 0; } // random adjustments nOffense = Random(10) + nOffense; nMagic = Random(10) + nMagic; nCompassion = Random(10) + nCompassion; // Bahavior variable adjustments nMagic = nMagic + AdjustBehaviorVariable(nMagic, "X2_L_BEH_MAGIC"); nOffense = nOffense + AdjustBehaviorVariable(nOffense, "X2_L_BEH_OFFENSE"); nCompassion = nCompassion + AdjustBehaviorVariable(nCompassion, "X2_L_BEH_COMPASSION"); // feat adjustments if (GetIsObjectValid(oIntruder) && !GetHasFeat(FEAT_COMBAT_CASTING)) { if (fDistanceToIntruder <= 5.f) { nOffense = nOffense + 20; nMagic = nMagic - 20; } } // casting mode adjustments if (iCastingMode!=2 && fDistanceToIntruder > 2.5f) nMagic = nMagic + 15; // Intruder stats adjustments nMagic = nMagic + GetHitDice(oIntruder); // previous choices adjustments if ((nPreviousMemory == chooseTactics_MEMORY_DEFENSE_OTHERS) || (nPreviousMemory == chooseTactics_MEMORY_DEFENSE_SELF)) { nOffense = nOffense + Random(40); } // remember magic score at this point. nMagicOld = nMagic; // adjustments if incapable of casting if (GetHasFeatEffect(FEAT_BARBARIAN_RAGE) || GetShouldNotCastSpellsBecauseofArmor(OBJECT_SELF, nClass) || GetLocalInt(OBJECT_SELF, "X2_L_STOPCASTING") == 10 || GetHasFeatEffect(FEAT_FRENZY_1) || GetHasSpellEffect(SPELL_TENSERS_TRANSFORMATION) || GetHasSpellEffect(SPELL_TRUE_STRIKE)) { nCompassion = 0; nMagic = 0; } // polymorphed adjustments for casting // AFW-OEI 07/12/2007: Don't unpolymorph if you're polymorph locked if (GetHasEffect(EFFECT_TYPE_POLYMORPH) && !GetPolymorphLocked(OBJECT_SELF) && (!GetHasFeat(FEAT_NATURAL_SPELL, OBJECT_SELF, TRUE) || !GetHasEffect(EFFECT_TYPE_WILDSHAPE))) { int unpoly = GetLocalInt(OBJECT_SELF, EVENFLW_AI_UNPOLY); if(!unpoly) { SetLocalInt(OBJECT_SELF, EVENFLW_AI_UNPOLY, 1); DelayCommand(RoundsToSeconds(5), SetLocalInt(OBJECT_SELF, EVENFLW_AI_UNPOLY, 2)); } if(unpoly==2 && d6()==1) { effect eff = GetFirstEffect(OBJECT_SELF); while (GetIsEffectValid(eff)) { if(GetEffectType(eff)==EFFECT_TYPE_POLYMORPH) { RemoveEffect(OBJECT_SELF, eff); break; } eff=GetNextEffect(OBJECT_SELF); } } else nMagic=0; } else DeleteLocalInt(OBJECT_SELF, EVENFLW_AI_UNPOLY); // silence if(isSilenced) { if (GetLocalInt(OBJECT_SELF, EVENFLW_NOT_SILENCE_SCARED) || GetLocalInt(OBJECT_SELF, EVENFLW_SILENCE)) bScaredOfSilence = FALSE; } else { DeleteLocalInt(OBJECT_SELF, EVENFLW_NOT_SILENCE_SCARED); DeleteLocalInt(OBJECT_SELF, EVENFLW_SILENCE); } int isInvis = InvisibleTrue(OBJECT_SELF); if (!GetObjectSeen(OBJECT_SELF, oIntruder) && isInvis == TRUE && nMagic > 0 && !isSilenced) { if (nStealth==100 || GetActionMode(OBJECT_SELF, ACTION_MODE_STEALTH) == TRUE) { nOffense = 100; // * if in stealth attempt sneak attacks } else if(d4()!=1) { nOffense = 7; if (nMagic < 51) { nMagic += 10; } nCompassion += d10(); if (GetHPPercentage() < 80) if(TalentHealingSelf(TRUE) == TRUE) { bTacticChosen = TRUE; } } } else { if ((nStealth==100 || (!isSilenced && (nStealth>=Random(100)))) && InvisibleBecome(OBJECT_SELF, isInvis) == TRUE) { bTacticChosen = TRUE; } } return (CreateTactics(nOffense, nCompassion, nMagic, nMagicOld, nStealth, bScaredOfSilence, bTacticChosen)); } int DetermineActionFromTactics(struct rTactics tacAI, object oIntruder, float fDistanceToIntruder, int nClass, int iCastingMode, int isSilenced, int bNoFeats) { int nOffense = tacAI.nOffense; int nCompassion = tacAI.nCompassion; int nMagic = tacAI.nMagic; int nMagicOld = tacAI.nMagicOld; int nStealth = tacAI.nStealth; int bScaredOfSilence = tacAI.bScaredOfSilence; int bTacticChosen = tacAI.bTacticChosen; int iNumMeleeAttackers =GetNumberOfMeleeAttackers(); if (nOffense <= 5 || isSilenced && nMagic>50 && bScaredOfSilence && GetIsObjectValid(GetLocalObject(OBJECT_SELF, EVENFLW_SILENCE))) { if (bScaredOfSilence) { ActionMoveAwayFromObject(GetLocalObject(OBJECT_SELF, EVENFLW_SILENCE), TRUE, 7.0f); DelayCommand(3.0f, DetermineCombatRound(oIntruder)); return 99; } else { if (TalentFlee(oIntruder) == TRUE) return 99; } } if(oIntruder==OBJECT_SELF) nOffense = 0; SetLocalInt(OBJECT_SELF, EVENFLW_NUM_MELEE, iNumMeleeAttackers); if(!GetLocalInt(OBJECT_SELF, N2_COMBAT_MODE_USE_DISABLED)) { if ((fDistanceToIntruder < 5.0 || iNumMeleeAttackers) && (nMagic>50 || nCompassion>50) && (GetLastGenericSpellCast() != 0)) SetActionMode(OBJECT_SELF, ACTION_MODE_DEFENSIVE_CAST, TRUE); } InitializeSeed(iCastingMode, oIntruder); if(CheckNonOffensiveMagic(oIntruder, nOffense, nCompassion, nMagic, iCastingMode)) return 99; if(oIntruder==OBJECT_SELF) return 1; if (nMagic > 50) { SetLocalInt(OBJECT_SELF, "NW_L_MEMORY", chooseTactics_MEMORY_OFFENSE_SPELL); if (!bNoFeats && TalentUseTurning(oIntruder) == TRUE) return 99; if(TalentDebuff(oIntruder)) return 99; if(nClass == CLASS_TYPE_WARLOCK) if(TalentWarlockSpellAttack(oIntruder)) return 99; if(GetLocalInt(OBJECT_SELF, EVENFLW_AI_CLOSE)) { if(TalentMeleeAttacked(oIntruder, iNumMeleeAttackers) == TRUE) return 99; if(TalentRangedEnemies(oIntruder) == TRUE) return 99; } else { if(TalentRangedEnemies(oIntruder) == TRUE) return 99; if(!GetLocalInt(OBJECT_SELF, N2_COMBAT_MODE_USE_DISABLED) && (GetLastGenericSpellCast() != 0)) SetActionMode(OBJECT_SELF, ACTION_MODE_DEFENSIVE_CAST, TRUE); if(TalentMeleeAttacked(oIntruder, 1) == TRUE) return 99; } } if (nOffense>50 && nMagic>50 && d2()!=1) { if(CheckNonOffensiveMagic(oIntruder, 10, 0, nMagic, iCastingMode)) return 99; } if(nMagic>50) { int lastditch=TalentLastDitch(); if(lastditch==TRUE) return 99; if(!lastditch) { if(GetLevelByClass(CLASS_TYPE_WARLOCK) && TalentWarlockSpellAttack(oIntruder)) return 99; if(TalentCantrip(oIntruder)) return 99; } } if(nMagic==0 && nMagicOld>50) { if(!(GetLocalInt(OBJECT_SELF, N2_TALENT_EXCLUDE) & TALENT_EXCLUDE_ITEM) && TalentBuffSelf() == TRUE) { return 99; } } if(nMagic>50) SetLocalInt(OBJECT_SELF, EVENFLW_NOT_SILENCE_SCARED, 1); SetLocalInt(OBJECT_SELF, "NW_L_MEMORY", chooseTactics_MEMORY_OFFENSE_MELEE); if (!bNoFeats && Random(12) == 0 // we only want to do this occasionally && GetMelee() && TalentKnockdown(oIntruder)==TRUE ) { ActionAttack(oIntruder); return 99; } if (TryKiDamage(oIntruder) == TRUE) return 99; if (TalentSneakAttack() == TRUE) return 99; if (TalentDragonCombat(oIntruder)) {return 99;} if (TalentMeleeAttack(oIntruder) == TRUE) return 99; return 1; } int chooseTactics(object oIntruder) { if(TalentHealingSelf() == TRUE) return 99; if (SpecialTactics(oIntruder)) return 99; int iExcludeFlag = GetLocalInt(OBJECT_SELF, N2_TALENT_EXCLUDE); int bNoFeats = iExcludeFlag & TALENT_EXCLUDE_ABILITY; int nClass = DetermineClassToUse(); float fDistanceToIntruder = GetDistanceToObject(oIntruder); int iCastingMode = GetCastingMode(GetHPPercentage()); int isSilenced = GetHasEffect(EFFECT_TYPE_SILENCE); // tactics vars - base values int nOffense = 40; int nCompassion = 25; int nMagic = 55; int nMagicOld = 0; int nStealth = 30; int bScaredOfSilence= FALSE; struct rTactics tacAI = CreateTactics(nOffense, nCompassion, nMagic, nMagicOld, nStealth, bScaredOfSilence, FALSE); // Stuff chosen here will short circuit all the tactics calculations if (TryClassTactic(oIntruder, nClass, bNoFeats) == TRUE) return 99; if(GetCreatureSize(oIntruder) > 4) fDistanceToIntruder -= 10.5f; tacAI = CalculateTacticsByClass(tacAI, oIntruder, nClass, iCastingMode); if (tacAI.bTacticChosen == TRUE) return 99; tacAI = CalculateTactics(tacAI, oIntruder, fDistanceToIntruder, nClass, iCastingMode, isSilenced); if (tacAI.bTacticChosen == TRUE) return 99; return (DetermineActionFromTactics(tacAI, oIntruder, fDistanceToIntruder, nClass, iCastingMode, isSilenced, bNoFeats)); } // * END of choosetactics /* void main() {} /* */ |
Code: |
//::///////////////////////////////////////////////
//:: //:: Designer Include File //:: //:: NW_I0_PLOT.nss //:: //:: Copyright (c) 2001 Bioware Corp. //:: //:: //::////////////////////////////////////////////// //:: //:: //:: This is a sample of design wrote //:: functions that may need inclusion in multiple //:: modules. //:: //::////////////////////////////////////////////// //:: //:: Created By: Brent Knowles //:: Created On: February 12, 2001 //:: Updated On: August, 14, 2003 (Georg) - Fixed AutoDC, Added const statement to constants //::////////////////////////////////////////////// // ChazM 6/27/06 - updated string refs for gplotAppraiseOpenStore() const int DC_EASY = 0; const int DC_MEDIUM = 1; const int DC_HARD = 2; const int DC_SUPERIOR = 3; const int DC_MASTER = 4; const int DC_LEGENDARY = 5; const int DC_EPIC = 6; // * this is used by some of the template scripts // * 100 - this number is the chance of that dialog // * appearing const int G_CLASSCHANCE = 70; //Experience Point Rewards constants used in the 'des_xp_rewards' 2da const int XP_VERY_LOW = 1; //50 xp const int XP_LOW = 2; //100 xp const int XP_MEDIUM_LOW = 3; //150 xp const int XP_MEDIUM = 4; //250 xp const int XP_MEDIUM_HIGH = 5; //500 xp const int XP_HIGH = 6; //1000 xp const int XP_VERY_HIGH = 7; //2000 xp const int XP_EPIC = 8; //5000 xp // * FUNCTION DECLARATIONS // * returns true if the player can afford to lose the indicated amount of XP without losing a level int plotCanRemoveXP(object oPC, int nPenalty); int GetCanCastHealingSpells(object oPC) ; int DoOnce(); void DebugSpeak(string s); object GetMyMaster(); int IsRecall(); void DimensionHop(object oTarget); int CanSeePlayer(); void EscapeArea(int bRun = TRUE, string sTag="NW_EXIT"); int HasItem(object oCreature, string s); void TakeGold(int nAmount, object oGoldHolder, int bDestroy=TRUE); object GetNearestPC(object oTarget=OBJECT_SELF, int bOwnedCharacter=TRUE, int bIsAlive=TRUE, int nNth=1); void SetIsEnemy(object oTarget); // Provide a scaled skill check DC based on the DC_* constant passed in // DC - DC_EASY DC_MEDIUM DC_HARD DC_SUPERIOR DC_MASTER DC_LEGENDARY DC_EPIC // nSkill - SKILL_* constant // oTarget - creature that is going to perform the check; int AutoDC(int DC, int nSkill, object oTarget); void AutoAlignG(int DC, object oTarget); void AutoAlignE(int DC, object oTarget); void DoGiveXP(string sJournalTag, int nPercentage, object oTarget, int QuestAlignment=ALIGNMENT_NEUTRAL); void RewardXP(string sJournalTag, int nPercentage, object oTarget, int QuestAlignment=ALIGNMENT_NEUTRAL, int bAllParty=TRUE); void RewardGP(int GP, object oTarget,int bAllParty=TRUE); int CheckCharismaMiddle(); int CheckCharismaNormal(); int CheckCharismaLow(); int CheckCharismaHigh(); int CheckIntelligenceLow(); int CheckIntelligenceNormal(); int CheckIntelligenceNormal(); int CheckIntelligenceHigh(); int CheckWisdomHigh(); // Return the wisdom of oTarget int GetWisdom(object oTarget); // Return the Intelligence of the Target int GetIntelligence(object oTarget); // Return the Charisma of the Target int GetCharisma(object oTarget); // Return the numer of items oTarget possesses from type sItem (Tag) int GetNumItems(object oTarget,string sItem); // Gives the item with the ResRef sItem to creature oTarget nNumItems times void GiveNumItems(object oTarget,string sItem,int nNumItems); // Remove nNumItems Items of Type sItem (Tag) from oTarget void TakeNumItems(object oTarget,string sItem,int nNumItems); // * plays the correct character theme // * assumes OBJECT_SELF is in the area void PlayCharacterTheme(int nTheme); // * plays the old theme for the area // * assumes OBJECT_SELF is in the area void PlayOldTheme(); int GetPLocalInt(object oPC,string sLocalName); void SetPLocalInt(object oPC,string sLocalName, int nValue); // * removes all negative effects void RemoveEffects(object oDead); // * starts store using appraise skill void gplotAppraiseOpenStore(object oStore, object oPC, int nBonusMarkUp = 0, int nBonusMarkDown = 0); // * starts store with favorable appraise check void gplotAppraiseFavOpenStore(object oStore, object oPC, int nBonusMarkUp = 0, int nBonusMarkDown = 0); //Do a DC check and modify the skill by the Target's Strength modifier int CheckDCStr(int DC, int nSkill, object oTarget); //Check to see if target is PC and not DM int GetIsPlayerCharacter(object oTarget); //Reward Experience based on an entry in the des_xp_rewards 2da file void Reward_2daXP(object oPC, int nRow, int bAllParty = TRUE, int nPercentage = 100); //Both speak a string ref as well as play the associate sound file void PlaySpeakSoundByStrRef(int nStrRef); // * returns a value that will be subtracted from the // * oTarget's DC to resist APpraise or Persuasion int GetNPCEasyMark(object oTarget) { int nCharmMod = 0; if (GetHasSpellEffect(SPELL_CHARM_PERSON, oTarget)) { nCharmMod = 10; } else if (GetHasSpellEffect(SPELL_CHARM_MONSTER, oTarget)) { nCharmMod = 10; } else if (GetHasSpellEffect(SPELL_CHARM_PERSON_OR_ANIMAL, oTarget)) { nCharmMod = 10; } else if (GetHasSpellEffect(SPELL_MASS_CHARM, oTarget)) { nCharmMod = 15; } else if (GetHasSpellEffect(SPELL_DOMINATE_MONSTER, oTarget)) { nCharmMod = 20; } else if (GetHasSpellEffect(SPELL_DOMINATE_ANIMAL, oTarget)) { nCharmMod = 20; } else if (GetHasSpellEffect(SPELL_DOMINATE_PERSON, oTarget)) { nCharmMod = 20; } return nCharmMod; } //:://///////////////////////////////////////////// //:: gplotAppraiseOpenStore //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Opens a store, modifying the store prices by the Appraise skill of the PCspeaker */ //::////////////////////////////////////////////// //:: Created By: //:: Created On: //:: 2003-05-26: Updated from XP1 sources - Georg //::////////////////////////////////////////////// void gplotAppraiseOpenStore(object oStore, object oPC, int nBonusMarkUp = 0, int nBonusMarkDown = 0) { int STATE_FAILED = 1; int STATE_TIE = 2; int STATE_WON = 3; string sTag = ObjectToString(OBJECT_SELF); int nPlayerSkillRank = GetSkillRank(SKILL_APPRAISE, oPC); int nNPCSkillRank = GetSkillRank(SKILL_APPRAISE, OBJECT_SELF) - GetNPCEasyMark(OBJECT_SELF); if (nNPCSkillRank < 1 ) nNPCSkillRank = 1; int nAdjust = 0; /* New System: An opposed skill check (a d10 roll instead). Your appraise skill versus the shopkeepers appraise skill. Possible Results: Percentage Rebate/Penalty: The 'difference' Feedback: [Appraise Skill]: Merchant's reaction is unfavorable. [Appraise Skill]: Merchant's reaction is neutral. [Appraise Skill]: Merchant's reaction is favorable. Additional: Remember last reaction for this particular skill. When the player gets a new skill rank in this skill they'll get a reroll against this merchant. */ int nState = 0; int nPreviousRank = GetLocalInt(oPC, "X0_APPRAISERANK"+ sTag); // * if the player's rank has improved, let them have another appraise check // * against this merchant if ( (nPlayerSkillRank > nPreviousRank) || !GetLocalInt(oPC, "X0_APPRAISEVISITED"+sTag) ) { SetLocalInt(oPC, "X0_APPRAISERANK"+ sTag, nPlayerSkillRank); SetLocalInt(oPC, "X0_APPRAISEVISITED"+sTag, 1); nPlayerSkillRank = nPlayerSkillRank + d10(); nNPCSkillRank = nNPCSkillRank + d10(); nAdjust = nNPCSkillRank - nPlayerSkillRank; // * determines the level of price modification if (nNPCSkillRank > nPlayerSkillRank) { nState = STATE_FAILED; } else if (nNPCSkillRank < nPlayerSkillRank) { nState = STATE_WON; } else if (nNPCSkillRank == nPlayerSkillRank) { nState = STATE_TIE; } } else { // * recover last reaction nAdjust = GetLocalInt(oPC, "X0_APPRAISEADJUST" + sTag); if (nAdjust > 0) { nState = STATE_FAILED; } else if (nAdjust < 0) { nState = STATE_WON; } else if (nAdjust == 0) { nState = STATE_TIE; } } if (nState == STATE_FAILED ) { FloatingTextStrRefOnCreature(182468, oPC, FALSE); } else if (nState == STATE_WON) { FloatingTextStrRefOnCreature(182470, oPC, FALSE); } else if (nState == STATE_TIE) { FloatingTextStrRefOnCreature(182469, oPC, FALSE); } SetLocalInt(oPC, "X0_APPRAISEADJUST"+ sTag, nAdjust); // SpawnScriptDebugger(); // * Hard cap of 30% max up or down if (nAdjust > 30) nAdjust = 30; if (nAdjust < -30) nAdjust = -30; nBonusMarkUp = nBonusMarkUp + nAdjust; nBonusMarkDown = nBonusMarkDown - nAdjust; OpenStore(oStore, oPC, nBonusMarkUp, nBonusMarkDown); } //:://///////////////////////////////////////////// //:: gplotAppraiseFavOpenStore //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Opens a store, modifying the store prices by the Appraise skill of the PCspeaker THIS SCRIPT ALWAYS RESULTS IN A GOOD APPRAISE RESULT */ //::////////////////////////////////////////////// //:: Created By: Keith Warner //:: Created On: Mar 7/03 //:: 2003-05-26: Updated from XP1 sources - Georg //::////////////////////////////////////////////// void gplotAppraiseFavOpenStore(object oStore, object oPC, int nBonusMarkUp = 0, int nBonusMarkDown = 0) { int STATE_WON = 3; string sTag = ObjectToString(OBJECT_SELF); int nPlayerSkillRank = GetSkillRank(SKILL_APPRAISE, oPC); int nNPCSkillRank = 0; int nAdjust = 0; int nState = STATE_WON; int nPreviousRank = GetLocalInt(oPC, "X0_APPRAISERANK"+ sTag); // * if the player's rank has improved, let them have another appraise check // * against this merchant if ( (nPlayerSkillRank > nPreviousRank) || !GetLocalInt(oPC, "X0_APPRAISEVISITED"+sTag) ) { SetLocalInt(oPC, "X0_APPRAISERANK"+ sTag, nPlayerSkillRank); SetLocalInt(oPC, "X0_APPRAISEVISITED"+sTag, 1); nPlayerSkillRank = nPlayerSkillRank + d10(); nAdjust = nNPCSkillRank - nPlayerSkillRank; // * determines the level of price modification } else { // * recover last reaction nAdjust = GetLocalInt(oPC, "X0_APPRAISEADJUST" + sTag); } FloatingTextStrRefOnCreature(8965, oPC, FALSE); SetLocalInt(oPC, "X0_APPRAISEADJUST"+ sTag, nAdjust); // * Hard cap of 30% max up or down if (nAdjust > 30) nAdjust = 30; if (nAdjust < -30) nAdjust = -30; nBonusMarkUp = nBonusMarkUp + nAdjust; nBonusMarkDown = nBonusMarkDown - nAdjust; OpenStore(oStore, oPC, nBonusMarkUp, nBonusMarkDown); } // * plays the correct character theme // * assumes OBJECT_SELF is in the area void PlayCharacterTheme(int nTheme) { object oArea =GetArea(OBJECT_SELF); int nMusicNight = MusicBackgroundGetNightTrack(oArea); int nMusicDay = MusicBackgroundGetDayTrack(oArea); // AssignCommand(GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC), SpeakString(IntToString(nMusic))); //* stores the last music track SetLocalInt(oArea, "NW_L_MYLASTTRACKNight", nMusicNight); SetLocalInt(oArea, "NW_L_MYLASTTRACKDay", nMusicDay); MusicBackgroundStop(oArea); MusicBackgroundChangeNight(oArea, nTheme); MusicBackgroundChangeDay(oArea, nTheme); MusicBackgroundPlay(oArea); } // * plays the old theme for the area // * assumes OBJECT_SELF is in the area void PlayOldTheme() { object oArea =GetArea(OBJECT_SELF); //* stores the last music track int nMusicNight = GetLocalInt(oArea, "NW_L_MYLASTTRACKNight"); int nMusicDay = GetLocalInt(oArea, "NW_L_MYLASTTRACKDay"); MusicBackgroundStop(oArea); MusicBackgroundChangeNight(oArea, nMusicNight); MusicBackgroundChangeDay(oArea, nMusicDay); MusicBackgroundPlay(oArea); } // Returns the adjusted Reaction for the purposes of store pricing. float GetReactionAdjustment(object oTarget); /* Adjusts all faction member's reputation visa via another faction. Pass in a member from each faction. */ void AdjustFactionReputation(object oTargetCreature, object oMemberOfSourceFaction, int nAdjustment); /* Makes the person teleport away and look like they are casting a spell. */ void EscapeViaTeleport(object oFleeing); // * FUNCTION DEFINITIONS int GetCanCastHealingSpells(object oPC) { talent tTalent = GetCreatureTalentBest(TALENT_CATEGORY_BENEFICIAL_HEALING_TOUCH, 20, oPC); if (GetIsTalentValid(tTalent) == TRUE) { return TRUE; } return FALSE; } int DoOnce() { int bResult = FALSE; if (GetLocalInt(OBJECT_SELF,"NW_L_DOONCE999") == 0) { SetLocalInt(OBJECT_SELF,"NW_L_DOONCE999",1); bResult = TRUE; } return bResult; } void DebugSpeak(string s) { SpeakString(s); } object GetMyMaster() { return GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC); } //:://///////////////////////////////////////////// //:: IsRecall //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Attempts to transport the player back to closest Temple of Tyr using a Recall Stone. */ //::////////////////////////////////////////////// //:: Created By: //:: Created On: //::////////////////////////////////////////////// int IsRecall() { if (GetTag(GetItemActivated()) == "NW_IT_RECALL") { string sAreaTag = GetTag(GetArea(GetItemActivator())); if (/*Chapter 1 Areas*/ sAreaTag == "MAP_M1S3B" || sAreaTag == "Map_M1S4C" || sAreaTag == "MAP_M1Q6F4" || // Fenthick area in Chapter1e sAreaTag == "Map_M1S4D" || sAreaTag == "Map_M1S4E" || sAreaTag == "Map_M1S4F" || /* Chapter 3 and 4 Areas*/ sAreaTag == "MAP_M1Q6A" || /*Castle Never*/ sAreaTag == "M4Q1D2" /*Final Source Stone level*/ || sAreaTag == "M4FinalArea" || /*Haedralines area*/ sAreaTag == "M3Q1A10" || /*Aarin Gend's Lodge*/ sAreaTag == "M3Q3C" || sAreaTag == "M3Q3Ca" || sAreaTag == "M3Q2G" || sAreaTag == "M3Q2I" || sAreaTag == "Map_M2Q2E2" || sAreaTag == "Map_M2Q2G" || sAreaTag == "Map_M2Q3GA" || sAreaTag == "Map_M2Q3GB") { AssignCommand(GetItemActivator(), ActionSpeakStringByStrRef(10611)); return TRUE; } else /* if (CanAffordIt() == FALSE) { AssignCommand(GetItemActivator(), ActionSpeakStringByStrRef(66200)); return TRUE; } else */ // * May 2002: Checking a global to see if Haedraline is around as well if ( GetLocalInt(GetModule(),"NW_G_RECALL_HAED") == 10 || GetIsObjectValid(GetNearestObjectByTag("Haedraline3Q11", GetItemActivator())) == TRUE) { AssignCommand(GetItemActivator(), ActionSpeakStringByStrRef(10612)); return TRUE; } else { object oPortal = GetObjectByTag("NW_RECALL_PORTAL"); if (GetIsObjectValid(oPortal) == TRUE) { SetLocalInt(GetItemActivator(), "NW_L_USED_RECALL", 1); SetLocalLocation(GetItemActivator(), "NW_L_LOC_RECALL", GetLocation(GetItemActivator())); string sTag = "NW_RECALL_PORTAL"; object oClicker = GetItemActivator(); object oTarget = GetObjectByTag(sTag); // AssignCommand(GetItemActivator(), SpeakString(sTag)); // * if I don't do this, gets stuck in a loop // * of casting. AssignCommand(oClicker, ClearAllActions()); AssignCommand(oClicker, PlaySound("as_mg_telepout1")); //SetAreaTransitionBMP(AREA_TRANSITION_RANDOM); // AssignCommand(oClicker, PlaySound("as_mg_telepout1")); AssignCommand(oClicker,JumpToObject(oTarget)); // AssignCommand(oClicker, DelayCommand(1.0,PlaySound("as_mg_telepout1"))); AssignCommand(oClicker, ActionDoCommand(ClearAllActions())); return TRUE; } // * this module does not have a temple of tyr else { AssignCommand(GetItemActivator(), ActionSpeakStringByStrRef(10614)); return TRUE; } } } return FALSE; } //:://///////////////////////////////////////////// //:: DimensionHop //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Will move the character from one point to oTarget with a flashy graphic. Original Use: Dryads in M3Q3, SnowGlobe */ //::////////////////////////////////////////////// //:: Created By: Brent //:: Created On: January 10, 2002 //::////////////////////////////////////////////// void DimensionHop(object oTarget) { if (GetDistanceToObject(oTarget) > 2.5) { effect eVis = EffectVisualEffect(VFX_IMP_UNSUMMON); ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF); ActionJumpToObject(oTarget); } } //:://///////////////////////////////////////////// //:: CanSeePlayer //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Returns true if OBJECT_SELF can see the player */ //::////////////////////////////////////////////// //:: Created By: //:: Created On: //::////////////////////////////////////////////// int CanSeePlayer() { return GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN)); } //:://///////////////////////////////////////////// //:: EscapeArea() //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Runs object to nearest waypoint with tag "NW_EXIT". This tag can be overridden. You can also specify whether to run or not. */ //::////////////////////////////////////////////// //:: Created By: Brent //:: Created On: December 2001 //::////////////////////////////////////////////// void EscapeArea(int bRun = TRUE, string sTag="NW_EXIT") { object oWay = GetNearestObjectByTag(sTag); if (GetIsObjectValid(oWay)) { ActionMoveToObject(oWay, bRun); ActionDoCommand(DestroyObject(OBJECT_SELF)); SetCommandable(FALSE); // * this prevents them from being interrupted } //else //SpeakString("invalid exit waypoint"); } //:://///////////////////////////////////////////// //:: HasItem //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* A wrapper to simplify checking for an item. */ //::////////////////////////////////////////////// //:: Created By: Brent //:: Created On: November 2001 //::////////////////////////////////////////////// int HasItem(object oCreature, string s) { return GetIsObjectValid(GetItemPossessedBy(oCreature, s)); } //:://///////////////////////////////////////////// //:: Take Gold //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Takes nAmount of gold from the object speaking. By default, the gold is destroyed. */ //::////////////////////////////////////////////// //:: Created By: Brent //:: Created On: November 2001 //::////////////////////////////////////////////// void TakeGold(int nAmount, object oGoldHolder, int bDestroy=TRUE) { TakeGoldFromCreature(nAmount, oGoldHolder, bDestroy); } //:://///////////////////////////////////////////// //:: HasGold //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Checks to see if the player has nAmount of gold */ //::////////////////////////////////////////////// //:: Created By: //:: Created On: //::////////////////////////////////////////////// int HasGold(int nAmount, object oGoldHolder) { return GetGold(oGoldHolder) >= nAmount; } // GetNearestPC() /* Find nearest player object from oTarget. Parameters: object oTarget = Begin search from location of oTarget int bOwnedCharacter = If TRUE, find nearest PC, else, find nearest creature controlled by a player int bIsAlive = If TRUE, ignore dead, else, ignore alive creatures int nNth = Return nNth match (Default = first) Remark: CREATURE_TYPE_IS_ALIVE currently matches exclusive dead or alive (Dead xor Alive?). */ // Brent 5/16/01 // BMA-OEI 1/23/06 object GetNearestPC(object oTarget=OBJECT_SELF, int bOwnedCharacter=TRUE, int bIsAlive=TRUE, int nNth=1) { int nPCValue; if (bOwnedCharacter == TRUE) { nPCValue = PLAYER_CHAR_IS_PC; } else { nPCValue = PLAYER_CHAR_IS_CONTROLLED; } return GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, nPCValue, oTarget, nNth, CREATURE_TYPE_IS_ALIVE, bIsAlive); } //:: SetIsEnemy ////////////////////////////////////////////////// // // [Function Name] // ////////////////////////////////////////////////// // // // [A description of the function. This should contain any // special ranges on input values] // ////////////////////////////////////////////////// // // Created By: // Created On: // ////////////////////////////////////////////////// void SetIsEnemy(object oTarget) { AdjustReputation(oTarget, OBJECT_SELF,-100); ActionAttack(oTarget); } /////////////////////////////////////////////////////////////////////////////// // // AutoDC // /////////////////////////////////////////////////////////////////////////////// // Returns a pass value based on the object's level and the suggested DC // December 20 2001: Changed so that the difficulty is determined by the // NPC's Hit Dice // November 2002 (Brent): Adding a higher upper range for level 15+ campaigns. // August 2003 (Georg): Fixed bug not adding up DCs in the correct order /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 13 2001 /////////////////////////////////////////////////////////////////////////////// int AutoDC(int DC, int nSkill, object oTarget) { /* Easy = Lvl/4 ...rounded up Moderate = 3/Lvl + Lvl ...rounded up Difficult = Lvl * 1.5 + 6 ...rounded up */ int nLevel = GetHitDice(OBJECT_SELF); int nTest = 0; // * July 2 // * If nLevel is less than 0 or 0 then set it to 1 if (nLevel <= 0) { nLevel = 1; } switch (DC) { case DC_EASY: nTest = nLevel / 4 + 1; break; // * minor tweak to lower the values a little case DC_MEDIUM: nTest = (3 / nLevel + nLevel) - abs( (nLevel/2) -2); break; case DC_HARD: nTest = FloatToInt(nLevel * 1.5 + 6) - abs( ( FloatToInt(nLevel/1.5) -2)); break; case DC_SUPERIOR: nTest = 7+ FloatToInt(nLevel * 1.5 + 6) - abs( ( FloatToInt(nLevel/1.5) -2)); break; case DC_MASTER: nTest = 14 + FloatToInt(nLevel * 1.5 + 6) - abs( ( FloatToInt(nLevel/1.5) -2)); break; case DC_LEGENDARY: nTest = 21 + FloatToInt(nLevel * 1.5 + 6) - abs( ( FloatToInt(nLevel/1.5) -2)); break; case DC_EPIC: nTest = 28 + FloatToInt(nLevel * 1.5 + 6) - abs( ( FloatToInt(nLevel/1.5) -2)); break; } // ********************************* // * CHARM/DOMINATION // * If charmed or dominated the NPC // * will be at a disadvantage // ********************************* int nCharmMod = 0; if (nSkill == SKILL_DIPLOMACY || nSkill == SKILL_BLUFF || nSkill == SKILL_INTIMIDATE) nCharmMod = GetNPCEasyMark(oTarget); int nDC = nTest + 10 - nCharmMod ; if (nDC < 1 ) nDC = 1; // * Roll d20 + skill rank vs. DC + 10 if (GetSkillRank(nSkill, oTarget) + d20() >= (nDC) ) { return TRUE; } return FALSE; } /////////////////////////////////////////////////////////////////////////////// // // AutoAlignG(int DC, object oTarget) // /////////////////////////////////////////////////////////////////////////////// // Adjusts the alignment of the object towards good, relative to the // degree indicated. /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 13, 2001 /////////////////////////////////////////////////////////////////////////////// void AutoAlignG(int DC, object oTarget) { int nShift = 0; switch (DC) { case 0: nShift = 3; break; case 1: nShift = 7; break; case 2: nShift = 10; break; } AdjustAlignment(oTarget, ALIGNMENT_GOOD, nShift); } /////////////////////////////////////////////////////////////////////////////// // // AutoAlignE // /////////////////////////////////////////////////////////////////////////////// // Adjusts the alignment of the object towards evil, relative to the // degree indicated. /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 13, 2001 /////////////////////////////////////////////////////////////////////////////// void AutoAlignE(int DC, object oTarget) { int nShift = 0; switch (DC) { case 0: nShift = 3; break; case 1: nShift = 7; break; case 2: nShift = 10; break; } AdjustAlignment(oTarget, ALIGNMENT_EVIL, nShift); } //:://///////////////////////////////////////////// //:: DoGiveXP //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Gives the designated XP to the object using the design rules for XP distribution. */ //::////////////////////////////////////////////// //:: Created By: //:: Created On: //::////////////////////////////////////////////// void DoGiveXP(string sJournalTag, int nPercentage, object oTarget, int QuestAlignment=ALIGNMENT_NEUTRAL) { float nRewardMod = 1.0; // * error handling if ((nPercentage < 0) || (nPercentage > 100)) { nPercentage = 100; } float nXP = GetJournalQuestExperience(sJournalTag) * (nPercentage * 0.01); // * for each party member // * cycle through them and // * and give them the appropriate reward // * HACK FOR NOW if ((GetAlignmentGoodEvil(oTarget) == ALIGNMENT_NEUTRAL) || (QuestAlignment ==ALIGNMENT_NEUTRAL) ) { nRewardMod = 1.0; } else if (GetAlignmentGoodEvil(oTarget) == QuestAlignment) { nRewardMod = 1.25; } else if (GetAlignmentGoodEvil(oTarget) != QuestAlignment) { nRewardMod = 0.75; } // AssignCommand(oTarget,SpeakString("My XP reward is: " + FloatToString(nRewardMod * nXP))); GiveXPToCreature(oTarget, FloatToInt(nRewardMod * nXP)); } /////////////////////////////////////////////////////////////////////////////// // // RewardXP // /////////////////////////////////////////////////////////////////////////////// // Gives each player the reward, scaled 1.25 times if of the correct alignment // and 0.75 times if of the wrong alignment. Neutral always get the // 1.0 times reward. /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 13, 2001 /////////////////////////////////////////////////////////////////////////////// void RewardXP(string sJournalTag, int nPercentage, object oTarget, int QuestAlignment=ALIGNMENT_NEUTRAL, int bAllParty=TRUE) { // AssignCommand(oTarget, SpeakString("in rewardxp funtion")); if (bAllParty == TRUE) { object oPartyMember = GetFirstFactionMember(oTarget, TRUE); while (GetIsObjectValid(oPartyMember) == TRUE) { DoGiveXP(sJournalTag, nPercentage, oPartyMember, QuestAlignment); oPartyMember = GetNextFactionMember(oTarget, TRUE); // AssignCommand(oTarget,SpeakString("here your xp sir")); } } else { DoGiveXP(sJournalTag, nPercentage, oTarget, QuestAlignment); } } /////////////////////////////////////////////////////////////////////////////// // // RewardGP // /////////////////////////////////////////////////////////////////////////////// // Gives the GP to (if bAllParty = TRUE) all party members. // Each players gets the GP value amount. /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 13, 2001 /////////////////////////////////////////////////////////////////////////////// void RewardGP(int GP, object oTarget,int bAllParty=TRUE) { // * for each party member // * cycle through them and // * and give them the appropriate reward // * HACK FOR NOW if (bAllParty == TRUE) { object oPartyMember = GetFirstFactionMember(oTarget, TRUE); while (GetIsObjectValid(oPartyMember) == TRUE) { //AssignCommand(oPartyMember, SpeakString("MY GP reward is: " + IntToString(GP))); GiveGoldToCreature(oPartyMember, GP); oPartyMember = GetNextFactionMember(oTarget, TRUE); } } else { GiveGoldToCreature(oTarget, GP); } } // * // * Conversation Functions // * /////////////////////////////////////////////////////////////////////////////// // // CheckCharismaMiddle // /////////////////////////////////////////////////////////////////////////////// // Returns TRUE if charisma is in the normal range. /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 13, 2001 /////////////////////////////////////////////////////////////////////////////// int CheckCharismaMiddle() { if (GetAbilityScore(GetPCSpeaker(),ABILITY_CHARISMA) >= 10 && GetAbilityScore(GetPCSpeaker(),ABILITY_CHARISMA) < 15) { return TRUE; } return FALSE; } /////////////////////////////////////////////////////////////////////////////// // // CheckCharismaNormal // /////////////////////////////////////////////////////////////////////////////// // Returns TRUE if charisma is in the normal range. /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 13, 2001 /////////////////////////////////////////////////////////////////////////////// int CheckCharismaNormal() { if (GetAbilityScore(GetPCSpeaker(),ABILITY_CHARISMA) >= 10) { return TRUE; } return FALSE; } /////////////////////////////////////////////////////////////////////////////// // // CheckCharismaLow // /////////////////////////////////////////////////////////////////////////////// // Returns TRUE if charisma is in the low range. /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 13, 2001 /////////////////////////////////////////////////////////////////////////////// int CheckCharismaLow() { if (GetAbilityScore(GetPCSpeaker(),ABILITY_CHARISMA) < 10) { return TRUE; } return FALSE; } /////////////////////////////////////////////////////////////////////////////// // // CheckCharismaHigh // /////////////////////////////////////////////////////////////////////////////// // Returns TRUE if charisma is in the high range. /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 13, 2001 /////////////////////////////////////////////////////////////////////////////// int CheckCharismaHigh() { if (GetAbilityScore(GetPCSpeaker(),ABILITY_CHARISMA) >= 15) { return TRUE; } return FALSE; } /////////////////////////////////////////////////////////////////////////////// // // CheckIntelligenceLow // /////////////////////////////////////////////////////////////////////////////// // Returns TRUE if intelligence is in the low range /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 13, 2001 /////////////////////////////////////////////////////////////////////////////// int CheckIntelligenceLow() { if (GetAbilityScore(GetPCSpeaker(),ABILITY_INTELLIGENCE) < 9) return TRUE; return FALSE; } /////////////////////////////////////////////////////////////////////////////// // // CheckIntelligenceNormal // /////////////////////////////////////////////////////////////////////////////// // Returns TRUE if intelligence is in the normal range /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 13, 2001 /////////////////////////////////////////////////////////////////////////////// int CheckIntelligenceNormal() { if (GetAbilityScore(GetPCSpeaker(),ABILITY_INTELLIGENCE) >= 9) return TRUE; return FALSE; } //:://///////////////////////////////////////////// //:: CheckIntelligenceHigh //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* */ //::////////////////////////////////////////////// //:: Created By: //:: Created On: //::////////////////////////////////////////////// int CheckIntelligenceHigh() { if (GetAbilityScore(GetPCSpeaker(),ABILITY_INTELLIGENCE) >= 15) return TRUE; return FALSE; } /////////////////////////////////////////////////////////////////////////////// // // CheckWisdomHigh // /////////////////////////////////////////////////////////////////////////////// // Returns TRUE if wisdom is in the High range /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 13, 2001 /////////////////////////////////////////////////////////////////////////////// int CheckWisdomHigh() { if (GetAbilityScore(GetPCSpeaker(),ABILITY_WISDOM) > 13) return TRUE; return FALSE; } int GetWisdom(object oTarget) { return GetAbilityScore(oTarget, ABILITY_WISDOM); } int GetIntelligence(object oTarget) { return GetAbilityScore(oTarget, ABILITY_INTELLIGENCE); } int GetCharisma(object oTarget) { return GetAbilityScore(oTarget, ABILITY_CHARISMA); } //:: GetNumItems ////////////////////////////////////////////////// // // GetNumItems // ////////////////////////////////////////////////// // // // Returns the number of specified item in the // target's inventory. // ////////////////////////////////////////////////// // // Created By: John // Created On: September 19, 2001 // ////////////////////////////////////////////////// int GetNumItems(object oTarget,string sItem) { int nNumItems = 0; object oItem = GetFirstItemInInventory(oTarget); while (GetIsObjectValid(oItem) == TRUE) { if (GetTag(oItem) == sItem) { nNumItems = nNumItems + GetNumStackedItems(oItem); } oItem = GetNextItemInInventory(oTarget); } return nNumItems; } //:: GiveNumItems ////////////////////////////////////////////////// // // GiveNumItems // ////////////////////////////////////////////////// // // // Gives the target the number of items specified. // ////////////////////////////////////////////////// // // Created By: John // Created On: September 19, 2001 // ////////////////////////////////////////////////// void GiveNumItems(object oTarget,string sItem,int nNumItems) { int nCount = 0; object oItem = GetFirstItemInInventory(OBJECT_SELF); while (GetIsObjectValid(oItem) == TRUE && nCount < nNumItems) { if (GetTag(oItem) == sItem) { ActionGiveItem(oItem,oTarget); nCount++; } oItem = GetNextItemInInventory(OBJECT_SELF); } return; } //:: TakeNumItems ////////////////////////////////////////////////// // // TakeNumItems // ////////////////////////////////////////////////// // // // Takes the number of items specified from the target. // ////////////////////////////////////////////////// // // Created By: John // Created On: September 19, 2001 // ////////////////////////////////////////////////// void TakeNumItems(object oTarget,string sItem,int nNumItems) { int nCount = 0; object oItem = GetFirstItemInInventory(oTarget); while (GetIsObjectValid(oItem) == TRUE && nCount < nNumItems) { if (GetTag(oItem) == sItem) { ActionTakeItem(oItem,oTarget); nCount++; } oItem = GetNextItemInInventory(oTarget); } return; } /////////////////////////////////////////////////////////////////////////////// // // GetReactionAdjustment // /////////////////////////////////////////////////////////////////////////////// // Returns the adjusted Reaction for the purposes of store pricing. /////////////////////////////////////////////////////////////////////////////// // Created By: Brent, September 25, 2001 /////////////////////////////////////////////////////////////////////////////// float GetReactionAdjustment(object oTarget) { float nFactionAdjustment = 2.0; // (i) if (GetIsFriend(oTarget) == TRUE) { nFactionAdjustment = 1.0; } // (ii) int oTargetLawChaos = GetLawChaosValue(oTarget); int oTargetGoodEvil = GetGoodEvilValue(oTarget); int oSourceLawChaos = GetLawChaosValue(OBJECT_SELF); int oSourceGoodEvil = GetGoodEvilValue(OBJECT_SELF); int APB = abs(oSourceLawChaos - oTargetLawChaos) + abs(oSourceGoodEvil - oTargetGoodEvil); int nTargetCharismaMod = GetAbilityModifier(ABILITY_CHARISMA, oTarget); return abs(10 + APB - (nTargetCharismaMod * 10)) * nFactionAdjustment; } //:://///////////////////////////////////////////// //:: AdjustFactionReputation //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Adjusts all faction member's reputation visa via another faction. Pass in a member from each faction. */ //::////////////////////////////////////////////// //:: Created By: Presotn Watamaniuk //:: Created On: Nov 15, 2001 //::////////////////////////////////////////////// void AdjustFactionReputation(object oTargetCreature, object oMemberOfSourceFaction, int nAdjustment) { object oFaction = GetFirstFactionMember(oTargetCreature); while(GetIsObjectValid(oFaction)) { AdjustReputation(oTargetCreature, oMemberOfSourceFaction, nAdjustment); oFaction = GetNextFactionMember(oTargetCreature); } AdjustReputation(oTargetCreature, oMemberOfSourceFaction, nAdjustment); } //:://///////////////////////////////////////////// //:: Escape Via Teleport //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Makes the person teleport away and look like they are casting a spell. */ //::////////////////////////////////////////////// //:: Created By: Preston Watamaniuk //:: Created On: March 12, 2002 //::////////////////////////////////////////////// void EscapeViaTeleport(object oFleeing) { effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3); ActionCastFakeSpellAtObject(SPELL_LESSER_GLOBE_OF_INVULNERABILITY, oFleeing); // JLR - OEI 07/11/05 -- Name Changed DelayCommand(1.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetLocation(oFleeing))); DestroyObject(oFleeing, 2.5); } //:://///////////////////////////////////////////// //:: GetP(arty)LocalInt //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Scans through all players in the party, to treat them all as 'one person' for the purposes of most plots. Makes our plots more multiplayer friendly. */ //::////////////////////////////////////////////// //:: Created By: John //:: Created On: //::////////////////////////////////////////////// int GetPLocalInt(object oPC,string sLocalName) { int nValue = 0; object oMember; oMember = GetFirstFactionMember(oPC); while (GetIsObjectValid(oMember)) { if (GetLocalInt(oPC,sLocalName) > nValue) { nValue = GetLocalInt(oMember,sLocalName); } oMember = GetNextFactionMember(oPC); } return nValue; } //:://///////////////////////////////////////////// //:: SetP(arty)LocalInt //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* */ //::////////////////////////////////////////////// //:: Created By: John //:: Created On: //::////////////////////////////////////////////// void SetPLocalInt(object oPC,string sLocalName, int nValue) { object oMember; oMember = GetFirstFactionMember(oPC); while (GetIsObjectValid(oMember)) { SetLocalInt(oMember,sLocalName,nValue); oMember = GetNextFactionMember(oPC); } return; } // * removes all negative effects void RemoveEffects(object oDead) { //Declare major variables object oTarget = oDead; effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION); int bValid; effect eBad = GetFirstEffect(oTarget); //Search for negative effects while(GetIsEffectValid(eBad)) { if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS || GetEffectType(eBad) == EFFECT_TYPE_DEAF || GetEffectType(eBad) == EFFECT_TYPE_PARALYZE || GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL || GetEffectType(eBad) == EFFECT_TYPE_FRIGHTENED || GetEffectType(eBad) == EFFECT_TYPE_DAZED || GetEffectType(eBad) == EFFECT_TYPE_CONFUSED || GetEffectType(eBad) == EFFECT_TYPE_POISON || GetEffectType(eBad) == EFFECT_TYPE_DISEASE ) { //Remove effect if it is negative. RemoveEffect(oTarget, eBad); } eBad = GetNextEffect(oTarget); } //Fire cast spell at event for the specified target SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE)); ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oTarget); // * May 2002: Removed this because ActionRest is no longer an instant. // * rest the player //AssignCommand(oDead, ActionRest()); } int CheckDCStr(int DC, int nSkill, object oTarget) { /* Easy = Lvl/4 ...rounded up Moderate = 3/Lvl + Lvl ...rounded up Difficult = Lvl * 1.5 + 6 ...rounded up */ int nLevel = GetHitDice(OBJECT_SELF); int nTest = 0; // * July 2 // * If nLevel is less than 0 or 0 then set it to 1 if (nLevel <= 0) { nLevel = 1; } switch (DC) { case 0: nTest = nLevel / 4 + 1; break; // * minor tweak to lower the values a little case 1: nTest = (3 / nLevel + nLevel) - abs( (nLevel/2) -2); break; case 2: nTest = FloatToInt(nLevel * 1.5 + 6) - abs( ( FloatToInt(nLevel/1.5) -2)); case 3: nTest = nTest + 7; case 4: nTest = nTest + 7; case 5: nTest = nTest + 7; // because there are no break statements it should // add all the bonuses } //SpeakString(IntToString(nTest)); // * Roll d20 + skill rank vs. DC + 10 if (GetSkillRank(nSkill, oTarget) + d20() + GetAbilityModifier(ABILITY_STRENGTH, oTarget) >= (nTest + 10) ) { return TRUE; } return FALSE; } // * returns true if the player can afford to lose the indicated amount of XP without losing a level int plotCanRemoveXP(object oPC, int nPenalty) { int nXP = GetXP(oPC); int nHD = GetHitDice(oPC); // * You can not lose a level with this int nMin = ((nHD * (nHD - 1)) / 2) * 1000; int nNewXP = nXP - nPenalty; if (nNewXP < nMin) return FALSE; return TRUE; } int GetIsPlayerCharacter(object oTarget) { if (GetIsPC(oTarget) == TRUE && GetIsDM(oTarget) == FALSE) return TRUE; return FALSE; } //:://///////////////////////////////////////////// //:: Name Reward_2daXP //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Pass in a PC and a row from the 'des_xp_rewards' 2da file to reward the PC and/or party experience */ //::////////////////////////////////////////////// //:: Created By: Keith Warner //:: Created On: May 29/03 //::////////////////////////////////////////////// void Reward_2daXP(object oPC, int nRow, int bAllParty = TRUE, int nPercentage = 100) { float fPercent = IntToFloat(nPercentage)/100.0; int nPlotXP = StringToInt(Get2DAString("des_xp_rewards", "XP", nRow)); int nReward = FloatToInt(fPercent * nPlotXP); if (bAllParty == TRUE) { object oParty = GetFirstFactionMember(oPC); while (oParty != OBJECT_INVALID) { GiveXPToCreature(oParty, nReward); oParty = GetNextFactionMember(oPC); } } else { GiveXPToCreature(oPC, nReward); } } //:://///////////////////////////////////////////// //:: Name PlaySpeakSoundByStrRef /* Do both a SpeakStringRef and a Play StringRef at the same time. */ //::////////////////////////////////////////////// //:: Created By: Keith Warner //:: Created On: Oct 23/03 //::////////////////////////////////////////////// void PlaySpeakSoundByStrRef(int nStrRef) { SpeakStringByStrRef(nStrRef); PlaySoundByStrRef(nStrRef, FALSE); } |
Code: |
//::///////////////////////////////////////////////
//:: NW_O2_CONINCLUDE.nss //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* This include file handles the random treasure distribution for treasure from creatures and containers [ ] Documented */ //::////////////////////////////////////////////// //:: Created By: Brent, Andrew //:: Created On: November - May //::////////////////////////////////////////////// // :: MODS // April 23 2002: Removed animal parts. They were silly. // May 6 2002: Added Undead to the EXCLUSION treasure list (they drop nothing now) // - redistributed treasure (to lessen amoun t of armor and increase 'class specific treasure' // - Rangers with heavy armor prof. will be treated as Fighters else as Barbarians // - Gave wizards, druids and monk their own function // MAY 29 2002: Removed the heal potion from treasure // Moved nymph cloak +4 to treasure bracket 6 // Added Monk Enhancement items to random treasure // ChazM 7/11/05 modified dbCreateItemOnObject() - added PrintString()'s // BDF - 5/30/06: included ginc_debug for output in dbCreateItemOnObejct // ChazM 7/7/06 modified CreateArcaneScroll() and CreateDivineScroll() to only reference existing scrolls. // ChazM 7/11/06 fixed GetNW_ArcaneScrollRandom // ChazM 7/17/06 removed "nw_wmgwn006"; modified GetNW_ArcaneScrollRandom() and GetNW_ArcaneScrollSkip() // ChazM 7/21/06 removed "nw_it_mpotion007" from CreatePotion() // ChazM 8/2/06 removed "nw_maarcl074", modified error output // ChazM 8/2/06 removed the following deleted blueprints: nw_it_mglove006, nw_it_mglove012, nw_it_mmidmisc01, nw_it_mmidmisc03, // nw_it_mmidmisc05, nw_it_msmlmisc20, nw_maarcl040, nw_maarcl041, nw_maarcl050, nw_maarcl086, nw_wblfh001, nw_wblmfh002, // nw_wblmfh003, nw_wblmfh004, nw_wblmfh005, nw_wblmfh006, nw_wblmfh008, nw_wblmfh010,w_wblmfh011, nw_wdbax001, nw_wdbmax002, // nw_wdbmax004, nw_wdbmax005, nw_wdbmax006, nw_wdbmax007, nw_wdbmax010, nw_wdbmax011,w_wdbmsw002, nw_wdbmsw004, nw_wdbmsw005, // nw_wdbmsw006, nw_wdbmsw007, nw_wdbmsw010, nw_wdbmsw011, nw_wdbsw001 // ChazM 8/8/06 removed "aarcl005" // ChazM 8/24/06 removed nw_it_mglove008, nw_it_mglove014, nw_it_mbracer011, nw_wspmsc003 // ChazM 8/24/06 added CreateNWN1Book(), CreateRecipeBook(); modified CreateBook() // ChazM 8/24/06 added constants for treasure drop chance. // ChazM 8/25/06 Amount of gold dropped for low level creatures increased. Chance of multiple drops now possible for Low Treasure Type. // No chance of Junk for any Treasure Type. Added some comments. // ChazM 8/25/06 changed LOW_TREASURE_DROP_CHANCE to 16 per Kevin's request. // ChazM 8/25/06 changed LOW_TREASURE_DROP_CHANCE to 20 per Kevin's request. #include "ginc_debug" //void main(){} // * --------- // * CONSTANTS // * --------- // * tweaking constants // * SIX LEVEL RANGES const int RANGE_1_MIN = 0; const int RANGE_1_MAX = 5; const int RANGE_2_MIN = 6; const int RANGE_2_MAX = 8; const int RANGE_3_MIN = 9; const int RANGE_3_MAX = 10; const int RANGE_4_MIN = 11; const int RANGE_4_MAX = 13; const int RANGE_5_MIN = 14; const int RANGE_5_MAX = 16; const int RANGE_6_MIN = 17; const int RANGE_6_MAX = 100; // Treasure Drop chances. // A treasure drop will only occur this % of the time for the particular treasure type. // by default creatures use low treasure (set in nw_c2_default9) const int LOW_TREASURE_DROP_CHANCE = 20; const int MID_TREASURE_DROP_CHANCE = 100; const int HIGH_TREASURE_DROP_CHANCE = 100; // * NUMBER OF ITEMS APPEARING // if there is a treasure drop, this is the likelihood of multiple drops, based on Treasure Type. const int NUMBER_LOW_ONE = 90; const int NUMBER_MED_ONE = 60; const int NUMBER_HIGH_ONE = 40; const int NUMBER_BOSS_ONE = 100; const int NUMBER_LOW_TWO = 9; const int NUMBER_MED_TWO = 30; const int NUMBER_HIGH_TWO = 40; const int NUMBER_BOSS_TWO = 0; const int NUMBER_LOW_THREE = 1; const int NUMBER_MED_THREE = 10; const int NUMBER_HIGH_THREE = 20; const int NUMBER_BOSS_THREE = 0; const int NUMBER_BOOK_ONE = 75; const int NUMBER_BOOK_TWO = 20; const int NUMBER_BOOK_THREE = 5; // * AMOUNT OF GOLD BY VALUE // the relative amount for each gold drop. The base amount is scaled by level (of the creature for creature treasure). const float LOW_MOD_GOLD = 0.5; const float MEDIUM_MOD_GOLD = 1.0; const float HIGH_MOD_GOLD = 3.0; // * FREQUENCY OF ITEM TYPE APPEARING BY TREASURE TYPE const int LOW_PROB_BOOK = 1; const int MEDIUM_PROB_BOOK = 1; const int HIGH_PROB_BOOK = 1; const int LOW_PROB_ANIMAL = 0; const int MEDIUM_PROB_ANIMAL = 0; const int HIGH_PROB_ANIMAL = 0; const int LOW_PROB_JUNK = 0; const int MEDIUM_PROB_JUNK = 0; const int HIGH_PROB_JUNK = 0; const int LOW_PROB_GOLD = 47; const int MEDIUM_PROB_GOLD = 38; const int HIGH_PROB_GOLD = 15; const int LOW_PROB_GEM = 9; const int MEDIUM_PROB_GEM = 15; const int HIGH_PROB_GEM = 15; const int LOW_PROB_JEWEL = 4; const int MEDIUM_PROB_JEWEL = 6; const int HIGH_PROB_JEWEL = 15; const int LOW_PROB_ARCANE = 3; const int MEDIUM_PROB_ARCANE = 3; const int HIGH_PROB_ARCANE = 3; const int LOW_PROB_DIVINE = 3; const int MEDIUM_PROB_DIVINE = 3; const int HIGH_PROB_DIVINE = 3; const int LOW_PROB_AMMO = 10; const int MEDIUM_PROB_AMMO = 5; const int HIGH_PROB_AMMO = 3; const int LOW_PROB_KIT = 5; const int MEDIUM_PROB_KIT = 5; const int HIGH_PROB_KIT = 5; const int LOW_PROB_POTION = 17; const int MEDIUM_PROB_POTION = 20; const int HIGH_PROB_POTION = 9; const int LOW_PROB_TABLE2 = 1; const int MEDIUM_PROB_TABLE2 = 3; const int HIGH_PROB_TABLE2 = 30; // * readability constants const int TREASURE_LOW = 1; const int TREASURE_MEDIUM = 2; const int TREASURE_HIGH = 3; const int TREASURE_BOSS = 4; const int TREASURE_BOOK = 5; // * JUMP_LEVEL is used in a Specific item function // * in the case where a generic item is called for within that function // * it will create a generic item by adding JUMP_LEVEL to the character's // * hit die for the purposes of the treasure evaluation. // * May 2002: Lowered JUMP_LEVEL from 3 to 2 const int JUMP_LEVEL = 2; // BDF - OEI: 7/6/06 // Bioware's hard-coded systems do not allow for easy migration to NWN2 due to an excess of hard-coded data values // integrated with their logic. Below are various constants that define certain quantities that are // valid in NWN2, but not necessarily NWN1. const int NWN2_MAX_NUM_ITEMS_BOOKS = 32; /////////////////////////////////////// //* Declarations /////////////////////////////////////// void CreateBook(object oTarget); void CreateNWN1Book(object oTarget); void CreateRecipeBook(object oTarget); void CreateGenericExotic(object oTarget, object oAdventurer, int nModifier = 0); void CreateGenericMonkWeapon(object oTarget, object oAdventurer, int nModifier = 0); void CreateSpecificMonkWeapon(object oTarget, object oAdventurer, int nModifier = 0); void CreateGenericDruidWeapon(object oTarget, object oAdventurer, int nModifier = 0); void CreateSpecificDruidWeapon(object oTarget, object oAdventurer, int nModifier = 0); void CreateGenericWizardWeapon(object oTarget, object oAdventurer, int nModifier = 0); void CreateSpecificWizardWeapon(object oTarget, object oAdventurer, int nModifier = 0); int nDetermineClassToUse(object oCharacter); /////////////////////////////////////// // * IMPLEMENTATION /////////////////////////////////////// // * Comment the speakstring in to debug treasure generation void dbSpeak(string s) { // SpeakString(s); } //* made this function to help with debugging void dbCreateItemOnObject(string sItemTemplate, object oTarget = OBJECT_SELF, int nStackSize = 1) { /* if (sItemTemplate == "") { PrintString("blank item passed into dbCreateItemOnObject. Please report as bug to Brent."); } dbSpeak(sItemTemplate); */ //sItemTemplate = GetStringLowerCase if (nStackSize == 1) { // * checks to see if this is a throwing item and if it is // * it creates more string sRoot = GetSubString(sItemTemplate, 0, 6); //dbSpeak("ROOT: " + sRoot); if (GetStringLowerCase(sRoot) == "nw_wth") { nStackSize = Random(30) + 1; } } object oItem = CreateItemOnObject(sItemTemplate, oTarget, nStackSize); PrintString ("Created " + IntToString(nStackSize) + " of " + sItemTemplate + " on " + GetName(oTarget)); if (GetIsObjectValid(oItem) == FALSE && sItemTemplate != "NW_IT_GOLD001") { // * check to see if item is there in a stack, if not give warning if (GetIsObjectValid(GetItemPossessedBy(oTarget, GetStringUpperCase(sItemTemplate))) == FALSE && GetIsObjectValid(GetItemPossessedBy(oTarget, GetStringLowerCase(sItemTemplate))) == FALSE) { string sErrorOutput = "nw_o2_coninclude: ******" + sItemTemplate + " is an invalid item template. Please report as bug. [Note that this is not reproducible as this item was randomly chosen]"; PrintString("**DESIGN***"); PrintString( sErrorOutput ); PrintString("*******"); PrettyError( sErrorOutput ); } } } // * // * GET FUNCTIONS // * // * Returns the object that either last opened the container or destroyed it object GetLastOpener() { if (GetIsObjectValid(GetLastOpenedBy()) == TRUE) { //dbSpeak("LastOpener: GetLastOpenedBy " + GetTag(GetLastOpenedBy())); return GetLastOpenedBy(); } else if (GetIsObjectValid(GetLastKiller()) == TRUE) { //dbSpeak("LastOpener: GetLastAttacker"); return GetLastKiller(); } //dbSpeak("LastOpener: The Object is Invalid you weenie!"); return OBJECT_INVALID; } //:://///////////////////////////////////////////// //:: GetRange //:: Copyright (c) 2002 Bioware Corp. //::////////////////////////////////////////////// /* Returns true if nHD matches the correct level range for the indicated nCategory. (i.e., First to Fourth level characters are considered Range1) */ //::////////////////////////////////////////////// //:: Created By: Brent //:: Created On: //::////////////////////////////////////////////// int GetRange(int nCategory, int nHD) { int nMin = 0; int nMax = 0; switch (nCategory) { case 6: nMin = RANGE_6_MIN; nMax = RANGE_6_MAX; break; case 5: nMin = RANGE_5_MIN; nMax = RANGE_5_MAX; break; case 4: nMin = RANGE_4_MIN; nMax = RANGE_4_MAX; break; case 3: nMin = RANGE_3_MIN; nMax = RANGE_3_MAX; break; case 2: nMin = RANGE_2_MIN; nMax = RANGE_2_MAX; break; case 1: nMin = RANGE_1_MIN; nMax = RANGE_1_MAX; break; } //dbSpeak("nMin = " + IntToString(nMin)); //dbSpeak("nMax = " + IntToString(nMax)); //dbSpeak("GetRange.nHD = " + IntToString(nHD)); if (nHD >= nMin && nHD <= nMax) { return TRUE; } return FALSE; } //:://///////////////////////////////////////////// //:: GetNumberOfItems //:: Copyright (c) 2002 Bioware Corp. //::////////////////////////////////////////////// /* Returns the number of items to create. */ //::////////////////////////////////////////////// //:: Created By: Brent //:: Created On: //::////////////////////////////////////////////// int GetNumberOfItems(int nTreasureType) { int nItems = 0; int nRandom = 0; int nProbThreeItems = 0; int nProbTwoItems = 0; int nProbOneItems = 0; if (nTreasureType == TREASURE_LOW) { nProbThreeItems = NUMBER_LOW_THREE; nProbTwoItems = NUMBER_LOW_TWO; nProbOneItems = NUMBER_LOW_ONE; } else if (nTreasureType == TREASURE_MEDIUM) { nProbThreeItems = NUMBER_MED_THREE; nProbTwoItems = NUMBER_MED_TWO; nProbOneItems = NUMBER_MED_ONE; } else if (nTreasureType == TREASURE_HIGH) { nProbThreeItems = NUMBER_HIGH_THREE; nProbTwoItems = NUMBER_HIGH_TWO; nProbOneItems = NUMBER_HIGH_ONE; } else if (nTreasureType == TREASURE_BOSS) { nProbThreeItems = NUMBER_BOSS_THREE; nProbTwoItems = NUMBER_BOSS_TWO; nProbOneItems = NUMBER_BOSS_ONE; } else if (nTreasureType == TREASURE_BOOK) { nProbThreeItems = NUMBER_BOOK_THREE; nProbTwoItems = NUMBER_BOOK_TWO; nProbOneItems = NUMBER_BOOK_ONE; } nRandom = d100(); if (nRandom <= nProbThreeItems) { nItems = 3; } else if (nRandom <= nProbTwoItems + nProbThreeItems) { nItems = 2; } else { nItems = 1; } // * May 13 2002: Cap number of items, in case of logic error if (nItems > 3) { nItems = 3; } return nItems; } // * // * TREASURE GENERATION FUNCTIONS // * // * // * Non-Scaling Treasure // * void CreateBook(object oTarget) { int iBookRoll = Random(10) + 1; if (iBookRoll <= 7) { CreateRecipeBook(oTarget); } else { CreateNWN1Book(oTarget); } } void CreateNWN1Book(object oTarget) { //int nBook1 = Random(31) + 1; // totally awesome magic numbers, guys!; int nBook1 = Random( NWN2_MAX_NUM_ITEMS_BOOKS ) + 1; string sRes = "NW_IT_BOOK0"; if (nBook1 < 10) { sRes = sRes + "0" + IntToString(nBook1); } else { sRes = sRes + IntToString(nBook1); } //dbSpeak("Create book"); dbCreateItemOnObject(sRes, oTarget); } void CreateRecipeBook(object oTarget) { int iBook = Random(27) + 1; // highest book is 29, but 22 and 26 are skipped if (iBook>=22) iBook++; if (iBook>=26) iBook++; string sRes = "n2_crft_book_recipe0"; if (iBook < 10) { sRes += "0"; } sRes += IntToString(iBook); //dbSpeak("Create book"); dbCreateItemOnObject(sRes, oTarget); } void CreateAnimalPart(object oTarget) { string sRes = ""; int nResult = Random(1) + 1; switch (nResult) { // case 1: sRes = "NW_IT_MSMLMISC20"; break; // case 2: sRes = "NW_IT_MMIDMISC05"; break; case 1: sRes = "NW_IT_MMIDMISC06"; break; } //dbSpeak("animal"); dbCreateItemOnObject(sRes, oTarget); } void CreateJunk(object oTarget) { string sRes = "NW_IT_TORCH001"; int NUM_ITEMS = 6; int nResult = Random(NUM_ITEMS) + 1; int nKit = 0; switch (nResult) { case 1: sRes = "NW_IT_MPOTION021"; break; //ale case 2: sRes = "NW_IT_MPOTION021"; break; // ale case 3: sRes = "NW_IT_MPOTION023"; break; // wine case 4: sRes = "NW_IT_MPOTION021"; break; // ale case 5: sRes = "NW_IT_MPOTION022"; break; // spirits case 6: sRes = "NW_IT_TORCH001"; break; //torch } //dbSpeak("CreateJunk"); dbCreateItemOnObject(sRes, oTarget); } // * // * Scaling Treasure // * void CreateGold(object oTarget, object oAdventurer, int nTreasureType, int nModifier = 0) { int nHD = GetHitDice(oAdventurer) + nModifier; int nAmount = 0; if (GetRange(1, nHD)) { nAmount = d12(2); } else if (GetRange(2, nHD)) { nAmount = d20(2); } else if (GetRange(3, nHD)) { nAmount = d20(3); } else if (GetRange(4, nHD)) { nAmount = d20(5); } else if (GetRange(5, nHD)) { nAmount = d20(8); } else if (GetRange(6, nHD)) { nAmount = d20(10); } float nMod = 0.0; if (nTreasureType == TREASURE_LOW) nMod = LOW_MOD_GOLD; else if (nTreasureType == TREASURE_MEDIUM) nMod = MEDIUM_MOD_GOLD; else if (nTreasureType == TREASURE_HIGH) nMod = HIGH_MOD_GOLD; // * always at least 1gp is created nAmount = FloatToInt(nAmount * nMod); if (nAmount <= 0) { nAmount = 1; } //dbSpeak("gold"); dbCreateItemOnObject("NW_IT_GOLD001", oTarget, nAmount); } void CreateGem(object oTarget, object oAdventurer, int nTreasureType, int nModifier = 0) { int nHD = GetHitDice(oAdventurer) + nModifier; string sGem = "nw_it_gem001"; if (GetRange(1, nHD)) { int nRandom = Random(9) + 1; switch (nRandom) { case 1: sGem = "nw_it_gem001"; break; case 2: sGem = "nw_it_gem007"; break; case 3: sGem = "nw_it_gem002"; break; case 4: case 5: sGem = "nw_it_gem004"; break; case 6: case 7: sGem = "nw_it_gem014"; break; case 8: sGem = "nw_it_gem003"; break; case 9: sGem = "nw_it_gem015"; break; } } else if (GetRange(2, nHD)) // 30 GP Avg; 150 gp Max { int nRandom = d12(); switch (nRandom) { case 1: sGem = "nw_it_gem001"; break; case 2: sGem = "nw_it_gem007"; break; case 3: sGem = "nw_it_gem002"; break; case 4: sGem = "nw_it_gem004"; break; case 5: case 6: sGem = "nw_it_gem014"; break; case 7: case 8: sGem = "nw_it_gem003"; break; case 9: case 10: sGem = "nw_it_gem015"; break; case 11: sGem = "nw_it_gem011"; break; case 12: sGem = "nw_it_gem013"; break; } } else if (GetRange(3, nHD)) // 75GP Avg; 500 gp max { int nRandom = d2(); switch (nRandom) { case 1: sGem = "nw_it_gem013"; break; case 2: sGem = "nw_it_gem010"; break; } } else if (GetRange(4, nHD)) // 150 gp avg; 1000 gp max { int nRandom = d3(); switch (nRandom) { case 1: sGem = "nw_it_gem013"; break; case 2: sGem = "nw_it_gem010"; break; case 3: sGem = "nw_it_gem008"; break; } } else if (GetRange(5, nHD)) // 300 gp avg; any { int nRandom = d6(); switch (nRandom) { case 1: sGem = "nw_it_gem013"; break; case 2: sGem = "nw_it_gem010"; break; case 3: case 4: sGem = "nw_it_gem008"; break; case 5: sGem = "nw_it_gem009"; break; case 6: sGem = "nw_it_gem009"; break; } } else if (GetRange(6, nHD))// * Anything higher than level 15 500 gp avg; any { int nRandom = Random(8) + 1; switch (nRandom) { case 1: sGem = "nw_it_gem013"; break; case 2: sGem = "nw_it_gem010"; break; case 3: case 4: sGem = "nw_it_gem008"; break; case 5: sGem = "nw_it_gem009"; break; case 6: sGem = "nw_it_gem009"; break; case 7: sGem = "nw_it_gem006"; break; case 8: sGem = "nw_it_gem012"; break; } } //dbSpeak("Create Gem"); dbCreateItemOnObject(sGem, oTarget, 1); } void CreateJewel(object oTarget, object oAdventurer, int nTreasureType, int nModifier = 0) { int nHD = GetHitDice(oAdventurer) + nModifier; string sJewel = ""; if (GetRange(1, nHD)) // 15 gp avg; 75 gp max { int nRandom = d2(); switch (nRandom) { case 1: sJewel = "nw_it_mring021"; break; case 2: sJewel = "nw_it_mneck020"; break; } } else if (GetRange(2, nHD)) // 30 GP Avg; 150 gp Max { int nRandom = d6(); switch (nRandom) { case 1: sJewel = "nw_it_mring021"; break; case 2: case 3: sJewel = "nw_it_mneck020"; break; case 4: sJewel = "nw_it_mring022"; break; case 5: case 6: sJewel = "nw_it_mneck023"; break; } } else if (GetRange(3, nHD)) // 75GP Avg; 500 gp max { int nRandom = d6(); switch (nRandom) { case 1: sJewel = "nw_it_mring021"; break; case 2: case 3: sJewel = "nw_it_mneck020"; break; case 4: case 5: sJewel = "nw_it_mring022"; break; case 6: sJewel = "nw_it_mneck021"; break; } } else if (GetRange(4, nHD)) // 150 gp avg; 1000 gp max { int nRandom = d6(); switch (nRandom) { case 1: sJewel = "nw_it_mring021"; break; case 2: sJewel = "nw_it_mring022"; break; case 3: case 4: case 5: sJewel = "nw_it_mneck021"; break; case 6: sJewel = "nw_it_mring023"; break; } } else if (GetRange(5, nHD)) // 300 gp avg; any { int nRandom = d8(); switch (nRandom) { case 1: sJewel = "nw_it_mring022"; break; case 2: case 3: sJewel = "nw_it_mneck021"; break; case 4: case 5: case 6: sJewel = "nw_it_mring023"; break; case 7: case 8: sJewel = "nw_it_mneck022"; break; } } else if (GetRange(6, nHD)) { int nRandom = d6(); switch (nRandom) { case 1: sJewel = "nw_it_mring022"; break; case 2: sJewel = "nw_it_mneck021"; break; case 3: case 4: sJewel = "nw_it_mring023"; break; case 5: case 6: sJewel = "nw_it_mneck022"; break; } } //dbSpeak("Create Jewel"); dbCreateItemOnObject(sJewel, oTarget, 1); } // * returns the valid upper limit for any arcane spell scroll /* int TrimLevel(int nScroll, int nLevel) { int nMax = 5; switch (nLevel) { case 0: nMax = 4; break; case 1: nMax = 13; break; case 2: nMax = 21; break; case 3: nMax = 15; break; case 4: nMax = 17; break; case 5: nMax = 13; break; case 6: nMax = 14; break; case 7: nMax = 8; break; case 8: nMax = 9; break; case 9: nMax = 12; break; } if (nScroll > nMax) nScroll = nMax; return nScroll; } */ // returns the valid upper limit for an original NWN1 arcane spell scroll int GetNW_ArcaneScrollMax(int nLevel) { int nMax = 0; switch (nLevel) { case 0: nMax = 4; break; case 1: nMax = 12; break; case 2: nMax = 19; break; case 3: nMax = 14; break; case 4: nMax = 17; break; case 5: nMax = 13; break; case 6: nMax = 13; break; case 7: nMax = 8; break; case 8: nMax = 8; break; case 9: nMax = 11; break; } return nMax; } // certain numbers have been removed int GetNW_ArcaneScrollSkip(int nLevel, int nCount) { //int nSkip = 0; switch (nLevel) { case 2: if (nCount >= 15) nCount++; if (nCount >= 17) nCount++; break; case 4: if (nCount >= 1) nCount++; break; case 6: if (nCount >= 11) nCount++; break; case 8: if (nCount >= 6) nCount++; break; case 9: if (nCount >= 11) nCount++; break; } return nCount; } int GetNW_ArcaneScrollRandom(int nLevel) { // get max speel for this spell level int nNumSpellsInLevel = GetNW_ArcaneScrollMax(nLevel); // pick a random one int nScrollNum = Random(nNumSpellsInLevel) + 1; // Skip the scrolls that have been deleted nScrollNum = GetNW_ArcaneScrollSkip(nLevel, nScrollNum); return nScrollNum; } // * nModifier is to 'raise' the level of the oAdventurer void CreateArcaneScroll(object oTarget, object oAdventurer, int nModifier = 0) { //int nMaxSpells = 21; int nHD = GetHitDice(oAdventurer) + nModifier; int nScroll = 1; int nLevel = 1; if (GetRange(1, nHD)) // l 1-2 { nLevel = d2(); //nScroll = Random(nMaxSpells) + 1; } else if (GetRange(2, nHD)) // l 1-4 { nLevel = d4(); //nScroll = Random(nMaxSpells) + 1; } else if (GetRange(3, nHD)) // l 2-6 { nLevel = d6(); if (nLevel < 2) nLevel = 2; //nScroll = Random(nMaxSpells) + 1; } else if (GetRange(4, nHD)) // l 3-8 { nLevel = d8(); if (nLevel < 3) nLevel = 3; //nScroll = Random(nMaxSpells) + 1; } else if (GetRange(5, nHD)) // l 4-9 { nLevel = d8() + 1; if (nLevel < 4) nLevel = 4; //nScroll = Random(nMaxSpells) + 1; } else if (GetRange(6, nHD)) // 5 -9 { nLevel = d8() + 1; if (nLevel < 5) nLevel = 5; //nScroll = Random(nMaxSpells) + 1; } nScroll = GetNW_ArcaneScrollRandom(nLevel); // * Trims the level of the scroll to match the max # of scrolls in each level range //nScroll = TrimLevel(nScroll, nLevel); string sRes; // = "nw_it_sparscr216"; if (nScroll < 10) { sRes = "NW_IT_SPARSCR" + IntToString(nLevel) + "0" + IntToString(nScroll); } else { sRes = "NW_IT_SPARSCR" + IntToString(nLevel) + IntToString(nScroll); } dbCreateItemOnObject(sRes, oTarget, 1); } void CreateDivineScroll(object oTarget, object oAdventurer, int nModifier=0) { int nHD = GetHitDice(oAdventurer) + nModifier; string sScroll = ""; if (GetRange(1, nHD)) { int nRandom = Random(3) + 1; //d4(); switch (nRandom) { case 1: sScroll = "nw_it_spdvscr201"; break; //case 2: sScroll = "nw_it_spdvscr202"; break; case 3: sScroll = "nw_it_spdvscr203"; break; case 2: sScroll = "nw_it_spdvscr204"; break; } } else if (GetRange(2, nHD)) { int nRandom = Random(7) + 1; //d8(); switch (nRandom) { // 7/6/06 BDF - OEI: // Case 2 used to be "nw_it_spdvscr202", but that item doesn't exist in NWN2. // Decided to shift all the data up one position and kept case 8 as is so that // there are no cases that don't return a valid value. // This just means that "nw_it_spdvscr402" has a higher drop percentage, // but really, life goes on. :) case 1: sScroll = "nw_it_spdvscr201"; break; //case 2: sScroll = "nw_it_spdvscr202"; break; case 2: sScroll = "nw_it_spdvscr203"; break; case 3: sScroll = "nw_it_spdvscr204"; break; case 4: sScroll = "nw_it_spdvscr301"; break; case 5: sScroll = "nw_it_spdvscr302"; break; case 6: sScroll = "nw_it_spdvscr401"; break; case 7: sScroll = "nw_it_spdvscr402"; break; } } else if (GetRange(3, nHD)) { int nRandom = Random(8) + 1; switch (nRandom) { case 1: sScroll = "nw_it_spdvscr201"; break; //case 2: sScroll = "nw_it_spdvscr202"; break; case 3: sScroll = "nw_it_spdvscr203"; break; case 4: sScroll = "nw_it_spdvscr204"; break; case 5: sScroll = "nw_it_spdvscr301"; break; case 6: sScroll = "nw_it_spdvscr302"; break; case 7: sScroll = "nw_it_spdvscr401"; break; case 8: sScroll = "nw_it_spdvscr402"; break; case 2: sScroll = "nw_it_spdvscr501"; break; } } else { int nRandom = Random(7) + 1; switch (nRandom) { case 1: sScroll = "nw_it_spdvscr301"; break; case 2: sScroll = "nw_it_spdvscr302"; break; case 3: sScroll = "nw_it_spdvscr401"; break; case 4: sScroll = "nw_it_spdvscr402"; break; case 5: sScroll = "nw_it_spdvscr501"; break; case 6: sScroll = "nw_it_spdvscr701"; break; case 7: sScroll = "nw_it_spdvscr702"; break; } } //dbSpeak("Divine Scroll"); dbCreateItemOnObject(sScroll, oTarget, 1); } void CreateAmmo(object oTarget, object oAdventurer, int nModifier=0) { int nHD = GetHitDice(oAdventurer) + nModifier; string sAmmo = ""; if (GetRange(1, nHD)) // * 200 gp max { int nRandom = d3(); switch (nRandom) { case 1: sAmmo = "nw_wamar001"; break; case 2: sAmmo = "nw_wambo001"; break; case 3: sAmmo = "nw_wambu001"; break; } } else if (GetRange(2, nHD)) // * 800 gp max { int nRandom = d6(); switch (nRandom) { case 1: sAmmo = "nw_wamar001"; break; case 2: sAmmo = "nw_wambo001"; break; case 3: sAmmo = "nw_wambu001"; break; case 4: sAmmo = "nw_wammar001"; break; case 5: sAmmo = "nw_wammbo001"; break; case 6: sAmmo = "nw_wammbo002"; break; } } else if (GetRange(3, nHD)) // * - 2500 gp { int nRandom = d20(); switch (nRandom) { case 1: sAmmo = "nw_wamar001"; break; case 2: sAmmo = "nw_wambo001"; break; case 3: sAmmo = "nw_wambu001"; break; case 4: sAmmo = "nw_wammar001"; break; case 5: sAmmo = "nw_wammbo001"; break; case 6: sAmmo = "nw_wammbo002"; break; case 7: sAmmo = "nw_wammbo003"; break; case 8: sAmmo = "nw_wammbu002"; break; case 9: sAmmo = "nw_wammar002"; break; case 10: sAmmo = "nw_wammar001"; break; case 11: sAmmo = "nw_wammar003"; break; case 12: sAmmo = "nw_wammar004"; break; case 13: sAmmo = "nw_wammar005"; break; case 14: sAmmo = "nw_wammar006"; break; case 15: sAmmo = "nw_wammbo004"; break; case 16: sAmmo = "nw_wammbo005"; break; case 17: sAmmo = "nw_wammbu004"; break; case 18: sAmmo = "nw_wammbu005"; break; case 19: sAmmo = "nw_wammbu006"; break; case 20: sAmmo = "nw_wammbu007"; break; } } else { int nRandom = d20(); switch (nRandom) { case 1: sAmmo = "nw_wamar001"; break; case 2: sAmmo = "nw_wammbu001"; break; case 3: sAmmo = "nw_wammbu003"; break; case 4: sAmmo = "nw_wammar001"; break; case 5: sAmmo = "nw_wammbo001"; break; case 6: sAmmo = "nw_wammbo002"; break; case 7: sAmmo = "nw_wammbo003"; break; case 8: sAmmo = "nw_wammbu002"; break; case 9: sAmmo = "nw_wammar002"; break; case 10: sAmmo = "nw_wammar001"; break; case 11: sAmmo = "nw_wammar003"; break; case 12: sAmmo = "nw_wammar004"; break; case 13: sAmmo = "nw_wammar005"; break; case 14: sAmmo = "nw_wammar006"; break; case 15: sAmmo = "nw_wammbo004"; break; case 16: sAmmo = "nw_wammbo005"; break; case 17: sAmmo = "nw_wammbu004"; break; case 18: sAmmo = "nw_wammbu005"; break; case 19: sAmmo = "nw_wammbu006"; break; case 20: sAmmo = "nw_wammbu007"; break; } } //dbSpeak("ammo"); dbCreateItemOnObject(sAmmo, oTarget, Random(30) + 1); // create up to 30 of the specified ammo type } void CreateTrapKit(object oTarget, object oAdventurer, int nModifier = 0) { int nHD = GetHitDice(oAdventurer) + nModifier; string sKit = ""; if (GetRange(1, nHD)) // 200 { int nRandom = d3(); switch (nRandom) { case 1: sKit = "nw_it_trap001"; break; case 2: sKit = "nw_it_trap029"; break; case 3: sKit = "nw_it_trap033"; break; } } else if (GetRange(2, nHD)) // 800 { int nRandom = d12(); switch (nRandom) { case 1: sKit = "nw_it_trap001"; break; case 2: sKit = "nw_it_trap029"; break; case 3: sKit = "nw_it_trap033"; break; case 4: sKit = "nw_it_trap002"; break; case 5: sKit = "nw_it_trap030"; break; case 6: sKit = "nw_it_trap037"; break; case 7: sKit = "nw_it_trap034"; break; case 8: sKit = "nw_it_trap005"; break; case 9: sKit = "nw_it_trap038"; break; case 10: sKit = "nw_it_trap041"; break; case 11: sKit = "nw_it_trap003"; break; case 12: sKit = "nw_it_trap031"; break; } } else if (GetRange(3, nHD)) // 200 - 2500 { int nRandom = Random(17) + 1; switch (nRandom) { case 1: sKit = "nw_it_trap002"; break; case 2: sKit = "nw_it_trap030"; break; case 3: sKit = "nw_it_trap037"; break; case 4: sKit = "nw_it_trap034"; break; case 5: sKit = "nw_it_trap005"; break; case 6: sKit = "nw_it_trap038"; break; case 7: sKit = "nw_it_trap041"; break; case 8: sKit = "nw_it_trap003"; break; case 9: sKit = "nw_it_trap031"; break; case 10: sKit = "nw_it_trap035"; break; case 11: sKit = "nw_it_trap006"; break; case 12: sKit = "nw_it_trap042"; break; case 13: sKit = "nw_it_trap004"; break; case 14: sKit = "nw_it_trap032"; break; case 15: sKit = "nw_it_trap039"; break; case 16: sKit = "nw_it_trap009"; break; case 17: sKit = "nw_it_trap036"; break; } } else if (GetRange(4, nHD)) // 800 - 10000 { int nRandom = Random(19) + 1; switch (nRandom) { case 1: sKit = "nw_it_trap035"; break; case 2: sKit = "nw_it_trap006"; break; case 3: sKit = "nw_it_trap042"; break; case 4: sKit = "nw_it_trap004"; break; case 5: sKit = "nw_it_trap032"; break; case 6: sKit = "nw_it_trap039"; break; case 7: sKit = "nw_it_trap009"; break; case 8: sKit = "nw_it_trap036"; break; case 9: sKit = "nw_it_trap013"; break; case 10: sKit = "nw_it_trap040"; break; case 11: sKit = "nw_it_trap007"; break; case 12: sKit = "nw_it_trap043"; break; case 13: sKit = "nw_it_trap010"; break; case 14: sKit = "nw_it_trap017"; break; case 15: sKit = "nw_it_trap021"; break; case 16: sKit = "nw_it_trap014"; break; case 17: sKit = "nw_it_trap025"; break; case 18: sKit = "nw_it_trap008"; break; case 19: sKit = "nw_it_trap044"; break; } } else if (GetRange(5, nHD)) // 2000 -16500 { int nRandom = Random(18) + 1; switch (nRandom) { case 1: sKit = "nw_it_trap039"; break; case 2: sKit = "nw_it_trap009"; break; case 3: sKit = "nw_it_trap036"; break; case 4: sKit = "nw_it_trap013"; break; case 5: sKit = "nw_it_trap040"; break; case 6: sKit = "nw_it_trap007"; break; case 7: sKit = "nw_it_trap043"; break; case 8: sKit = "nw_it_trap010"; break; case 9: sKit = "nw_it_trap017"; break; case 10: sKit = "nw_it_trap021"; break; case 11: sKit = "nw_it_trap014"; break; case 12: sKit = "nw_it_trap025"; break; case 13: sKit = "nw_it_trap008"; break; case 14: sKit = "nw_it_trap044"; break; case 15: sKit = "nw_it_trap018"; break; case 16: sKit = "nw_it_trap011"; break; case 17: sKit = "nw_it_trap022"; break; case 18: sKit = "nw_it_trap026"; break; } } else if (GetRange(6, nHD)) // 2000 - ? { int nRandom = Random(27) + 1; switch (nRandom) { case 1: sKit = "nw_it_trap039"; break; case 2: sKit = "nw_it_trap009"; break; case 3: sKit = "nw_it_trap036"; break; case 4: sKit = "nw_it_trap013"; break; case 5: sKit = "nw_it_trap040"; break; case 6: sKit = "nw_it_trap007"; break; case 7: sKit = "nw_it_trap043"; break; case 8: sKit = "nw_it_trap010"; break; case 9: sKit = "nw_it_trap017"; break; case 10: sKit = "nw_it_trap021"; break; case 11: sKit = "nw_it_trap014"; break; case 12: sKit = "nw_it_trap025"; break; case 13: sKit = "nw_it_trap008"; break; case 14: sKit = "nw_it_trap044"; break; case 15: sKit = "nw_it_trap018"; break; case 16: sKit = "nw_it_trap011"; break; case 17: sKit = "nw_it_trap022"; break; case 18: sKit = "nw_it_trap026"; break; case 19: sKit = "nw_it_trap015"; break; case 20: sKit = "nw_it_trap012"; break; case 21: sKit = "nw_it_trap019"; break; case 22: sKit = "nw_it_trap023"; break; case 23: sKit = "nw_it_trap016"; break; case 24: sKit = "nw_it_trap027"; break; case 25: sKit = "nw_it_trap020"; break; case 26: sKit = "nw_it_trap024"; break; case 27: sKit = "nw_it_trap028"; break; } } //dbSpeak("Create Trapkit"); dbCreateItemOnObject(sKit, oTarget, 1); } void CreateHealingKit(object oTarget, object oAdventurer, int nModifier = 0) { int nHD = GetHitDice(oAdventurer) + nModifier; string sKit = ""; if (GetRange(1, nHD)) // 200 { int nRandom = Random(1) + 1; switch (nRandom) { case 1: sKit = "nw_it_medkit001"; break; } } else if (GetRange(2, nHD)) // 800 { int nRandom = Random(2) + 1; switch (nRandom) { case 1: sKit = "nw_it_medkit001"; break; case 2: sKit = "nw_it_medkit002"; break; } } else if (GetRange(3, nHD)) // 200 - 2500 { int nRandom = Random(2) + 1; switch (nRandom) { case 1: sKit = "nw_it_medkit002"; break; case 2: sKit = "nw_it_medkit003"; break; } } else if (GetRange(4, nHD)) // 800 - 10000 { int nRandom = Random(2) + 1; switch (nRandom) { case 1: sKit = "nw_it_medkit003";break; case 2: sKit = "nw_it_medkit004"; break; } } else if (GetRange(5, nHD)) // 2000 -16500 { int nRandom = Random(2) + 1; switch (nRandom) { case 1: sKit = "nw_it_medkit003"; break; case 2: sKit = "nw_it_medkit004";break; } } else if (GetRange(6, nHD)) // 2000 - ? { int nRandom = Random(2) + 1; switch (nRandom) { case 1: sKit = "nw_it_medkit003"; break; case 2: sKit = "nw_it_medkit004";break; } } //dbSpeak("Create Healing Kit"); dbCreateItemOnObject(sKit, oTarget, 1); } void CreateLockPick(object oTarget, object oAdventurer, int nModifier = 0) { int nHD = GetHitDice(oAdventurer) + nModifier; string sKit = ""; if (GetRange(1, nHD)) // 200 { int nRandom = d8(); switch (nRandom) { case 1: sKit = "nw_it_picks001"; break; case 2: sKit = "nw_it_picks002"; break; case 3: sKit = "nw_it_picks001"; break; case 4: sKit = "nw_it_picks001"; break; case 5: sKit = "nw_it_picks001"; break; case 6: sKit = "nw_it_picks001"; break; case 7: sKit = "nw_it_picks001"; break; case 8: sKit = "nw_it_picks001"; break; } } else if (GetRange(2, nHD)) // 800 { int nRandom = d6(); switch (nRandom) { case 1: sKit = "nw_it_picks001"; break; case 2: sKit = "nw_it_picks002"; break; case 3: sKit = "nw_it_picks003"; break; case 4: sKit = "nw_it_picks002"; break; case 5: sKit = "nw_it_picks002"; break; case 6: sKit = "nw_it_picks002"; break; } } else if (GetRange(3, nHD)) // 200 - 2500 { int nRandom = Random(2) + 1; switch (nRandom) { case 1: sKit = "nw_it_picks003"; break; case 2: sKit = "nw_it_picks004"; break; } } else if (GetRange(4, nHD)) // 800 - 10000 { int nRandom = Random(1) + 1; switch (nRandom) { case 1: sKit = "nw_it_picks004"; break; } } else if (GetRange(5, nHD)) // 2000 -16500 { int nRandom = Random(1) + 1; switch (nRandom) { case 1: sKit = "nw_it_picks004"; break; } } else if (GetRange(6, nHD)) // 2000 - ? { int nRandom = Random(1) + 1; switch (nRandom) { case 1: sKit = "nw_it_picks004"; break; } } //dbSpeak("Create Lockpick"); dbCreateItemOnObject(sKit, oTarget, 1); } void CreateKit(object oTarget, object oAdventurer, int nModifier = 0) { // * April 23 2002: Major restructuring of this function // * to allow me to switch (Random(8) + 1) { case 1: CreateTrapKit(oTarget, oAdventurer, nModifier); break; case 2: case 3: case 4: case 5: CreateHealingKit(oTarget, oAdventurer, nModifier); break; case 6: case 7: case 8: CreateLockPick(oTarget, oAdventurer, nModifier); break; } } void CreatePotion(object oTarget, object oAdventurer, int nModifier = 0) { string sPotion = ""; int nHD = GetHitDice(oAdventurer) + nModifier; if (GetRange(1, nHD)) { int nRandom = d10(); switch (nRandom) { case 1: case 2: case 3: case 4: sPotion = "nw_it_mpotion001"; break; case 5: case 6: case 7: sPotion = "nw_it_mpotion020"; break; case 8: sPotion = "nw_it_mpotion002"; break; case 9: sPotion = "nw_it_mpotion009"; break; case 10: sPotion = "nw_it_mpotion005"; break; } } else if (GetRange(2, nHD)) { int nRandom = Random(28) + 1; switch (nRandom) { case 1: case 2: case 3: sPotion = "nw_it_mpotion001"; break; case 4: case 5: case 6: case 7: case 8: sPotion = "nw_it_mpotion020"; break; case 9: case 10: case 11: case 12: sPotion = "nw_it_mpotion002"; break; case 13: case 14: sPotion = "nw_it_mpotion003"; break; case 15: sPotion = "nw_it_mpotion009"; break; case 16: sPotion = "nw_it_mpotion005"; break; //case 17: sPotion = "nw_it_mpotion007"; break; case 18: sPotion = "nw_it_mpotion008"; break; case 19: sPotion = "nw_it_mpotion010"; break; case 20: sPotion = "nw_it_mpotion011"; break; case 21: sPotion = "nw_it_mpotion013"; break; case 22: sPotion = "nw_it_mpotion014"; break; case 23: sPotion = "nw_it_mpotion015"; break; case 24: sPotion = "nw_it_mpotion016"; break; case 25: sPotion = "nw_it_mpotion017"; break; case 26: sPotion = "nw_it_mpotion018"; break; case 27: sPotion = "nw_it_mpotion019"; break; case 28: sPotion = "nw_it_mpotion004"; break; case 17: sPotion = "nw_it_mpotion006"; break; } } else if (GetRange(3, nHD)) { int nRandom = Random(28) + 1; switch (nRandom) { case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: sPotion = "nw_it_mpotion003"; break; case 15: sPotion = "nw_it_mpotion009"; break; case 16: sPotion = "nw_it_mpotion005"; break; //case 17: sPotion = "nw_it_mpotion007"; break; case 18: sPotion = "nw_it_mpotion008"; break; case 19: sPotion = "nw_it_mpotion010"; break; case 20: sPotion = "nw_it_mpotion011"; break; case 21: sPotion = "nw_it_mpotion013"; break; case 22: sPotion = "nw_it_mpotion014"; break; case 23: sPotion = "nw_it_mpotion015"; break; case 24: sPotion = "nw_it_mpotion016"; break; case 25: sPotion = "nw_it_mpotion017"; break; case 26: sPotion = "nw_it_mpotion018"; break; case 27: sPotion = "nw_it_mpotion019"; break; case 28: sPotion = "nw_it_mpotion004"; break; case 17: sPotion = "nw_it_mpotion006"; break; } } else if (GetRange(4, nHD)) { int nRandom = Random(28) + 1; switch (nRandom) { case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: sPotion = "nw_it_mpotion003"; break; case 13: case 14: sPotion = "nw_it_mpotion003"; break; case 15: sPotion = "nw_it_mpotion009"; break; case 16: sPotion = "nw_it_mpotion005"; break; //case 17: sPotion = "nw_it_mpotion007"; break; case 18: sPotion = "nw_it_mpotion008"; break; case 19: sPotion = "nw_it_mpotion010"; break; case 20: sPotion = "nw_it_mpotion011"; break; case 21: sPotion = "nw_it_mpotion013"; break; case 22: sPotion = "nw_it_mpotion014"; break; case 23: sPotion = "nw_it_mpotion015"; break; case 24: sPotion = "nw_it_mpotion016"; break; case 25: sPotion = "nw_it_mpotion017"; break; case 26: sPotion = "nw_it_mpotion018"; break; case 27: sPotion = "nw_it_mpotion019"; break; case 28: sPotion = "nw_it_mpotion004"; break; case 17: sPotion = "nw_it_mpotion006"; break; } } else // keep 5 and 6 the same { int nRandom = Random(28) + 1; switch (nRandom) { case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: sPotion = "nw_it_mpotion003" ; case 10: case 11: case 12: case 13: case 14: sPotion = "nw_it_mpotion003"; break; case 15: sPotion = "nw_it_mpotion009"; break; case 16: sPotion = "nw_it_mpotion005"; break; //case 17: sPotion = "nw_it_mpotion007"; break; case 18: sPotion = "nw_it_mpotion008"; break; case 19: sPotion = "nw_it_mpotion010"; break; case 20: sPotion = "nw_it_mpotion011"; break; case 21: sPotion = "nw_it_mpotion013"; break; case 22: sPotion = "nw_it_mpotion014"; break; case 23: sPotion = "nw_it_mpotion015"; break; case 24: sPotion = "nw_it_mpotion016"; break; case 25: sPotion = "nw_it_mpotion017"; break; case 26: sPotion = "nw_it_mpotion018"; break; case 27: sPotion = "nw_it_mpotion019"; break; case 28: sPotion = "nw_it_mpotion004"; break; case 17: sPotion = "nw_it_mpotion006"; break; } } //dbSpeak("Create Potion"); dbCreateItemOnObject(sPotion, oTarget, 1); } |
Code: |
//::///////////////////////////////////////////////
//:: CreateTable2GenericItem //:: Copyright (c) 2002 Bioware Corp. //::////////////////////////////////////////////// /* Creates an item based upon the class of oAdventurer */ //::////////////////////////////////////////////// //:: Created By: Brent //:: Created On: //::////////////////////////////////////////////// void CreateGenericMiscItem(object oTarget, object oAdventurer, int nModifier=0) { int nHD = GetHitDice(oAdventurer) + nModifier; string sItem = ""; if (GetRange(1, nHD)) // * 200 { int nRandom = Random(6) + 1; switch (nRandom) { case 1: sItem = "nw_it_mglove004"; break; case 2: sItem = "nw_it_mglove004"; break; case 3: sItem = "nw_it_mglove005"; break; //case 4: sItem = "nw_it_mglove006"; break; case 5: sItem = "nw_it_mglove007"; break; //case 6: sItem = "nw_it_mglove008"; break; case 6: sItem = "nw_it_mglove009"; break; case 4: sItem = "nw_mcloth006"; break; //case 4: sItem = "nw_it_mglove012"; break; } } else if (GetRange(2, nHD)) // * 800 { int nRandom = Random(24) + 1; switch (nRandom) { case 1: sItem = "nw_mcloth006"; break; case 2: sItem = "nw_it_mring009"; break; case 3: sItem = "nw_it_mring009"; break; case 4: sItem = "nw_it_mring010"; break; case 5: sItem = "nw_it_mring011"; break; case 6: sItem = "nw_it_mboots010"; break; case 7: sItem = "nw_it_mneck024"; break; case 8: sItem = "nw_mcloth007"; break; case 9: sItem = "nw_it_mring024"; break; case 10: sItem = "nw_it_mring012"; break; case 11: sItem = "nw_mcloth008"; break; case 12: sItem = "nw_it_mglove010"; break; case 13: sItem = "nw_it_mglove011"; break; case 14: sItem = "nw_it_mglove013"; break; //case 15: sItem = "nw_it_mglove014"; break; case 16: sItem = "nw_it_mglove015"; break; case 17: sItem = "nw_maarcl097"; break; case 18: sItem = "nw_maarcl097"; break; case 19: sItem = "nw_maarcl099"; break; case 20: sItem = "nw_it_mneck032"; break; case 21: sItem = "nw_mcloth010"; break; case 22: sItem = "nw_it_mbracer002"; break; case 23: sItem = "nw_it_mneck001"; break; case 24: sItem = "nw_maarcl055"; break; case 15: sItem = "nw_mcloth009"; break; } } else if (GetRange(3, nHD)) // * 200 - 2500 { int nRandom = Random(43) + 1; switch (nRandom) { case 1: sItem = "nw_it_mring009"; break; case 2: sItem = "nw_it_mring009"; break; case 3: sItem = "nw_it_mring010"; break; case 4: sItem = "nw_it_mring011"; break; case 5: sItem = "nw_it_mboots010"; break; case 6: sItem = "nw_it_mneck024"; break; case 7: sItem = "nw_mcloth007"; break; case 8: sItem = "nw_it_mring024"; break; case 9: sItem = "nw_it_mring012"; break; case 10: sItem = "nw_mcloth008"; break; case 11: sItem = "nw_it_mglove010"; break; case 12: sItem = "nw_it_mglove011"; break; case 13: sItem = "nw_it_mglove013"; break; //case 14: sItem = "nw_it_mglove014"; break; case 15: sItem = "nw_it_mglove015"; break; case 16: sItem = "nw_it_contain003"; break; case 17: sItem = "nw_maarcl097"; break; case 18: sItem = "nw_maarcl099"; break; case 19: sItem = "nw_it_mneck032"; break; case 20: sItem = "nw_mcloth010"; break; case 21: sItem = "nw_it_mbracer002"; break; case 22: sItem = "nw_it_mneck001"; break; case 23: sItem = "nw_maarcl055"; break; case 24: sItem = "nw_mcloth009"; break; case 25: sItem = "nw_it_mring001"; break; case 26: sItem = "nw_it_mboots001"; break; case 27: sItem = "nw_it_mbracer001"; break; case 28: sItem = "nw_it_mneck007"; break; case 29: sItem = "nw_maarcl096"; break; case 30: sItem = "nw_it_mglove003"; break; case 31: sItem = "nw_it_contain004"; break; case 32: sItem = "nw_it_mneck031"; break; case 33: sItem = "nw_it_mring006"; break; case 34: sItem = "nw_it_mneck006"; break; case 35: sItem = "nw_it_mneck029"; break; case 36: sItem = "nw_it_mring013"; break; case 37: sItem = "nw_it_mboots011"; break; case 38: sItem = "nw_it_mneck025"; break; case 39: sItem = "nw_it_mbelt009"; break; case 40: sItem = "nw_it_mbelt010"; break; case 41: sItem = "nw_it_mbelt011"; break; case 42: sItem = "nw_it_mring025"; break; case 43: sItem = "nw_it_mring025"; break; case 14: sItem = "nw_maarcl031"; break; } } else if (GetRange(4, nHD)) // * 800 - 10000 { int nRandom = Random(48) + 1; switch (nRandom) { case 1: sItem = "nw_it_mring001"; break; case 2: sItem = "nw_it_mboots001"; break; case 3: sItem = "nw_it_mbracer001"; break; case 4: sItem = "nw_it_mneck007"; break; case 5: sItem = "nw_maarcl096"; break; case 6: sItem = "nw_it_mglove003"; break; case 7: sItem = "nw_it_mneck031"; break; case 8: sItem = "nw_it_mneck031"; break; case 9: sItem = "nw_it_mring006"; break; case 10: sItem = "nw_it_mneck006"; break; case 11: sItem = "nw_it_mneck029"; break; case 12: sItem = "nw_it_mring013"; break; case 13: sItem = "nw_it_mboots011"; break; case 14: sItem = "nw_it_mneck025"; break; case 15: sItem = "nw_it_mbelt009"; break; case 16: sItem = "nw_it_mbelt010"; break; case 17: sItem = "nw_it_mbelt011"; break; case 18: sItem = "nw_it_mring025"; break; case 19: sItem = "nw_it_mring025"; break; case 20: sItem = "nw_it_mbracer007"; break; case 21: sItem = "nw_it_mbracer007"; break; case 22: sItem = "nw_it_mneck012"; break; case 23: sItem = "nw_maarcl088"; break; case 24: sItem = "nw_it_mboots012"; break; case 25: sItem = "nw_it_mneck026"; break; case 26: sItem = "nw_it_mboots006"; break; case 27: sItem = "nw_it_mbracer003"; break; case 28: sItem = "nw_it_mneck008"; break; case 29: sItem = "nw_it_mring008"; break; case 30: sItem = "nw_maarcl056"; break; case 31: sItem = "nw_maarcl092"; break; case 32: sItem = "nw_it_mring014"; break; case 33: sItem = "nw_it_mneck016"; break; case 34: sItem = "nw_it_mboots013"; break; case 35: sItem = "nw_it_mneck027"; break; case 36: sItem = "nw_it_mbracer008"; break; case 37: sItem = "nw_it_mneck013"; break; case 38: sItem = "nw_maarcl089"; break; case 39: sItem = "nw_it_mbelt012"; break; case 40: sItem = "nw_it_mbelt013"; break; case 41: sItem = "nw_it_mbelt014"; break; case 42: sItem = "nw_it_mring027"; break; case 43: sItem = "nw_it_mboots007"; break; case 44: sItem = "nw_it_mbracer004"; break; case 45: sItem = "nw_it_mneck009"; break; case 46: sItem = "nw_it_mring018"; break; case 47: sItem = "nw_maarcl093"; break; case 48: sItem = "nw_it_mboots002"; break; } } else if (GetRange(5, nHD)) // * 2500 - 16500 { int nRandom = Random(42) + 1; switch (nRandom) { case 1: sItem = "nw_it_mbracer007"; break; case 2: sItem = "nw_it_mbracer007"; break; case 3: sItem = "nw_it_mneck012"; break; case 4: sItem = "nw_maarcl088"; break; case 5: sItem = "nw_it_mboots012"; break; case 6: sItem = "nw_it_mneck026"; break; case 7: sItem = "nw_it_mboots006"; break; case 8: sItem = "nw_it_mbracer003"; break; case 9: sItem = "nw_it_mneck008"; break; case 10: sItem = "nw_it_mring008"; break; case 11: sItem = "nw_maarcl056"; break; case 12: sItem = "nw_maarcl092"; break; case 13: sItem = "nw_it_mring014"; break; case 14: sItem = "nw_it_mneck016"; break; case 15: sItem = "nw_it_mboots013"; break; case 16: sItem = "nw_it_mneck027"; break; case 17: sItem = "nw_it_mbracer008"; break; case 18: sItem = "nw_it_mneck013"; break; case 19: sItem = "nw_maarcl089"; break; case 20: sItem = "nw_it_mbelt012"; break; case 21: sItem = "nw_it_mbelt013"; break; case 22: sItem = "nw_it_mbelt014"; break; case 23: sItem = "nw_it_mring027"; break; case 24: sItem = "nw_it_mboots007"; break; case 25: sItem = "nw_it_mbracer004"; break; case 26: sItem = "nw_it_mneck009"; break; case 27: sItem = "nw_it_mring018"; break; case 28: sItem = "nw_maarcl093"; break; case 29: sItem = "nw_it_mboots002"; break; case 30: sItem = "nw_it_mboots014"; break; case 31: sItem = "nw_it_mneck028"; break; case 32: sItem = "nw_it_mring015"; break; case 33: sItem = "nw_it_mbracer009"; break; case 34: sItem = "nw_it_mneck014"; break; case 35: sItem = "nw_maarcl090"; break; case 36: sItem = "nw_it_mring028"; break; case 37: sItem = "nw_it_mneck017"; break; case 38: sItem = "nw_it_mboots008"; break; case 39: sItem = "nw_it_mbracer005"; break; case 40: sItem = "nw_it_mneck010"; break; case 41: sItem = "nw_it_mmidmisc02"; break; case 42: sItem = "nw_it_mring019"; break; } } else if (GetRange(6, nHD)) // * 8000 - 25000 { int nRandom = Random(30) + 1; switch (nRandom) { case 1: sItem = "nw_it_mring027"; break; case 2: sItem = "nw_it_mboots007"; break; case 3: sItem = "nw_it_mbracer004"; break; case 4: sItem = "nw_it_mneck009"; break; case 5: sItem = "nw_it_mring018"; break; case 6: sItem = "nw_maarcl093"; break; case 7: sItem = "nw_it_mboots002"; break; case 8: sItem = "nw_it_mboots014"; break; case 9: sItem = "nw_it_mneck028"; break; case 10: sItem = "nw_it_mring015"; break; case 11: sItem = "nw_it_mbracer009"; break; case 12: sItem = "nw_it_mneck014"; break; case 13: sItem = "nw_maarcl090"; break; case 14: sItem = "nw_it_mring028"; break; case 15: sItem = "nw_it_mneck017"; break; case 16: sItem = "nw_it_mboots008"; break; case 17: sItem = "nw_it_mbracer005"; break; case 18: sItem = "nw_it_mneck010"; break; case 19: sItem = "nw_it_mmidmisc02"; break; case 20: sItem = "nw_maarcl094"; break; case 21: sItem = "nw_it_mring019"; break; case 22: sItem = "nw_it_mring016"; break; case 23: sItem = "nw_it_mbracer010"; break; case 24: sItem = "nw_it_mneck015"; break; case 25: sItem = "nw_maarcl091"; break; case 26: sItem = "nw_it_mboots009"; break; case 27: sItem = "nw_it_mbracer006"; break; case 28: sItem = "nw_it_mneck011"; break; case 29: sItem = "nw_maarcl095"; break; case 30: sItem = "nw_it_mneck018"; break; } } //dbSpeak("Create Misc"); dbCreateItemOnObject(sItem, oTarget, 1); } // * this function just returns an item that is more appropriate // * for this class. Only wizards, sorcerers, clerics, monks, rogues and bards get this void CreateGenericClassItem(object oTarget, object oAdventurer, int nSpecific =0) { if (GetLevelByClass(CLASS_TYPE_DRUID, oAdventurer)>= 1) { if (nSpecific == 0) { CreateGenericDruidWeapon(oTarget, oAdventurer); } else { CreateSpecificDruidWeapon(oTarget, oAdventurer); } } else if (GetLevelByClass(CLASS_TYPE_WIZARD, oAdventurer)>= 1 || GetLevelByClass(CLASS_TYPE_SORCERER, oAdventurer) >= 1) { // * 30% chance of getting a magic scroll else get a weapon suited for a wizard if (Random(100) + 1 > 70) { // * grab an arcane scroll as if the wizard had +4 levels CreateArcaneScroll(oTarget, oAdventurer, 4); } else if (nSpecific == 0) { CreateGenericWizardWeapon(oTarget, oAdventurer); } else { CreateSpecificWizardWeapon(oTarget, oAdventurer); } } else if (GetLevelByClass(CLASS_TYPE_CLERIC, oAdventurer)>= 1) { int nRandom = Random(4) + 1; string sItem = "nw_it_medkit001"; switch (nRandom) { case 1: sItem = "nw_it_medkit001"; break; case 2: sItem = "nw_it_medkit002"; break; case 3: sItem = "nw_it_medkit003"; break; case 4: sItem = "nw_it_medkit004"; break; } dbCreateItemOnObject(sItem, oTarget, 1); } else if (GetLevelByClass(CLASS_TYPE_MONK, oAdventurer)>= 1) { //dbSpeak("in monk function"); if (nSpecific == 0) { CreateGenericMonkWeapon(oTarget, oAdventurer); } else { CreateSpecificMonkWeapon(oTarget, oAdventurer); } } else if (GetLevelByClass(CLASS_TYPE_ROGUE, oAdventurer)>= 1) { // * give a misc item as if a couple levels higher CreateGenericMiscItem(oTarget, oAdventurer, 2); } else if (GetLevelByClass(CLASS_TYPE_BARD, oAdventurer)>= 1) { // * give a misc item as if a couple levels higher CreateGenericMiscItem(oTarget, oAdventurer, 2); } } void CreateGenericRodStaffWand(object oTarget, object oAdventurer, int nModifier = 0) { string sItem = ""; int nHD = GetHitDice(oAdventurer) + nModifier; if (GetRange(1, nHD)) // * 200 { int nRandom = Random(2) + 1; switch (nRandom) { case 1: sItem = "nw_wmgwn013"; break; //case 2: sItem = "nw_wmgwn006"; break; case 2: sItem = "nw_it_gem002"; break; // gem for variety } } else if (GetRange(2, nHD)) // * 800 { int nRandom = Random(2) + 1; switch (nRandom) { case 1: sItem = "nw_wmgwn013"; break; //case 2: sItem = "nw_wmgwn006"; break; case 2: sItem = "nw_it_gem002"; break;// gem for variety } } else if (GetRange(3, nHD)) // * 200 - 2500 { int nRandom = Random(3) + 1; switch (nRandom) { //case 1: sItem = "nw_wmgwn006"; break; case 2: sItem = "nw_wmgwn004"; break; case 3: sItem = "nw_wmgrd002"; break; case 1: sItem = "nw_wmgwn012"; break; } } else if (GetRange(4, nHD)) // * 800 - 10000 { int nRandom = Random(11) + 1; switch (nRandom) { case 1: sItem = "nw_wmgwn004"; break; case 2: sItem = "nw_wmgwn002"; break; case 3: sItem = "nw_wmgwn007"; break; case 4: sItem = "nw_wmgwn003"; break; case 5: sItem = "nw_wmgwn010"; break; case 6: sItem = "nw_wmgwn011"; break; case 7: sItem = "nw_wmgwn005"; break; case 8: sItem = "nw_wmgwn008"; break; case 9: sItem = "nw_wmgwn009"; break; case 10: sItem = "nw_wmgrd002"; break; case 11: sItem = "nw_wmgwn012"; break; } } else // * 2500 - 16500 { int nRandom = d8(); switch (nRandom) { case 1: sItem = "nw_wmgwn002"; break; case 2: sItem = "nw_wmgwn007"; break; case 3: sItem = "nw_wmgwn003"; break; case 4: sItem = "nw_wmgwn010"; break; case 5: sItem = "nw_wmgwn011"; break; case 6: sItem = "nw_wmgwn005"; break; case 7: sItem = "nw_wmgwn008"; break; case 8: sItem = "nw_wmgwn009"; break; } } //dbSpeak("Generic Rod staff wand"); dbCreateItemOnObject(sItem, oTarget, 1); } void CreateGenericMonkWeapon(object oTarget, object oAdventurer, int nModifier = 0) { string sItem = ""; int nHD = GetHitDice(oAdventurer) + nModifier; if (GetRange(1, nHD)) // * 200 { int nRandom = Random(10) + 1; switch (nRandom) { case 1: sItem = "nw_wthsh001"; break; case 2: sItem = "nw_wblcl001"; break; case 3: sItem = "nw_wdbqs001"; break; case 4: sItem = "nw_wbwsl001"; break; case 5: sItem = "nw_wswdg001"; break; case 6: sItem = "nw_wspka001"; break; case 7: sItem = "nw_wbwxh001"; break; case 8: sItem = "nw_waxhn001"; break; case 9: sItem = "nw_wbwxl001"; break; case 10: sItem = "nw_wthmsh002"; break; } } else if (GetRange(2, nHD)) // * 800 { int nRandom = Random(14) + 1; switch (nRandom) { case 1: sItem = "nw_wthsh001"; break; case 2: sItem = "nw_wblcl001"; break; case 3: sItem = "nw_wdbqs001"; break; case 4: sItem = "nw_wbwsl001"; break; case 5: sItem = "nw_wswdg001"; break; case 6: sItem = "nw_wspka001"; break; case 7: sItem = "nw_wbwxh001"; break; case 8: sItem = "nw_waxhn001"; break; case 9: sItem = "nw_wbwxl001"; break; case 10: sItem = "nw_wthmsh002"; break; case 11: sItem = "nw_wbwmsl001"; break; case 12: sItem = "nw_wbwmxh002"; break; case 13: sItem = "nw_wthmsh008"; break; case 14: sItem = "nw_wbwmxl002"; break; } } else if (GetRange(3, nHD)) // * 200 - 2500 { int nRandom = Random(13) + 1; switch (nRandom) { case 1: sItem = "nw_wbwmsl001"; break; case 2: sItem = "nw_wbwmxh002"; break; case 3: sItem = "nw_wthmsh008"; break; case 4: sItem = "nw_wbwmxl002"; break; case 5: sItem = "nw_wthmsh009"; break; case 6: sItem = "nw_wblmcl002"; break; case 7: sItem = "nw_wdbmqs002"; break; case 8: sItem = "nw_wswmdg002"; break; case 9: sItem = "nw_wspmka002"; break; case 10: sItem = "nw_waxmhn002"; break; case 11: sItem = "nw_wbwmsl009"; break; case 12: sItem = "nw_wbwmxh008"; break; case 13: sItem = "nw_wbwmxl008"; break; } } else if (GetRange(4, nHD)) // * 800 - 10000 { int nRandom = Random(17) + 1; switch (nRandom) { case 1: sItem = "nw_wthmsh009"; break; case 2: sItem = "nw_wblmcl002"; break; case 3: sItem = "nw_wdbmqs002"; break; case 4: sItem = "nw_wswmdg002"; break; case 5: sItem = "nw_wspmka002"; break; case 6: sItem = "nw_waxmhn002"; break; case 7: sItem = "nw_wbwmsl009"; break; case 8: sItem = "nw_wbwmxh008"; break; case 9: sItem = "nw_wbwmxl008"; break; case 10: sItem = "nw_wbwmsl010"; break; case 11: sItem = "nw_wbwmxh009"; break; case 12: sItem = "nw_wbwmxl009"; break; case 13: sItem = "nw_wblmcl010"; break; case 14: sItem = "nw_wdbmqs008"; break; case 15: sItem = "nw_wswmdg008"; break; case 16: sItem = "nw_wspmka008"; break; case 17: sItem = "nw_waxmhn010"; break; } } else // * 2500 - 16500 { int nRandom = Random(13) + 1; switch (nRandom) { case 1: sItem = "nw_wbwmsl010"; break; case 2: sItem = "nw_wbwmxh009"; break; case 3: sItem = "nw_wbwmxl009"; break; case 4: sItem = "nw_wblmcl010"; break; case 5: sItem = "nw_wdbmqs008"; break; case 6: sItem = "nw_wswmdg008"; break; case 7: sItem = "nw_wspmka008"; break; case 8: sItem = "nw_waxmhn010"; break; case 9: sItem = "nw_wblmcl011"; break; case 10: sItem = "nw_wdbmqs009"; break; case 11: sItem = "nw_wswmdg009"; break; case 12: sItem = "nw_wspmka009"; break; case 13: sItem = "nw_waxmhn011"; break; } } //dbSpeak("Generic Monk Weapon"); dbCreateItemOnObject(sItem, oTarget, 1); } void CreateSpecificMonkWeapon(object oTarget, object oAdventurer, int nModifier = 0) { string sItem = ""; int nHD = GetHitDice(oAdventurer) + nModifier; if (GetRange(1, nHD)) // * 800 { int nRandom = Random(3) + 1; switch (nRandom) { case 1: sItem = "nw_wthmsh003"; break; case 2: sItem = "nw_wthmsh006"; break; case 3: CreateGenericMonkWeapon(oTarget, oAdventurer, JUMP_LEVEL); return; break; } } else if (GetRange(2, nHD)) // * 2500 { int nRandom = Random(8) + 1; switch (nRandom) { case 1: sItem = "nw_wthmsh003"; break; case 2: sItem = "nw_wthmsh006"; break; case 3: sItem = "nw_wthmsh004"; break; case 4: sItem = "nw_wthmsh007"; break; case 5: sItem = "NW_IT_MGLOVE016"; break; case 6: sItem = "NW_IT_MGLOVE021"; break; case 7: sItem = "NW_IT_MGLOVE026"; break; case 8: CreateGenericMonkWeapon(oTarget, oAdventurer, JUMP_LEVEL); return; break; } } else if (GetRange(3, nHD)) // * 800 - 10000 { int nRandom = Random(21) + 1; switch (nRandom) { case 1: sItem = "nw_wthmsh006"; break; case 2: sItem = "nw_wthmsh004"; break; case 3: sItem = "nw_wthmsh007"; break; case 4: sItem = "nw_wbwmsl005"; break; case 5: sItem = "nw_wbwmxh005"; break; case 6: sItem = "nw_wspmka004"; break; case 7: sItem = "nw_wbwmxl005"; break; case 8: sItem = "nw_wspmka007"; break; case 9: sItem = "nw_wswmdg006"; break; case 10: sItem = "nw_wspmka005"; break; case 11: sItem = "NW_IT_MGLOVE016"; break; case 12: sItem = "NW_IT_MGLOVE021"; break; case 13: sItem = "NW_IT_MGLOVE026"; break; case 14: sItem = "NW_IT_MGLOVE017"; break; case 15: sItem = "NW_IT_MGLOVE022"; break; case 16: sItem = "NW_IT_MGLOVE027"; break; case 17: sItem = "NW_IT_MGLOVE018"; break; case 18: sItem = "NW_IT_MGLOVE023"; break; case 19: sItem = "NW_IT_MGLOVE028"; break; case 20: sItem = "NW_IT_MGLOVE029"; break; case 21: sItem = "NW_IT_MGLOVE030"; break; } } else if (GetRange(4, nHD)) // * 2500 -16500 { int nRandom = Random(22) + 1; switch (nRandom) { case 1: sItem = "nw_wbwmsl005"; break; case 2: sItem = "nw_wbwmxh005"; break; case 3: sItem = "nw_wspmka004"; break; case 4: sItem = "nw_wbwmxl005"; break; case 5: sItem = "nw_wspmka007"; break; case 6: sItem = "nw_wswmdg006"; break; case 7: sItem = "nw_wspmka005"; break; case 8: sItem = "nw_wblmcl004"; break; case 9: sItem = "nw_wblmcl003"; break; case 10: sItem = "nw_wbwmsl003"; break; case 11: sItem = "nw_wbwmxh003"; break; case 12: sItem = "nw_waxmhn004"; break; case 13: sItem = "nw_wbwmxl003"; break; case 14: sItem = "NW_IT_MGLOVE017"; break; case 15: sItem = "NW_IT_MGLOVE022"; break; case 16: sItem = "NW_IT_MGLOVE018"; break; case 17: sItem = "NW_IT_MGLOVE023"; break; case 18: sItem = "NW_IT_MGLOVE028"; break; case 19: sItem = "NW_IT_MGLOVE029"; break; case 20: sItem = "NW_IT_MGLOVE030"; break; case 21: sItem = "NW_IT_MGLOVE019"; break; case 22: sItem = "NW_IT_MGLOVE024"; break; } } else // * 16000 + { int nRandom = Random(24) + 1; switch (nRandom) { case 1: sItem = "nw_wbwmxl003"; break; case 2: sItem = "nw_wspmka006"; break; case 3: sItem = "nw_wbwmxl004"; break; case 4: sItem = "nw_wspmka003"; break; case 5: sItem = "nw_wbwmxl007"; break; case 6: sItem = "nw_waxmhn003"; break; case 7: sItem = "nw_wblmcl005"; break; case 8: sItem = "nw_wswmdg004"; break; case 9: sItem = "nw_wbwmsl007"; break; case 10: sItem = "nw_wbwmxh004"; break; case 11: sItem = "nw_waxmhn005"; break; case 12: sItem = "nw_wbwmxh007"; break; case 13: sItem = "nw_wswmdg003"; break; case 14: sItem = "nw_wswmdg007"; break; case 15: sItem = "nw_wbwmsl006"; break; case 16: sItem = "nw_wbwmsl008"; break; case 17: sItem = "nw_wblmcl006"; break; case 18: sItem = "nw_wbwmsl004"; break; case 19: sItem = "nw_waxmhn006"; break; case 20: sItem = "nw_wbwmxh006"; break; case 21: sItem = "nw_wswmdg005"; break; case 22: sItem = "nw_wbwmxl006"; break; case 23: sItem = "NW_IT_MGLOVE020"; break; case 24: sItem = "NW_IT_MGLOVE025"; break; } } //dbSpeak("Specific Monk Weapon"); dbCreateItemOnObject(sItem, oTarget, 1); } void CreateGenericDruidWeapon(object oTarget, object oAdventurer, int nModifier = 0) { string sItem = ""; int nHD = GetHitDice(oAdventurer) + nModifier; if (GetRange(1, nHD)) // * 200 { int nRandom = Random(8) + 1; switch (nRandom) { case 1: sItem = "nw_wthdt001"; break; case 2: sItem = "nw_wblcl001"; break; case 3: sItem = "nw_wdbqs001"; break; case 4: sItem = "nw_wplss001"; break; case 5: sItem = "nw_wswdg001"; break; case 6: sItem = "nw_wspsc001"; break; case 7: sItem = "nw_wswsc001"; break; case 8: sItem = "nw_wthmdt002"; break; } } else if (GetRange(2, nHD)) // * 800 { int nRandom = Random(11) + 1; switch (nRandom) { case 1: sItem = "nw_wthdt001"; break; case 2: sItem = "nw_wblcl001"; break; case 3: sItem = "nw_wdbqs001"; break; case 4: sItem = "nw_wplss001"; break; case 5: sItem = "nw_wswdg001"; break; case 6: sItem = "nw_wspsc001"; break; case 7: sItem = "nw_wswsc001"; break; case 8: sItem = "nw_wthmdt002"; break; case 9: sItem = "nw_wthmdt005"; break; case 10: sItem = "nw_wbwmsl001"; break; case 11: sItem = "nw_wthmdt008"; break; } } else if (GetRange(3, nHD)) // * 200 - 2500 { int nRandom = Random(13) + 1; switch (nRandom) { case 1: sItem = "nw_wthmdt005"; break; case 2: sItem = "nw_wbwmsl001"; break; case 3: sItem = "nw_wthmdt008"; break; case 4: sItem = "nw_wthmdt009"; break; case 5: sItem = "nw_wthmdt006"; break; case 6: sItem = "nw_wblmcl002"; break; case 7: sItem = "nw_wdbmqs002"; break; case 8: sItem = "nw_wplmss002"; break; case 9: sItem = "nw_wswmdg002"; break; case 10: sItem = "nw_wspmsc002"; break; case 11: sItem = "nw_wswmsc002"; break; case 12: sItem = "nw_wthmdt003"; break; case 13: sItem = "nw_wbwmsl009"; break; } } else if (GetRange(4, nHD)) // * 800 - 10000 { int nRandom = Random(19) + 1; switch (nRandom) { case 1: sItem = "nw_wthmdt009"; break; case 2: sItem = "nw_wthmdt006"; break; case 3: sItem = "nw_wblmcl002"; break; case 4: sItem = "nw_wdbmqs002"; break; case 5: sItem = "nw_wplmss002"; break; case 6: sItem = "nw_wswmdg002"; break; case 7: sItem = "nw_wspmsc002"; break; case 8: sItem = "nw_wswmsc002"; break; case 9: sItem = "nw_wthmdt003"; break; case 10: sItem = "nw_wbwmsl009"; break; case 11: sItem = "nw_wthmdt007"; break; case 12: sItem = "nw_wthmdt004"; break; case 13: sItem = "nw_wbwmsl010"; break; case 14: sItem = "nw_wblmcl010"; break; case 15: sItem = "nw_wdbmqs008"; break; case 16: sItem = "nw_wplmss010"; break; case 17: sItem = "nw_wswmdg008"; break; case 18: sItem = "nw_wspmsc010"; break; case 19: sItem = "nw_wswmsc010"; break; } } else // * 2500 - 16500 { int nRandom = Random(15) + 1; switch (nRandom) { case 1: sItem = "nw_wthmdt007"; break; case 2: sItem = "nw_wthmdt004"; break; case 3: sItem = "nw_wbwmsl010"; break; case 4: sItem = "nw_wblmcl010"; break; case 5: sItem = "nw_wdbmqs008"; break; case 6: sItem = "nw_wplmss010"; break; case 7: sItem = "nw_wswmdg008"; break; case 8: sItem = "nw_wspmsc010"; break; case 9: sItem = "nw_wswmsc010"; break; case 10: sItem = "nw_wblmcl011"; break; case 11: sItem = "nw_wdbmqs009"; break; case 12: sItem = "nw_wplmss011"; break; case 13: sItem = "nw_wswmdg009"; break; case 14: sItem = "nw_wspmsc011"; break; case 15: sItem = "nw_wswmsc011"; break; } } //dbSpeak("Generic Druid weapon"); dbCreateItemOnObject(sItem, oTarget, 1); } void CreateSpecificDruidWeapon(object oTarget, object oAdventurer, int nModifier = 0) { string sItem = ""; int nHD = GetHitDice(oAdventurer) + nModifier; if (GetRange(1, nHD)) // * 800 { CreateGenericDruidWeapon(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(2, nHD)) // * 2500 { CreateGenericDruidWeapon(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(3, nHD)) // * 800 - 10000 { int nRandom = Random(5) + 1; switch (nRandom) { case 1: sItem = "nw_wdbmqs005"; break; case 2: sItem = "nw_wdbmqs006"; break; case 3: sItem = "nw_wbwmsl005"; break; case 4: sItem = "nw_wswmdg006"; break; case 5: CreateGenericDruidWeapon(oTarget, oAdventurer, JUMP_LEVEL); return; break; } } else if (GetRange(4, nHD)) // * 2500 -16500 { int nRandom = Random(10) + 1; switch (nRandom) { case 1: sItem = "nw_wdbmqs005"; break; case 2: sItem = "nw_wdbmqs006"; break; case 3: sItem = "nw_wbwmsl005"; break; case 4: sItem = "nw_wswmdg006"; break; case 5: sItem = "nw_wblmcl004"; break; case 6: sItem = "nw_wdbmqs004"; break; case 7: sItem = "nw_wblmcl003"; break; case 8: sItem = "nw_wbwmsl003"; break; case 9: sItem = "nw_wswmsc004"; break; case 10: sItem = "nw_wplmss005"; break; } } else // * 16000 + { int nRandom = Random(18) + 1; switch (nRandom) { case 1: sItem = "nw_wdbmqs003"; break; case 2: sItem = "nw_wblmcl005"; break; case 3: sItem = "nw_wplmss007"; break; case 4: sItem = "nw_wswmdg004"; break; case 5: sItem = "nw_wbwmsl007"; break; case 6: sItem = "nw_wplmss006"; break; case 7: sItem = "nw_wswmsc006"; break; case 8: sItem = "nw_wswmdg003"; break; case 9: sItem = "nw_wswmdg007"; break; case 10: sItem = "nw_wswmsc007"; break; case 11: sItem = "nw_wbwmsl006"; break; case 12: sItem = "nw_wbwmsl008"; break; case 13: sItem = "nw_wdbmqs007"; break; case 14: sItem = "nw_wblmcl006"; break; case 15: sItem = "nw_wbwmsl004"; break; case 16: sItem = "nw_wswmsc005"; break; case 17: sItem = "nw_wplmss004"; break; case 18: sItem = "nw_wswmdg005"; break; } } //dbSpeak("specific druid weapon"); dbCreateItemOnObject(sItem, oTarget, 1); } void CreateGenericWizardWeapon(object oTarget, object oAdventurer, int nModifier = 0) { string sItem = ""; int nHD = GetHitDice(oAdventurer) + nModifier; if (GetRange(1, nHD)) // * 200 { int nRandom = Random(5) + 1; switch (nRandom) { case 1: sItem = "nw_wblcl001"; break; case 2: sItem = "nw_wdbqs001"; break; case 3: sItem = "nw_wswdg001"; break; case 4: sItem = "nw_wbwxh001"; break; case 5: sItem = "nw_wbwxl001"; break; } } else if (GetRange(2, nHD)) // * 800 { int nRandom = Random(6) + 1; switch (nRandom) { case 1: sItem = "nw_wblcl001"; break; case 2: sItem = "nw_wdbqs001"; break; case 3: sItem = "nw_wswdg001"; break; case 4: sItem = "nw_wbwxh001"; break; case 5: sItem = "nw_wbwxl001"; break; case 6: sItem = "nw_wbwmxl002"; break; } } else if (GetRange(3, nHD)) // * 200 - 2500 { int nRandom = Random(6) + 1; switch (nRandom) { case 1: sItem = "nw_wbwmxl002"; break; case 2: sItem = "nw_wblmcl002"; break; case 3: sItem = "nw_wdbmqs002"; break; case 4: sItem = "nw_wswmdg002"; break; case 5: sItem = "nw_wbwmxh008"; break; case 6: sItem = "nw_wbwmxl008"; break; } } else if (GetRange(4, nHD)) // * 800 - 10000 { int nRandom = Random(10) + 1; switch (nRandom) { case 1: sItem = "nw_wblmcl002"; break; case 2: sItem = "nw_wdbmqs002"; break; case 3: sItem = "nw_wswmdg002"; break; case 4: sItem = "nw_wbwmxh008"; break; case 5: sItem = "nw_wbwmxl008"; break; case 6: sItem = "nw_wbwmxh009"; break; case 7: sItem = "nw_wbwmxl009"; break; case 8: sItem = "nw_wblmcl010"; break; case 9: sItem = "nw_wdbmqs008"; break; case 10: sItem = "nw_wswmdg008"; break; } } else // * 2500 - 16500 { int nRandom = Random(8) + 1; switch (nRandom) { case 1: sItem = "nw_wbwmxh009"; break; case 2: sItem = "nw_wbwmxl009"; break; case 3: sItem = "nw_wblmcl010"; break; case 4: sItem = "nw_wdbmqs008"; break; case 5: sItem = "nw_wswmdg008"; break; case 6: sItem = "nw_wblmcl011"; break; case 7: sItem = "nw_wdbmqs009"; break; case 8: sItem = "nw_wswmdg009"; break; } } //dbSpeak("Generic Wizard or Sorcerer Weapon"); dbCreateItemOnObject(sItem, oTarget, 1); } void CreateSpecificWizardWeapon(object oTarget, object oAdventurer, int nModifier = 0) { string sItem = ""; int nHD = GetHitDice(oAdventurer) + nModifier; if (GetRange(1, nHD)) // * 800 { CreateGenericWizardWeapon(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(2, nHD)) // * 2500 { CreateGenericWizardWeapon(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(3, nHD)) // * 800 - 10000 { int nRandom = Random(5) + 1; switch (nRandom) { case 1: sItem = "nw_wdbmqs005"; break; case 2: sItem = "nw_wdbmqs006"; break; case 3: sItem = "nw_wbwmxh005"; break; case 4: sItem = "nw_wbwmxl005"; break; case 5: sItem = "nw_wswmdg006"; break; } } else if (GetRange(4, nHD)) // * 2500 -16500 { int nRandom = Random(10) + 1; switch (nRandom) { case 1: sItem = "nw_wdbmqs005"; break; case 2: sItem = "nw_wdbmqs006"; break; case 3: sItem = "nw_wbwmxh005"; break; case 4: sItem = "nw_wbwmxl005"; break; case 5: sItem = "nw_wswmdg006"; break; case 6: sItem = "nw_wblmcl004"; break; case 7: sItem = "nw_wdbmqs004"; break; case 8: sItem = "nw_wblmcl003"; break; case 9: sItem = "nw_wbwmxh003"; break; case 10: sItem = "nw_wbwmxl003"; break; } } else // * 16000 + { int nRandom = Random(15) + 1; switch (nRandom) { case 1: sItem = "nw_wbwmxl003"; break; case 2: sItem = "nw_wdbmqs003"; break; case 3: sItem = "nw_wbwmxl004"; break; case 4: sItem = "nw_wbwmxl007"; break; case 5: sItem = "nw_wblmcl005"; break; case 6: sItem = "nw_wswmdg004"; break; case 7: sItem = "nw_wbwmxh004"; break; case 8: sItem = "nw_wbwmxh007"; break; case 9: sItem = "nw_wswmdg003"; break; case 10: sItem = "nw_wswmdg007"; break; case 11: sItem = "nw_wdbmqs007"; break; case 12: sItem = "nw_wblmcl006"; break; case 13: sItem = "nw_wbwmxh006"; break; case 14: sItem = "nw_wswmdg005"; break; case 15: sItem = "nw_wbwmxl006"; break; } } //dbSpeak("Specific Wizard or Sorcerer Weapon"); dbCreateItemOnObject(sItem, oTarget, 1); } |
Code: |
void CreateGenericSimple(object oTarget, object oAdventurer, int nModifier = 0)
{ string sItem = ""; int nHD = GetHitDice(oAdventurer) + nModifier; if (GetRange(1, nHD)) // * 200 { int nRandom = d12(); switch (nRandom) { case 1: sItem = "nw_wthdt001"; break; case 2: sItem = "nw_wblcl001"; break; case 3: sItem = "nw_wbwsl001"; break; case 4: sItem = "nw_wplss001"; break; case 5: sItem = "nw_wdbqs001"; break; case 6: sItem = "nw_wswdg001"; break; case 7: sItem = "nw_wblml001"; break; case 8: sItem = "nw_wbwxh001"; break; case 9: sItem = "nw_wspsc001"; break; case 10: sItem = "nw_wblms001"; break; case 11: sItem = "nw_wbwxl001"; break; case 12: sItem = "nw_wthmdt002"; break; } } else if (GetRange(2, nHD)) // * 800 { int nRandom = Random(17) + 1; switch (nRandom) { case 1: sItem = "nw_wthdt001"; break; case 2: sItem = "nw_wblcl001"; break; case 3: sItem = "nw_wbwsl001"; break; case 4: sItem = "nw_wplss001"; break; case 5: sItem = "nw_wdbqs001"; break; case 6: sItem = "nw_wswdg001"; break; case 7: sItem = "nw_wblml001"; break; case 8: sItem = "nw_wbwxh001"; break; case 9: sItem = "nw_wspsc001"; break; case 10: sItem = "nw_wblms001"; break; case 11: sItem = "nw_wbwxl001"; break; case 12: sItem = "nw_wthmdt002"; break; case 13: sItem = "nw_wthmdt005"; break; case 14: sItem = "nw_wbwmsl001"; break; case 15: sItem = "nw_wbwmxh002"; break; case 16: sItem = "nw_wthmdt008"; break; case 17: sItem = "nw_wbwmxl002"; break; } } else if (GetRange(3, nHD)) // * 200 - 2500 { int nRandom = Random(19) + 1; switch (nRandom) { case 1: sItem = "nw_wthmdt005"; break; case 2: sItem = "nw_wbwmsl001"; break; case 3: sItem = "nw_wbwmxh002"; break; case 4: sItem = "nw_wthmdt008"; break; case 5: sItem = "nw_wbwmxl002"; break; case 6: sItem = "nw_wthmdt009"; break; case 7: sItem = "nw_wthmdt006"; break; case 8: sItem = "nw_wblmcl002"; break; case 9: sItem = "nw_wplmss002"; break; case 10: sItem = "nw_wdbmqs002"; break; case 11: sItem = "nw_wswmdg002"; break; case 12: sItem = "nw_wblmml002"; break; case 13: sItem = "nw_wspmsc002"; break; case 14: sItem = "nw_wblmms002"; break; case 15: sItem = "nw_wthmdt003"; break; case 16: sItem = "nw_wthmdt003"; break; case 17: sItem = "nw_wbwmsl009"; break; case 18: sItem = "nw_wbwmxh008"; break; case 19: sItem = "nw_wbwmxl008"; break; } } else if (GetRange(4, nHD)) // * 800 - 10000 { int nRandom = Random(27) + 1; switch (nRandom) { case 1: sItem = "nw_wthmdt009"; break; case 2: sItem = "nw_wthmdt006"; break; case 3: sItem = "nw_wblmcl002"; break; case 4: sItem = "nw_wplmss002"; break; case 5: sItem = "nw_wdbmqs002"; break; case 6: sItem = "nw_wswmdg002"; break; case 7: sItem = "nw_wblmml002"; break; case 8: sItem = "nw_wspmsc002"; break; case 9: sItem = "nw_wblmms002"; break; case 10: sItem = "nw_wthmdt003"; break; case 11: sItem = "nw_wthmdt003"; break; case 12: sItem = "nw_wbwmsl009"; break; case 13: sItem = "nw_wbwmxh008"; break; case 14: sItem = "nw_wbwmxl008"; break; case 15: sItem = "nw_wthmdt007"; break; case 16: sItem = "nw_wthmdt004"; break; case 17: sItem = "nw_wbwmsl010"; break; case 18: sItem = "nw_wbwmxh009"; break; case 19: sItem = "nw_wbwmxl009"; break; case 20: sItem = "nw_wbwmsl005"; break; case 21: sItem = "nw_wblmcl010"; break; case 22: sItem = "nw_wplmss010"; break; case 23: sItem = "nw_wdbmqs008"; break; case 24: sItem = "nw_wswmdg008"; break; case 25: sItem = "nw_wblmml011"; break; case 26: sItem = "nw_wspmsc010"; break; case 27: sItem = "nw_wblmms010"; break; } } else if (GetRange(5, nHD)) // * 2500 - 16500 { int nRandom = Random(23) + 1; switch (nRandom) { case 1: sItem = "nw_wthmdt007"; break; case 2: sItem = "nw_wthmdt004"; break; case 3: sItem = "nw_wbwmsl010"; break; case 4: sItem = "nw_wbwmxh009"; break; case 5: sItem = "nw_wbwmxl009"; break; case 6: sItem = "nw_wbwmsl005"; break; case 7: sItem = "nw_wblmcl010"; break; case 8: sItem = "nw_wplmss010"; break; case 9: sItem = "nw_wdbmqs008"; break; case 10: sItem = "nw_wswmdg008"; break; case 11: sItem = "nw_wblmml011"; break; case 12: sItem = "nw_wspmsc010"; break; case 13: sItem = "nw_wblmms010"; break; case 14: sItem = "nw_wblmms010"; break; case 15: sItem = "nw_wblmms010"; break; case 16: sItem = "nw_wblmms010"; break; case 17: sItem = "nw_wblmcl011"; break; case 18: sItem = "nw_wplmss011"; break; case 19: sItem = "nw_wdbmqs009"; break; case 20: sItem = "nw_wswmdg009"; break; case 21: sItem = "nw_wblmml012"; break; case 22: sItem = "nw_wspmsc011"; break; case 23: sItem = "nw_wblmms011"; break; } } else if (GetRange(6, nHD)) // * 8000 - 25000 { int nRandom = Random(7) + 1; switch (nRandom) { case 1: sItem = "nw_wblmcl011"; break; case 2: sItem = "nw_wplmss011"; break; case 3: sItem = "nw_wdbmqs009"; break; case 4: sItem = "nw_wswmdg009"; break; case 5: sItem = "nw_wblmml012"; break; case 6: sItem = "nw_wspmsc011"; break; case 7: sItem = "nw_wblmms011"; break; } } //dbSpeak("Create Generic SImple; Specific = " + IntToString(nModifier)); dbCreateItemOnObject(sItem, oTarget, 1); } void CreateGenericMartial(object oTarget, object oAdventurer, int nModifier = 0) { string sItem = ""; int nHD = GetHitDice(oAdventurer) +nModifier; if (GetRange(1, nHD)) // * 200 { int nRandom = Random(16) + 1; switch (nRandom) { case 1: sItem = "nw_wthax001"; break; case 2: sItem = "nw_wblhl001"; break; case 3: sItem = "nw_waxhn001"; break; case 4: sItem = "nw_wblfl001"; break; case 5: sItem = "nw_waxbt001"; break; case 6: sItem = "nw_wplhb001"; break; case 7: sItem = "nw_wswss001"; break; case 8: sItem = "nw_wblhw001"; break; // case 9: sItem = "nw_wblfh001"; break; case 10: sItem = "nw_wswls001"; break; case 11: sItem = "nw_wswsc001"; break; case 12: sItem = "nw_waxgr001"; break; case 13: sItem = "nw_wswrp001"; break; case 14: sItem = "nw_wbwsh001"; break; case 15: sItem = "nw_wswbs001"; break; case 16: sItem = "nw_wswgs001"; break; case 9: sItem = "nw_wbwln001"; break; } } else if (GetRange(2, nHD)) // * 800 { int nRandom = Random(19) + 1; switch (nRandom) { case 1: sItem = "nw_wthax001"; break; case 2: sItem = "nw_wblhl001"; break; case 3: sItem = "nw_waxhn001"; break; case 4: sItem = "nw_wblfl001"; break; case 5: sItem = "nw_waxbt001"; break; case 6: sItem = "nw_wplhb001"; break; case 7: sItem = "nw_wswss001"; break; case 8: sItem = "nw_wblhw001"; break; //case 9: sItem = "nw_wblfh001"; break; case 10: sItem = "nw_wswls001"; break; case 11: sItem = "nw_wswsc001"; break; case 12: sItem = "nw_waxgr001"; break; case 13: sItem = "nw_wswrp001"; break; case 14: sItem = "nw_wbwsh001"; break; case 15: sItem = "nw_wswbs001"; break; case 16: sItem = "nw_wswgs001"; break; case 17: sItem = "nw_wbwln001"; break; case 18: sItem = "nw_wthmax002"; break; case 19: sItem = "nw_wbwmsh002"; break; case 9: sItem = "nw_wbwmln002"; break; } } else if (GetRange(3, nHD)) // * 200 - 2500 { int nRandom = Random(19) + 1; switch (nRandom) { case 1: sItem = "nw_wthmax002"; break; case 2: sItem = "nw_wbwmsh002"; break; case 3: sItem = "nw_wbwmln002"; break; case 4: sItem = "nw_wblmhl002"; break; case 5: sItem = "nw_waxmhn002"; break; case 6: sItem = "nw_wblmfl002"; break; case 7: sItem = "nw_waxmbt002"; break; case 8: sItem = "nw_wplmhb002"; break; case 9: sItem = "nw_wblmhw002"; break; //case 10: sItem = "nw_wblmfh002"; break; case 11: sItem = "nw_wswmls002"; break; case 12: sItem = "nw_wswmsc002"; break; case 13: sItem = "nw_waxmgr002"; break; case 14: sItem = "nw_wswmrp002"; break; case 15: sItem = "nw_wswmbs002"; break; case 16: sItem = "nw_wswmgs002"; break; case 17: sItem = "nw_wthmax008"; break; case 18: sItem = "nw_wbwmsh008"; break; case 19: sItem = "nw_wbwmln008"; break; case 10: sItem = "nw_wswmss002"; break; } } else if (GetRange(4, nHD)) // * 800 - 10000 { int nRandom = Random(31) + 1; switch (nRandom) { case 1: sItem = "nw_wblmhl002"; break; case 2: sItem = "nw_waxmhn002"; break; case 3: sItem = "nw_wblmfl002"; break; case 4: sItem = "nw_waxmbt002"; break; case 5: sItem = "nw_wplmhb002"; break; case 6: sItem = "nw_wblmhw002"; break; //case 7: sItem = "nw_wblmfh002"; break; case 8: sItem = "nw_wswmls002"; break; case 9: sItem = "nw_wswmsc002"; break; case 10: sItem = "nw_waxmgr002"; break; case 11: sItem = "nw_wswmrp002"; break; case 12: sItem = "nw_wswmbs002"; break; case 13: sItem = "nw_wswmgs002"; break; case 14: sItem = "nw_wthmax008"; break; case 15: sItem = "nw_wbwmsh008"; break; case 16: sItem = "nw_wbwmln008"; break; case 17: sItem = "nw_wbwmsh009"; break; case 18: sItem = "nw_wbwmln009"; break; case 19: sItem = "nw_wblmhl010"; break; case 20: sItem = "nw_waxmhn010"; break; case 21: sItem = "nw_wblmfl010"; break; case 22: sItem = "nw_waxmbt010"; break; case 23: sItem = "nw_wplmhb010"; break; case 24: sItem = "nw_wblmhw011"; break; //case 25: sItem = "nw_wblmfh010"; break; case 26: sItem = "nw_wswmls010"; break; case 27: sItem = "nw_waxmgr009"; break; case 28: sItem = "nw_wswmbs009"; break; case 29: sItem = "nw_wswmgs011"; break; case 30: sItem = "nw_wswmrp010"; break; case 31: sItem = "nw_wswmsc010"; break; case 25: sItem = "nw_wswmss002"; break; case 7: sItem = "nw_wswmss009"; break; } } else if (GetRange(5, nHD)) // * 2500 - 16500 { int nRandom = Random(19) + 1; switch (nRandom) { case 1: sItem = "nw_wbwmsh009"; break; case 2: sItem = "nw_wbwmln009"; break; case 3: sItem = "nw_wblmhl010"; break; case 4: sItem = "nw_waxmhn010"; break; case 5: sItem = "nw_wblmfl010"; break; case 6: sItem = "nw_waxmbt010"; break; case 7: sItem = "nw_wplmhb010"; break; case 8: sItem = "nw_wblmhw011"; break; //case 9: sItem = "nw_wblmfh010"; break; case 10: sItem = "nw_wswmls010"; break; case 11: sItem = "nw_waxmgr009"; break; case 12: sItem = "nw_wswmbs009"; break; case 13: sItem = "nw_wswmgs011"; break; case 14: sItem = "nw_wthmax009"; break; case 15: sItem = "nw_wswmrp010"; break; case 16: sItem = "nw_wswmrp011"; break; case 17: sItem = "nw_wswmsc010"; break; case 18: sItem = "nw_wswmss009"; break; case 19: sItem = "nw_wswmsc011"; break; case 9: sItem = "nw_wswmss011"; break; } } else if (GetRange(6, nHD)) // * 8000 - 25000 { int nRandom = Random(13) + 1; switch (nRandom) { case 1: sItem = "nw_wthmax009"; break; case 2: sItem = "nw_waxmhn011"; break; case 3: sItem = "nw_wblmfl011"; break; case 4: sItem = "nw_waxmbt011"; break; case 5: sItem = "nw_wplmhb011"; break; case 6: sItem = "nw_wblmhw012"; break; //case 7: sItem = "nw_wblmfh011"; break; case 8: sItem = "nw_wswmls012"; break; case 9: sItem = "nw_waxmgr011"; break; case 10: sItem = "nw_wswmbs010"; break; case 11: sItem = "nw_wswmgs012"; break; case 12: sItem = "nw_wswmrp011"; break; case 13: sItem = "nw_wswmsc011"; break; case 7: sItem = "nw_wswmss011"; break; } } //dbSpeak("Create Generic Martial"); dbCreateItemOnObject(sItem, oTarget, 1); } void CreateGenericExotic(object oTarget, object oAdventurer, int nModifier = 0) { string sItem = ""; int nHD = GetHitDice(oAdventurer) + nModifier; if (GetRange(1, nHD)) // * 200 { int nRandom = Random(7) + 1; switch (nRandom) { case 1: sItem = "nw_wthsh001"; break; case 2: sItem = "nw_wspka001"; break; case 3: sItem = "nw_wspku001"; break; case 4: sItem = "nw_wplsc001"; break; //case 5: sItem = "nw_wdbax001"; break; case 6: sItem = "nw_wdbma001"; break; case 7: sItem = "nw_wswka001"; break; case 5: sItem = "nw_wthmsh002"; break; //case 5: sItem = "nw_wdbsw001"; break; } } else if (GetRange(2, nHD)) // * 800 { int nRandom = Random(13) + 1; switch (nRandom) { case 1: sItem = "nw_wthsh001"; break; case 2: sItem = "nw_wspka001"; break; case 3: sItem = "nw_wspku001"; break; case 4: sItem = "nw_wplsc001"; break; //case 5: sItem = "nw_wdbax001"; break; case 6: sItem = "nw_wdbma001"; break; case 7: sItem = "nw_wswka001"; break; case 8: sItem = "nw_wthmsh002"; break; //case 9: sItem = "nw_wdbsw001"; break; case 10: sItem = "nw_wthmsh005"; break; case 11: sItem = "nw_wspmka002"; break; case 12: sItem = "nw_wspmku002"; break; case 13: sItem = "nw_wplmsc002"; break; //case 14: sItem = "nw_wdbmax002"; break; case 5: sItem = "nw_wdbmma002"; break; case 9: sItem = "nw_wswmka002"; break; //case 5: sItem = "nw_wdbmsw002"; break; } } else if (GetRange(3, nHD)) // * 200 - 2500 { int nRandom = Random(6) + 1; switch (nRandom) { //case 1: sItem = "nw_wdbsw001"; break; case 2: sItem = "nw_wthmsh005"; break; case 3: sItem = "nw_wspmka002"; break; case 4: sItem = "nw_wspmku002"; break; case 5: sItem = "nw_wplmsc002"; break; //case 6: sItem = "nw_wdbmax002"; break; case 1: sItem = "nw_wdbmma002"; break; case 6: sItem = "nw_wswmka002"; break; //case 6: sItem = "nw_wdbmsw002"; break; } } else if (GetRange(4, nHD)) // * 800 - 10000 { int nRandom = Random(13) + 1; switch (nRandom) { case 1: sItem = "nw_wthmsh005"; break; case 2: sItem = "nw_wspmka002"; break; case 3: sItem = "nw_wspmku002"; break; case 4: sItem = "nw_wplmsc002"; break; //case 5: sItem = "nw_wdbmax002"; break; case 6: sItem = "nw_wdbmma002"; break; case 7: sItem = "nw_wswmka002"; break; //case 8: sItem = "nw_wdbmsw002"; break; case 9: sItem = "nw_wthmsh008"; break; case 10: sItem = "nw_wspmka008"; break; case 11: sItem = "nw_wspmku008"; break; case 12: sItem = "nw_wplmsc010"; break; //case 13: sItem = "nw_wdbmax010"; break; case 13: sItem = "nw_wdbmma010"; break; case 8: sItem = "nw_wswmka010"; break; //case 13: sItem = "nw_wdbmsw010"; break; case 5: sItem = "nw_wthmsh009"; break; } } else if (GetRange(5, nHD)) // * 2500 - 16500 { int nRandom = Random(10) + 1; switch (nRandom) { case 1: sItem = "nw_wspmka008"; break; case 2: sItem = "nw_wspmku008"; break; case 3: sItem = "nw_wplmsc010"; break; //case 4: sItem = "nw_wdbmax010"; break; case 5: sItem = "nw_wdbmma010"; break; case 6: sItem = "nw_wswmka010"; break; //case 7: sItem = "nw_wdbmsw010"; break; case 8: sItem = "nw_wthmsh009"; break; case 9: sItem = "nw_wspmka009"; break; case 10: sItem = "nw_wspmku009"; break; case 7: sItem = "nw_wplmsc011"; break; //case 12: sItem = "nw_wdbmax011"; break; case 4: sItem = "nw_wdbmma011"; break; } } else if (GetRange(6, nHD)) // * 8000 - 25000 { int nRandom = Random(6) + 1; switch (nRandom) { //case 1: sItem = "nw_wdbmsw010"; break; case 2: sItem = "nw_wthmsh009"; break; case 3: sItem = "nw_wspmka009"; break; case 4: sItem = "nw_wspmku009"; break; case 5: sItem = "nw_wplmsc011"; break; //case 6: sItem = "nw_wdbmax011"; break; case 6: sItem = "nw_wdbmma011"; break; case 1: sItem = "nw_wswmka011"; break; //case 6: sItem = "nw_wdbmsw011"; break; } } //dbSpeak("Create generic exotic"); dbCreateItemOnObject(sItem, oTarget, 1); } void CreateGenericLightArmor(object oTarget, object oAdventurer, int nModifier = 0) { string sItem = ""; int nHD = GetHitDice(oAdventurer) + nModifier; if (GetRange(1, nHD)) // * 200 { int nRandom = Random(5) + 1; switch (nRandom) { case 1: sItem = "nw_aarcl009"; break; case 2: sItem = "nw_ashsw001"; break; case 3: sItem = "nw_aarcl001"; break; case 4: sItem = "nw_aarcl002"; break; case 5: sItem = "nw_aarcl012"; break; } } else if (GetRange(2, nHD)) // * 800 { int nRandom = Random(9) + 1; switch (nRandom) { case 1: sItem = "nw_aarcl009"; break; case 2: sItem = "nw_ashsw001"; break; case 3: sItem = "nw_aarcl001"; break; case 4: sItem = "nw_aarcl002"; break; case 5: sItem = "nw_aarcl012"; break; case 6: sItem = "nw_maarcl043"; break; case 7: sItem = "nw_ashmsw002"; break; case 8: sItem = "nw_maarcl044"; break; case 9: sItem = "nw_maarcl045"; break; } } else if (GetRange(3, nHD)) // * 200 - 2500 { int nRandom = Random(8) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl043"; break; case 2: sItem = "nw_ashmsw002"; break; case 3: sItem = "nw_maarcl044"; break; case 4: sItem = "nw_maarcl045"; break; case 5: sItem = "nw_maarcl072"; break; case 6: sItem = "nw_ashmsw008"; break; case 7: sItem = "nw_maarcl071"; break; case 8: sItem = "nw_maarcl075"; break; } } else if (GetRange(4, nHD)) // * 800 - 10000 { int nRandom = Random(9) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl072"; break; case 2: sItem = "nw_ashmsw008"; break; case 3: sItem = "nw_maarcl071"; break; case 4: sItem = "nw_maarcl075"; break; case 5: sItem = "nw_maarcl084"; break; case 6: sItem = "nw_ashmsw009"; break; case 7: sItem = "nw_maarcl083"; break; case 8: sItem = "nw_maarcl087"; break; case 9: sItem = "nw_maarcl079"; break; } } else if (GetRange(5, nHD)) // * 2500 - 16500 { int nRandom = Random(5) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl084"; break; case 2: sItem = "nw_ashmsw009"; break; case 3: sItem = "nw_maarcl083"; break; case 4: sItem = "nw_maarcl087"; break; case 5: sItem = "nw_maarcl079"; break; } } else if (GetRange(6, nHD)) // * 8000 - 25000 { int nRandom = Random(5) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl084"; break; case 2: sItem = "nw_ashmsw009"; break; case 3: sItem = "nw_maarcl083"; break; case 4: sItem = "nw_maarcl087"; break; case 5: sItem = "nw_maarcl079"; break; } } //dbSpeak("Create Generic light"); dbCreateItemOnObject(sItem, oTarget, 1); } void CreateGenericMediumArmor(object oTarget, object oAdventurer, int nModifier = 0) { int nHD = GetHitDice(oAdventurer) + nModifier; string sItem = ""; if (GetRange(1, nHD)) // * 200 { int nRandom = Random(10) + 1; switch (nRandom) { case 1: sItem = "nw_arhe001"; break; case 2: sItem = "nw_arhe002"; break; case 3: sItem = "nw_arhe003"; break; case 4: sItem = "nw_arhe004"; break; case 5: sItem = "nw_arhe005"; break; case 6: sItem = "nw_aarcl008"; break; case 7: sItem = "nw_ashlw001"; break; case 8: sItem = "nw_aarcl003"; break; case 9: sItem = "nw_aarcl004"; break; case 10: sItem = "nw_aarcl010"; break; } } else if (GetRange(2, nHD)) // * 800 { int nRandom = Random(16) + 1; switch (nRandom) { case 1: sItem = "nw_arhe001"; break; case 2: sItem = "nw_arhe002"; break; case 3: sItem = "nw_arhe003"; break; case 4: sItem = "nw_arhe004"; break; case 5: sItem = "nw_arhe005"; break; case 6: sItem = "nw_aarcl008"; break; case 7: sItem = "nw_ashlw001"; break; case 8: sItem = "nw_aarcl003"; break; case 9: sItem = "nw_aarcl004"; break; case 10: sItem = "nw_aarcl010"; break; case 11: sItem = "nw_maarcl047"; break; case 12: sItem = "nw_ashmlw002"; break; case 13: sItem = "nw_maarcl046"; break; case 14: sItem = "nw_maarcl048"; break; case 15: sItem = "nw_maarcl035"; break; case 16: sItem = "nw_maarcl049"; break; //case 17: sItem = "nw_maarcl050"; break; } } else if (GetRange(3, nHD)) // * 200 - 2500 { int nRandom = Random(8) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl047"; break; case 2: sItem = "nw_ashmlw002"; break; case 3: sItem = "nw_maarcl046"; break; case 4: sItem = "nw_maarcl048"; break; case 5: sItem = "nw_maarcl035"; break; case 6: sItem = "nw_maarcl049"; break; //case 7: sItem = "nw_maarcl050"; break; case 8: sItem = "nw_maarcl070"; break; case 7: sItem = "nw_ashmlw008"; break; } } else if (GetRange(4, nHD)) // * 800 - 10000 { int nRandom = Random(13) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl035"; break; case 2: sItem = "nw_maarcl049"; break; //case 3: sItem = "nw_maarcl050"; break; case 4: sItem = "nw_maarcl070"; break; case 5: sItem = "nw_ashmlw008"; break; case 6: sItem = "nw_maarcl067"; break; case 7: sItem = "nw_maarcl073"; break; case 8: sItem = "nw_maarcl065"; break; case 9: sItem = "nw_maarcl066"; break; case 10: sItem = "nw_maarcl082"; break; case 11: sItem = "nw_ashmlw009"; break; case 12: sItem = "nw_maarcl085"; break; case 13: sItem = "nw_maarcl077"; break; case 3: sItem = "nw_maarcl078"; break; } } else if (GetRange(5, nHD)) // * 2500 - 16500 { int nRandom = Random(11) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl070"; break; case 2: sItem = "nw_ashmlw008"; break; case 3: sItem = "nw_maarcl067"; break; case 4: sItem = "nw_maarcl073"; break; case 5: sItem = "nw_maarcl065"; break; case 6: sItem = "nw_maarcl066"; break; case 7: sItem = "nw_maarcl082"; break; case 8: sItem = "nw_ashmlw009"; break; case 9: sItem = "nw_maarcl085"; break; case 10: sItem = "nw_maarcl077"; break; case 11: sItem = "nw_maarcl078"; break; } } else if (GetRange(6, nHD)) // * 8000 - 25000 { int nRandom = Random(11) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl070"; break; case 2: sItem = "nw_ashmlw008"; break; case 3: sItem = "nw_maarcl067"; break; case 4: sItem = "nw_maarcl073"; break; case 5: sItem = "nw_maarcl065"; break; case 6: sItem = "nw_maarcl066"; break; case 7: sItem = "nw_maarcl082"; break; case 8: sItem = "nw_ashmlw009"; break; case 9: sItem = "nw_maarcl085"; break; case 10: sItem = "nw_maarcl077"; break; case 11: sItem = "nw_maarcl078"; break; } } //dbSpeak("Create Generic medium"); dbCreateItemOnObject(sItem, oTarget, 1); } void CreateGenericHeavyArmor(object oTarget, object oAdventurer, int nModifier = 0) { string sItem = ""; int nHD = GetHitDice(oAdventurer) + nModifier; if (GetRange(1, nHD)) // * 200 { int nRandom = Random(2) + 1; switch (nRandom) { case 1: sItem = "nw_ashto001"; break; //case 2: sItem = "nw_aarcl005"; break; case 2: sItem = "nw_aarcl011"; break; } } else if (GetRange(2, nHD)) // * 800 { int nRandom = Random(5) + 1; switch (nRandom) { case 1: sItem = "nw_ashto001"; break; //case 2: sItem = "nw_aarcl005"; break; case 3: sItem = "nw_aarcl011"; break; case 4: sItem = "nw_aarcl006"; break; case 5: sItem = "nw_ashmto002"; break; case 2: sItem = "nw_maarcl051"; break; } } else if (GetRange(3, nHD)) // * 200 - 2500 { int nRandom = Random(8) + 1; switch (nRandom) { //case 1: sItem = "nw_aarcl005"; break; case 2: sItem = "nw_aarcl011"; break; case 3: sItem = "nw_aarcl006"; break; case 4: sItem = "nw_ashmto002"; break; case 5: sItem = "nw_maarcl051"; break; case 6: sItem = "nw_maarcl052"; break; case 7: sItem = "nw_aarcl007"; break; case 8: sItem = "nw_maarcl053"; break; case 1: sItem = "nw_ashmto008"; break; } } else if (GetRange(4, nHD)) // * 800 - 10000 { int nRandom = Random(13) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl051"; break; case 2: sItem = "nw_maarcl052"; break; case 3: sItem = "nw_aarcl007"; break; case 4: sItem = "nw_maarcl053"; break; case 5: sItem = "nw_ashmto008"; break; case 6: sItem = "nw_maarcl064"; break; // case 7: sItem = "nw_maarcl074"; break; case 8: sItem = "nw_maarcl069"; break; case 9: sItem = "nw_maarcl068"; break; case 10: sItem = "nw_ashmto003"; break; case 11: sItem = "nw_ashmto009"; break; case 12: sItem = "nw_maarcl076"; break; //case 13: sItem = "nw_maarcl086"; break; case 13: sItem = "nw_maarcl081"; break; case 7: sItem = "nw_maarcl080"; break; } } else if (GetRange(5, nHD)) // * 2500 - 16500 { int nRandom = Random(8) + 1; switch (nRandom) { case 1: sItem = "nw_ashmto008"; break; case 2: sItem = "nw_maarcl064"; break; // case 3: sItem = "nw_maarcl074"; break; case 4: sItem = "nw_maarcl069"; break; case 5: sItem = "nw_maarcl068"; break; case 6: sItem = "nw_ashmto009"; break; case 7: sItem = "nw_maarcl076"; break; //case 8: sItem = "nw_maarcl086"; break; case 8: sItem = "nw_maarcl081"; break; case 3: sItem = "nw_maarcl080"; break; } } else if (GetRange(6, nHD)) // * 8000 - 25000 { int nRandom = Random(4) + 1; switch (nRandom) { case 1: sItem = "nw_ashmto009"; break; case 2: sItem = "nw_maarcl076"; break; //case 3: sItem = "nw_maarcl086"; break; case 4: sItem = "nw_maarcl081"; break; case 3: sItem = "nw_maarcl080"; break; } } // dbSpeak("Create Generic heavy"); dbCreateItemOnObject(sItem, oTarget, 1); } // * // * SPECIC TREASURE ITEMS (re: Named Items) // * void CreateSpecificMiscItem(object oTarget,object oAdventurer) { string sItem = ""; int nHD = GetHitDice(oAdventurer); if (GetRange(1, nHD)) // * 800 { CreateGenericMiscItem(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(2, nHD)) // * 200 - 2500 { int nRandom = Random(3) + 1; switch (nRandom) { case 1: CreateGenericMiscItem(oTarget, oAdventurer, JUMP_LEVEL); return; break; case 2: sItem = "nw_maarcl057"; break; case 3: sItem = "nw_it_mbelt005"; break; } } else if (GetRange(3, nHD)) // * 800 - 10000 { int nRandom = Random(11) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl057"; break; case 2: sItem = "nw_it_mbelt005"; break; case 3: sItem = "nw_maarcl101"; break; case 4: sItem = "nw_maarcl102"; break; case 5: sItem = "nw_maarcl103"; break; case 6: sItem = "nw_it_mglove001"; break; case 7: sItem = "nw_maarcl100"; break; //case 8: sItem = "nw_it_mbracer011"; break; case 9: sItem = "nw_it_mmidmisc04"; break; case 10: sItem = "nw_it_mring003"; break; case 11: sItem = "nw_it_mbelt006"; break; case 8: sItem = "nw_it_mbelt002"; break; // case 13: sItem = "nw_it_mmidmisc03"; break; } } else if (GetRange(4, nHD)) // * 2500 - 16500 { int nRandom = Random(17) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl101"; break; case 2: sItem = "nw_maarcl101"; break; case 3: sItem = "nw_maarcl102"; break; case 4: sItem = "nw_maarcl103"; break; case 5: sItem = "nw_it_mglove001"; break; case 6: sItem = "nw_maarcl100"; break; //case 7: sItem = "nw_it_mbracer011"; break; case 8: sItem = "nw_it_mmidmisc04"; break; case 9: sItem = "nw_it_mring003"; break; case 10: sItem = "nw_it_mbelt006"; break; case 11: sItem = "nw_it_mbelt002"; break; // case 12: sItem = "nw_it_mmidmisc03"; break; case 13: sItem = "nw_it_mring002"; break; case 14: sItem = "nw_it_mbelt004"; break; case 15: sItem = "nw_it_mring005"; break; case 16: sItem = "nw_it_mboots005"; break; case 17: sItem = "nw_it_mring007"; break; case 7: sItem = "nw_it_mneck003"; break; case 12: sItem = "nw_it_mbelt007"; break; } } else if (GetRange(5, nHD)) // * 8000 - 25000 { int nRandom = Random(14) + 1; switch (nRandom) { case 1: sItem = "nw_it_mbelt002"; break; case 2: sItem = "nw_it_mbelt002"; break; //case 3: sItem = "nw_it_mmidmisc03"; break; case 4: sItem = "nw_it_mring002"; break; case 5: sItem = "nw_it_mbelt004"; break; case 6: sItem = "nw_it_mring005"; break; case 7: sItem = "nw_it_mboots005"; break; case 8: sItem = "nw_it_mring007"; break; case 9: sItem = "nw_it_mneck003"; break; case 10: sItem = "nw_it_mbelt007"; break; case 11: sItem = "nw_it_mboots004"; break; case 12: sItem = "nw_it_mboots003"; break; case 13: sItem = "nw_it_mneck005"; break; case 14: sItem = "nw_it_mbelt008"; break; case 3: sItem = "nw_it_mring020"; break; } } else if (GetRange(6, nHD)) // * 16000 and up { int nRandom = Random(18) + 1; switch (nRandom) { case 1: sItem = "nw_it_mboots004"; break; case 2: sItem = "nw_it_mboots004"; break; case 3: sItem = "nw_it_mboots003"; break; case 4: sItem = "nw_it_mneck005"; break; case 5: sItem = "nw_it_mbelt008"; break; case 6: sItem = "nw_it_mring020"; break; case 7: sItem = "nw_it_mbelt001"; break; case 8: sItem = "nw_it_mring017"; break; case 9: sItem = "nw_mcloth001"; break; case 10: sItem = "nw_it_mneck019"; break; case 11: sItem = "nw_it_mneck002"; break; case 12: sItem = "nw_it_mneck004"; break; // case 13: sItem = "nw_it_mmidmisc01"; break; case 14: sItem = "nw_mcloth002"; break; case 15: sItem = "nw_mcloth003"; break; case 16: sItem = "nw_mcloth004"; break; case 17: sItem = "nw_it_mbelt003"; break; // * new items case 18: sItem = "NW_IT_MBELT020"; break; case 13: sItem = "NW_IT_MBELT021"; break; } } dbCreateItemOnObject(sItem, oTarget, 1); } void CreateSpecificRodStaffWand(object oTarget, object oAdventurer) { string sItem = ""; int nHD = GetHitDice(oAdventurer); if (GetRange(1, nHD)) // * 800 { CreateGenericRodStaffWand(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(2, nHD)) // * 200 - 2500 { CreateGenericRodStaffWand(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(3, nHD)) // * 800 - 10000 { int nRandom = Random(4) + 1; switch (nRandom) { case 1: sItem = "nw_wmgst004"; break; case 2: sItem = "nw_wmgst006"; break; case 3: sItem = "nw_wmgmrd003"; break; case 4: sItem = "nw_wmgst004"; break; } } else if (GetRange(4, nHD)) // * 2500 - 16500 { int nRandom = Random(7) + 1; switch (nRandom) { case 1: sItem = "nw_wmgmrd003"; break; case 2: sItem = "nw_wmgst006"; break; case 3: sItem = "nw_wmgmrd003"; break; case 4: sItem = "nw_wmgst004"; break; case 5: sItem = "nw_wmgst005"; break; case 6: sItem = "nw_wmgmrd004"; break; case 7: sItem = "nw_wmgrd002"; break; } } else if (GetRange(5, nHD)) // * 8000 - 25000 { int nRandom = Random(8) + 1; switch (nRandom) { case 1: sItem = "nw_wblmcl012"; break; case 2: sItem = "nw_wmgmrd003"; break; case 3: sItem = "nw_wmgst004"; break; case 4: sItem = "nw_wmgst005"; break; case 5: sItem = "nw_wblmcl012"; break; case 6: sItem = "nw_wmgmrd004"; break; case 7: sItem = "nw_wmgst002"; break; case 8: sItem = "nw_wmgmrd005"; break; } } else if (GetRange(6, nHD)) // * 16000 and up { int nRandom = Random(6) + 1; switch (nRandom) { case 1: sItem = "nw_wmgmrd004"; break; case 2: sItem = "nw_wmgst002"; break; case 3: sItem = "nw_wmgmrd005"; break; case 4: sItem = "nw_wmgmrd002"; break; case 5: sItem = "nw_wmgst003"; break; case 6: sItem = "nw_wblmcl012"; break; } } dbCreateItemOnObject(sItem, oTarget, 1); } |
Code: |
void CreateSpecificSimple(object oTarget, object oAdventurer)
{ string sItem = ""; int nHD = GetHitDice(oAdventurer); if (GetRange(1, nHD)) // * 800 { CreateGenericSimple(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(2, nHD)) // * 200 - 2500 { CreateGenericSimple(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(3, nHD)) // * 800 - 10000 { int nRandom = Random(9) + 1; switch (nRandom) { case 1: sItem = "nw_wdbmqs005"; break; case 2: sItem = "nw_wdbmqs005"; break; case 3: sItem = "nw_wdbmqs006"; break; case 4: sItem = "nw_wbwmxh005"; break; case 5: sItem = "nw_wbwmxl005"; break; case 6: sItem = "nw_wswmdg006"; break; case 7: sItem = "nw_wblmml006"; break; case 8: sItem = "nw_wspmsc004"; break; case 9: sItem = "nw_wblmms007"; break; } } else if (GetRange(4, nHD)) // * 2500 - 16500 { int nRandom = Random(21) + 1; switch (nRandom) { case 1: sItem = "nw_wdbmqs006"; break; case 2: sItem = "nw_wdbmqs005"; break; case 3: sItem = "nw_wdbmqs006"; break; case 4: sItem = "nw_wbwmxh005"; break; case 5: sItem = "nw_wbwmxl005"; break; case 6: sItem = "nw_wswmdg006"; break; case 7: sItem = "nw_wblmml006"; break; case 8: sItem = "nw_wspmsc004"; break; case 9: sItem = "nw_wblmms007"; break; case 10: sItem = "nw_wblmms003"; break; case 11: sItem = "nw_wblmcl004"; break; case 12: sItem = "nw_wspmsc006"; break; case 13: sItem = "nw_wspmsc006"; break; case 14: sItem = "nw_wdbmqs004"; break; case 15: sItem = "nw_wblmcl003"; break; case 16: sItem = "nw_wbwmsl003"; break; case 17: sItem = "nw_wbwmxh003"; break; //case 18: sItem = "nw_wspmsc003"; break; case 19: sItem = "nw_wplmss005"; break; case 20: sItem = "nw_wplmss005"; break; case 21: sItem = "nw_wbwmxl003"; break; case 18: sItem = "nw_wblmml004"; break; } } else if (GetRange(5, nHD)) // * 8000 - 25000 { int nRandom = Random(26) + 1; switch (nRandom) { case 1: sItem = "nw_wblmms003"; break; case 2: sItem = "nw_wblmms003"; break; case 3: sItem = "nw_wblmcl004"; break; case 4: sItem = "nw_wspmsc006"; break; case 5: sItem = "nw_wspmsc006"; break; case 6: sItem = "nw_wdbmqs004"; break; case 7: sItem = "nw_wblmcl003"; break; case 8: sItem = "nw_wbwmsl003"; break; case 9: sItem = "nw_wbwmxh003"; break; //case 10: sItem = "nw_wspmsc003"; break; case 11: sItem = "nw_wplmss005"; break; case 12: sItem = "nw_wplmss005"; break; case 13: sItem = "nw_wbwmxl003"; break; case 14: sItem = "nw_wblmml004"; break; case 15: sItem = "nw_wdbmqs003"; break; case 16: sItem = "nw_wbwmxl004"; break; case 17: sItem = "nw_wbwmxl007"; break; case 18: sItem = "nw_wblmml005"; break; case 19: sItem = "nw_wblmcl005"; break; case 20: sItem = "nw_wplmss007"; break; case 21: sItem = "nw_wswmdg004"; break; case 22: sItem = "nw_wbwmsl007"; break; case 23: sItem = "nw_wblmml007"; break; case 24: sItem = "nw_wblmml007"; break; case 25: sItem = "nw_wbwmxh004"; break; case 26: sItem = "nw_wplmss006"; break; case 10: sItem = "nw_wbwmxh007"; break; } } else if (GetRange(6, nHD)) // * 16000 and up { int nRandom = Random(31) + 1; switch (nRandom) { case 1: sItem = "nw_wbwmxl003"; break; case 2: sItem = "nw_wbwmxl003"; break; case 3: sItem = "nw_wblmml004"; break; case 4: sItem = "nw_wdbmqs003"; break; case 5: sItem = "nw_wbwmxl004"; break; case 6: sItem = "nw_wbwmxl007"; break; case 7: sItem = "nw_wblmml005"; break; case 8: sItem = "nw_wblmcl005"; break; case 9: sItem = "nw_wplmss007"; break; case 10: sItem = "nw_wswmdg004"; break; case 11: sItem = "nw_wbwmsl007"; break; case 12: sItem = "nw_wblmml007"; break; case 13: sItem = "nw_wblmml007"; break; case 14: sItem = "nw_wbwmxh004"; break; case 15: sItem = "nw_wplmss006"; break; case 16: sItem = "nw_wbwmxh007"; break; case 17: sItem = "nw_wblmms006"; break; case 18: sItem = "nw_wswmdg003"; break; case 19: sItem = "nw_wswmdg007"; break; case 20: sItem = "nw_wblmms004"; break; case 21: sItem = "nw_wbwmsl006"; break; case 22: sItem = "nw_wbwmsl008"; break; case 23: sItem = "nw_wblmml008"; break; case 24: sItem = "nw_wdbmqs007"; break; case 25: sItem = "nw_wblmcl006"; break; case 26: sItem = "nw_wbwmsl004"; break; case 27: sItem = "nw_wbwmxh006"; break; case 28: sItem = "nw_wplmss004"; break; case 29: sItem = "nw_wswmdg005"; break; case 30: sItem = "nw_wbwmxl006"; break; case 31: sItem = "nw_wspmsc005"; break; } } dbCreateItemOnObject(sItem, oTarget, 1); } void CreateSpecificMartial(object oTarget, object oAdventurer) { string sItem = ""; int nHD = GetHitDice(oAdventurer); if (GetRange(1, nHD)) // * 800 { CreateGenericMartial(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(2, nHD)) // * 200 - 2500 { int nRandom = Random(3) + 1; switch (nRandom) { case 1: CreateGenericMartial(oTarget, oAdventurer, JUMP_LEVEL); return; break; case 2: sItem = "nw_wthmax005"; break; case 3: sItem = "nw_wthmax007"; break; } } else if (GetRange(3, nHD)) // * 800 - 10000 { int nRandom = Random(14) + 1; switch (nRandom) { case 1: sItem = "nw_wthmax003"; break; case 2: sItem = "nw_wthmax005"; break; case 3: sItem = "nw_wthmax007"; break; case 4: sItem = "nw_wthmax003"; break; case 5: sItem = "nw_wthmax004"; break; case 6: sItem = "nw_wthmax006"; break; case 7: sItem = "nw_wswmrp004"; break; case 8: sItem = "nw_wswmrp004"; break; case 9: sItem = "nw_wblmfl004"; break; case 10: sItem = "nw_wblmhl004"; break; case 11: sItem = "nw_wbwmsh003"; break; case 12: sItem = "nw_wblmhw006"; break; case 13: sItem = "nw_wblmhw006"; break; case 14: sItem = "nw_wbwmln004"; break; } } else if (GetRange(4, nHD)) // * 2500 - 16500 { int nRandom = Random(26) + 1; switch (nRandom) { case 1: sItem = "nw_wblmfl005"; break; case 2: sItem = "nw_wthmax007"; break; case 3: sItem = "nw_wthmax003"; break; case 4: sItem = "nw_wthmax004"; break; case 5: sItem = "nw_wthmax006"; break; case 6: sItem = "nw_wswmrp004"; break; case 7: sItem = "nw_wswmrp004"; break; case 8: sItem = "nw_wblmfl004"; break; case 9: sItem = "nw_wblmhl004"; break; case 10: sItem = "nw_wbwmsh003"; break; case 11: sItem = "nw_wblmhw006"; break; case 12: sItem = "nw_wblmhw006"; break; case 13: sItem = "nw_wbwmln004"; break; case 14: sItem = "nw_wblmfl005"; break; case 15: sItem = "nw_wswmgs006"; break; case 16: sItem = "nw_waxmgr003"; break; case 17: sItem = "nw_wplmhb004"; break; case 18: sItem = "nw_wblmhw005"; break; //case 19: sItem = "nw_wblmfh004"; break; //case 20: sItem = "nw_wblmfh008"; break; case 21: sItem = "nw_wbwmsh006"; break; case 22: sItem = "nw_wswmsc004"; break; case 23: sItem = "nw_waxmgr006"; break; case 24: sItem = "nw_wswmrp005"; break; case 25: sItem = "nw_wswmls007"; break; case 26: sItem = "nw_wswmgs004"; break; case 20: sItem = "nw_waxmhn004"; break; case 19: sItem = "nw_wswmbs005"; break; } } else if (GetRange(5, nHD)) // * 8000 - 25000 { int nRandom = Random(38) + 1; switch (nRandom) { case 1: sItem = "nw_wblmhw006"; break; case 2: sItem = "nw_wblmhw006"; break; case 3: sItem = "nw_wblmhw006"; break; case 4: sItem = "nw_wbwmln004"; break; case 5: sItem = "nw_wblmfl005"; break; case 6: sItem = "nw_wswmgs006"; break; case 7: sItem = "nw_waxmgr003"; break; case 8: sItem = "nw_wplmhb004"; break; case 9: sItem = "nw_wblmhw005"; break; //case 10: sItem = "nw_wblmfh004"; break; //case 11: sItem = "nw_wblmfh008"; break; case 12: sItem = "nw_wbwmsh006"; break; case 13: sItem = "nw_wswmsc004"; break; case 14: sItem = "nw_waxmgr006"; break; case 15: sItem = "nw_wswmrp005"; break; case 16: sItem = "nw_wswmls007"; break; case 17: sItem = "nw_wswmgs004"; break; case 18: sItem = "nw_waxmhn004"; break; case 19: sItem = "nw_wswmbs005"; break; case 20: sItem = "nw_wblmhl005"; break; case 21: sItem = "nw_wblmhl011"; break; case 22: sItem = "nw_wswmss005"; break; case 23: sItem = "nw_wplmhb003"; break; case 24: sItem = "nw_wbwmln007"; break; case 25: sItem = "nw_wbwmln007"; break; case 26: sItem = "nw_wbwmsh007"; break; case 27: sItem = "nw_waxmbt006"; break; case 28: sItem = "nw_wswmbs006"; break; case 29: sItem = "nw_wblmfl007"; break; case 30: sItem = "nw_waxmhn003"; break; case 31: sItem = "nw_wblmhl006"; break; case 32: sItem = "nw_wblmfl006"; break; case 33: sItem = "nw_wswmls005"; break; case 34: sItem = "nw_wswmss004"; break; case 35: sItem = "nw_wbwmln006"; break; case 36: sItem = "nw_wblmhw003"; break; // case 37: sItem = "nw_wblmfh006"; break; case 38: sItem = "nw_wswmsc006"; break; case 11: sItem = "nw_waxmhn005"; break; //case 40: sItem = "nw_wblmfh003"; break; case 10: sItem = "nw_wswmls006"; break; case 37: sItem = "nw_wswmrp007"; break; } } else if (GetRange(6, nHD)) // * 16000 and up { int nRandom = Random(52) + 1; switch (nRandom) { case 1: sItem = "nw_wblmhl005"; break; case 2: sItem = "nw_wblmhl005"; break; case 3: sItem = "nw_wblmhl011"; break; case 4: sItem = "nw_wswmss005"; break; case 5: sItem = "nw_wplmhb003"; break; case 6: sItem = "nw_wbwmln007"; break; case 7: sItem = "nw_wbwmln007"; break; case 8: sItem = "nw_wbwmsh007"; break; case 9: sItem = "nw_waxmbt006"; break; case 10: sItem = "nw_wswmbs006"; break; case 11: sItem = "nw_wblmfl007"; break; case 12: sItem = "nw_waxmhn003"; break; case 13: sItem = "nw_wblmhl006"; break; case 14: sItem = "nw_wblmfl006"; break; case 15: sItem = "nw_wswmls005"; break; case 16: sItem = "nw_wswmss004"; break; case 17: sItem = "nw_wbwmln006"; break; case 18: sItem = "nw_wblmhw003"; break; //case 19: sItem = "nw_wblmfh006"; break; case 20: sItem = "nw_wswmsc006"; break; case 21: sItem = "nw_waxmhn005"; break; //case 22: sItem = "nw_wblmfh003"; break; case 23: sItem = "nw_wswmls006"; break; case 24: sItem = "nw_wswmrp007"; break; case 25: sItem = "nw_wswmgs005"; break; case 26: sItem = "nw_wswmgs005"; break; case 27: sItem = "nw_waxmgr005"; break; case 28: sItem = "nw_wplmhb007"; break; case 29: sItem = "nw_wswmsc007"; break; case 30: sItem = "nw_wswmrp006"; break; case 31: sItem = "nw_wswmss006"; break; case 32: sItem = "nw_wblmhl009"; break; case 33: sItem = "nw_wswmbs007"; break; case 34: sItem = "nw_wbwmln005"; break; // case 35: sItem = "nw_wblmfh005"; break; case 36: sItem = "nw_wswmgs003"; break; case 37: sItem = "nw_waxmbt003"; break; case 38: sItem = "nw_wswmls004"; break; case 39: sItem = "nw_wbwmsh005"; break; case 40: sItem = "nw_wbwmsh005"; break; case 41: sItem = "nw_waxmbt004"; break; case 42: sItem = "nw_waxmbt004"; break; case 43: sItem = "nw_wblmhl003"; break; case 44: sItem = "nw_wblmhl003"; break; case 45: sItem = "nw_wswmbs003"; break; case 46: sItem = "nw_waxmbt005"; break; case 47: sItem = "nw_waxmhn006"; break; case 48: sItem = "nw_wswmss003"; break; case 49: sItem = "nw_wswmsc005"; break; case 50: sItem = "nw_wplmhb006"; break; case 51: sItem = "nw_wbwmsh004"; break; case 52: sItem = "nw_wswmbs004"; break; case 19: sItem = "nw_wbwmln003"; break; case 35: sItem = "nw_wblmhw004"; break; case 22: sItem = "nw_waxmgr004"; break; } } dbCreateItemOnObject(sItem, oTarget, 1); } void CreateSpecificExotic(object oTarget, object oAdventurer) { string sItem = ""; int nHD = GetHitDice(oAdventurer); if (GetRange(1, nHD)) // * 800 { int nRandom = Random(3) + 1; switch (nRandom) { case 1: CreateGenericExotic(oTarget, oAdventurer, JUMP_LEVEL); return; break; case 2: sItem = "nw_wthmsh003"; break; case 3: sItem = "nw_wthmsh006"; break; } } else if (GetRange(2, nHD)) // * 200 - 2500 { int nRandom = Random(5) + 1; switch (nRandom) { case 1: CreateGenericExotic(oTarget, oAdventurer, JUMP_LEVEL); return; break; case 2: sItem = "nw_wthmsh003"; break; case 3: sItem = "nw_wthmsh006"; break; case 4: sItem = "nw_wthmsh004"; break; case 5: sItem = "nw_wthmsh007"; break; } } else if (GetRange(3, nHD)) // * 800 - 10000 { int nRandom = Random(11) + 1; switch (nRandom) { case 1: sItem = "nw_wthmsh006"; break; case 2: sItem = "nw_wthmsh006"; break; case 3: sItem = "nw_wthmsh004"; break; case 4: sItem = "nw_wthmsh007"; break; case 5: sItem = "nw_wspmku006"; break; case 6: sItem = "nw_wdbmma003"; break; case 7: sItem = "nw_wswmka005"; break; case 8: sItem = "nw_wspmka004"; break; case 9: sItem = "nw_wspmka007"; break; //case 10: sItem = "nw_wdbmax006"; break; //case 11: sItem = "nw_wdbmsw006"; break; case 11: sItem = "nw_wspmku005"; break; //case 11: sItem = "nw_wdbmsw007"; break; case 10: sItem = "nw_wspmka005"; break; } } else if (GetRange(4, nHD)) // * 2500 - 16500 { int nRandom = Random(12) + 1; switch (nRandom) { case 1:sItem = "nw_wthmsh007"; break; case 2: sItem = "nw_wthmsh007"; break; case 3: sItem = "nw_wspmku006"; break; case 4: sItem = "nw_wdbmma003"; break; case 5: sItem = "nw_wswmka005"; break; case 6: sItem = "nw_wspmka004"; break; case 7: sItem = "nw_wspmka007"; break; //case 8: sItem = "nw_wdbmax006"; break; //case 9: sItem = "nw_wdbmsw006"; break; case 10: sItem = "nw_wspmku005"; break; //case 11: sItem = "nw_wdbmsw007"; break; case 12: sItem = "nw_wspmka005"; break; case 11: sItem = "nw_wplmsc003"; break; //case 14: sItem = "nw_wdbmax005"; break; case 8: sItem = "nw_wspmku004"; break; case 9: sItem = "nw_wdbmma005"; break; } } else if (GetRange(5, nHD)) // * 8000 - 25000 { int nRandom = Random(13) + 1; switch (nRandom) { case 1: sItem = "nw_wplmsc003"; break; case 2: sItem = "nw_wspmka005"; break; case 3: sItem = "nw_wplmsc003"; break; //case 4: sItem = "nw_wdbmax005"; break; case 5: sItem = "nw_wspmku004"; break; case 6: sItem = "nw_wdbmma005"; break; case 7: sItem = "nw_wdbmma005"; break; // case 8: sItem = "nw_wdbmax004"; break; case 9: sItem = "nw_wdbmma004"; break; case 10: sItem = "nw_wswmka007"; break; //case 11: sItem = "nw_wdbmsw005"; break; case 12: sItem = "nw_wspmka006"; break; case 13: sItem = "nw_wspmka003"; break; //case 14: sItem = "nw_wdbmax007"; break; case 11: sItem = "nw_wplmsc006"; break; case 4: sItem = "nw_wspmku007"; break; case 8: sItem = "nw_wdbmma006"; break; } } else if (GetRange(6, nHD)) // * 16000 and up { int nRandom = Random(17) + 1; switch (nRandom) { case 1: sItem = "nw_wdbmma005"; break; case 2: sItem = "nw_wdbmma005"; break; case 3: sItem = "nw_wdbmma005"; break; // case 4: sItem = "nw_wdbmax004"; break; case 5: sItem = "nw_wdbmma004"; break; case 6: sItem = "nw_wswmka007"; break; //case 7: sItem = "nw_wdbmsw005"; break; case 8: sItem = "nw_wspmka006"; break; case 9: sItem = "nw_wspmka003"; break; //case 10: sItem = "nw_wdbmax007"; break; case 11: sItem = "nw_wplmsc006"; break; case 12: sItem = "nw_wspmku007"; break; case 13: sItem = "nw_wdbmma006"; break; case 14: sItem = "nw_wspmku003"; break; case 15: sItem = "nw_wswmka006"; break; case 16: sItem = "nw_wplmsc005"; break; case 17: sItem = "nw_wplmsc005"; break; case 7: sItem = "nw_wswmka004"; break; case 10: sItem = "nw_wswmka004"; break; //case 10: sItem = "nw_wdbmsw004"; break; case 4: sItem = "nw_wplmsc004"; break; } } dbCreateItemOnObject(sItem, oTarget, 1); } void CreateSpecificLightArmor(object oTarget, object oAdventurer) { string sItem = ""; int nHD = GetHitDice(oAdventurer); if (GetRange(1, nHD)) // * 800 { CreateGenericLightArmor(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(2, nHD)) // * 200 - 2500 { int nRandom = Random(3) + 1; switch (nRandom) { case 1: CreateGenericLightArmor(oTarget, oAdventurer, JUMP_LEVEL); return; break; case 2: sItem = "nw_ashmsw011"; break; case 3: sItem = "nw_ashmsw010"; break; } } else if (GetRange(3, nHD)) // * 800 - 10000 { int nRandom = Random(9) + 1; switch (nRandom) { case 1: sItem = "nw_ashmsw011"; break; case 2: sItem = "nw_ashmsw011"; break; case 3: sItem = "nw_ashmsw010"; break; case 4: sItem = "nw_maarcl011"; break; case 5: sItem = "nw_ashmsw006"; break; case 6: sItem = "nw_maarcl017"; break; case 7: sItem = "nw_ashmsw005"; break; case 8: sItem = "nw_maarcl013"; break; case 9: sItem = "nw_maarcl012"; break; } } else if (GetRange(4, nHD)) // * 2500 - 16500 { int nRandom = Random(13) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl011"; break; case 2: sItem = "nw_maarcl011"; break; case 3: sItem = "nw_ashmsw006"; break; case 4: sItem = "nw_maarcl017"; break; case 5: sItem = "nw_ashmsw005"; break; case 6: sItem = "nw_maarcl013"; break; case 7: sItem = "nw_maarcl012"; break; case 8: sItem = "nw_ashmsw004"; break; case 9: sItem = "nw_maarcl006"; break; case 10: sItem = "nw_maarcl032"; break; case 11: sItem = "nw_maarcl003"; break; case 12: sItem = "nw_maarcl002"; break; case 13: sItem = "nw_maarcl007"; break; } } else if (GetRange(5, nHD)) // * 8000 - 25000 { int nRandom = Random(10) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl012"; break; case 2: sItem = "nw_maarcl012"; break; case 3: sItem = "nw_ashmsw004"; break; case 4: sItem = "nw_maarcl006"; break; case 5: sItem = "nw_maarcl032"; break; case 6: sItem = "nw_maarcl003"; break; case 7: sItem = "nw_maarcl002"; break; //case 8: sItem = "nw_maarcl005"; break; case 9: sItem = "nw_ashmsw003"; break; case 10: sItem = "nw_maarcl001"; break; case 8: sItem = "nw_maarcl034"; break; } } else if (GetRange(6, nHD)) // * 16000 and up { int nRandom = Random(9) + 1; switch (nRandom) { //case 1: sItem = "nw_maarcl005"; break; //case 2: sItem = "nw_maarcl005"; break; case 3: sItem = "nw_ashmsw003"; break; case 4: sItem = "nw_maarcl001"; break; case 5: sItem = "nw_maarcl034"; break; case 6: sItem = "nw_maarcl008"; break; case 7: sItem = "nw_ashmsw007"; break; case 8: sItem = "nw_maarcl033"; break; case 9: sItem = "nw_mcloth005"; break; case 2: sItem = "nw_maarcl009"; break; case 1: sItem = "nw_maarcl004"; break; } } dbCreateItemOnObject(sItem, oTarget, 1); } void CreateSpecificMediumArmor(object oTarget, object oAdventurer) { string sItem = ""; int nHD = GetHitDice(oAdventurer); if (GetRange(1, nHD)) // * 800 { CreateGenericMediumArmor(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(2, nHD)) // * 200 - 2500 { CreateGenericMediumArmor(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(3, nHD)) // * 800 - 10000 { int nRandom = Random(5) + 1; switch (nRandom) { case 1: sItem = "nw_armhe008"; break; case 2: sItem = "nw_armhe008"; break; case 3: sItem = "nw_armhe007"; break; case 4: sItem = "nw_armhe009"; break; case 5: sItem = "nw_armhe010"; break; } } else if (GetRange(4, nHD)) // * 2500 - 16500 { int nRandom = Random(9) + 1; switch (nRandom) { case 1: sItem = "nw_armhe008"; break; case 2: sItem = "nw_armhe008"; break; case 3: sItem = "nw_armhe007"; break; case 4: sItem = "nw_armhe009"; break; case 5: sItem = "nw_armhe010"; break; case 6: sItem = "nw_armhe006"; break; case 7: sItem = "nw_ashmlw007"; break; case 8: sItem = "nw_ashmlw005"; break; case 9: sItem = "nw_maarcl016"; break; } } else if (GetRange(5, nHD)) // * 8000 - 25000 { int nRandom = Random(11) + 1; switch (nRandom) { case 1: sItem = "nw_armhe009"; break; case 2: sItem = "nw_armhe009"; break; case 3: sItem = "nw_armhe010"; break; case 4: sItem = "nw_armhe006"; break; case 5: sItem = "nw_ashmlw007"; break; case 6: sItem = "nw_ashmlw005"; break; case 7: sItem = "nw_maarcl016"; break; case 8: sItem = "nw_maarcl036"; break; case 9: sItem = "nw_ashmlw004"; break; case 10: sItem = "nw_maarcl037"; break; // case 11: sItem = "nw_maarcl040"; break; case 11: sItem = "nw_ashmlw006"; break; } } else if (GetRange(6, nHD)) // * 16000 and up { int nRandom = Random(11) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl016"; break; case 2: sItem = "nw_maarcl016"; break; case 3: sItem = "nw_maarcl036"; break; case 4: sItem = "nw_ashmlw004"; break; case 5: sItem = "nw_maarcl037"; break; //case 6: sItem = "nw_maarcl040"; break; case 7: sItem = "nw_ashmlw006"; break; case 8: sItem = "nw_ashmlw003"; break; case 9: sItem = "nw_maarcl014"; break; case 10: sItem = "nw_maarcl039"; break; case 11: sItem = "nw_maarcl010"; break; case 6: sItem = "nw_maarcl015"; break; } } dbCreateItemOnObject(sItem, oTarget, 1); } void CreateSpecificHeavyArmor(object oTarget, object oAdventurer) { string sItem = ""; int nHD = GetHitDice(oAdventurer); if (GetRange(1, nHD)) // * 800 { CreateGenericHeavyArmor(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(2, nHD)) // * 200 - 2500 { CreateGenericHeavyArmor(oTarget, oAdventurer, JUMP_LEVEL); return; } else if (GetRange(3, nHD)) // * 800 - 10000 { int nRandom = Random(6) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl026"; break; case 2: sItem = "nw_maarcl026"; break; case 3: sItem = "nw_maarcl021"; break; case 4: sItem = "nw_ashmto003"; break; case 5: sItem = "nw_maarcl029"; break; case 6: sItem = "nw_maarcl020"; break; } } else if (GetRange(4, nHD)) // * 2500 - 16500 { int nRandom = Random(12) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl021"; break; case 2: sItem = "nw_maarcl026"; break; case 3: sItem = "nw_maarcl021"; break; case 4: sItem = "nw_ashmto003"; break; case 5: sItem = "nw_maarcl029"; break; case 6: sItem = "nw_maarcl020"; break; case 7: sItem = "nw_ashmto006"; break; // case 8: sItem = "nw_maarcl041"; break; case 9: sItem = "nw_ashmto005"; break; case 10: sItem = "nw_ashmto007"; break; case 11: sItem = "nw_ashmto010"; break; case 12: sItem = "nw_maarcl022"; break; case 8: sItem = "nw_maarcl018"; break; } } else if (GetRange(5, nHD)) // * 8000 - 25000 { int nRandom = Random(12) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl020"; break; case 2: sItem = "nw_maarcl020"; break; case 3: sItem = "nw_ashmto006"; break; //case 4: sItem = "nw_maarcl041"; break; case 5: sItem = "nw_ashmto005"; break; case 6: sItem = "nw_ashmto007"; break; case 7: sItem = "nw_ashmto010"; break; case 8: sItem = "nw_maarcl022"; break; case 9: sItem = "nw_maarcl018"; break; case 10: sItem = "nw_maarcl024"; break; case 11: sItem = "nw_ashmto011"; break; case 12: sItem = "nw_maarcl042"; break; case 4: sItem = "nw_maarcl054"; break; } } else if (GetRange(6, nHD)) // * 16000 and up { int nRandom = Random(10) + 1; switch (nRandom) { case 1: sItem = "nw_maarcl018"; break; case 2: sItem = "nw_maarcl018"; break; case 3: sItem = "nw_maarcl024"; break; case 4: sItem = "nw_ashmto011"; break; case 5: sItem = "nw_maarcl042"; break; case 6: sItem = "nw_maarcl054"; break; case 7: sItem = "nw_ashmto004"; break; case 8: sItem = "nw_maarcl025"; break; case 9: sItem = "nw_maarcl028"; break; case 10: sItem = "nw_maarcl027"; break; } } dbCreateItemOnObject(sItem, oTarget, 1); } // * if nSpecific is = 1 then spawn in 'named' items at the higher levels void CreateTable2Item(object oTarget, object oAdventurer, int nSpecific=0) { //dbSpeak("In CreateTable2Item"); string sItem = ""; int nProbMisc = 0; int nProbClass = 0; int nProbRodStaffWand = 0; int nProbSimple = 0; int nProbMartial = 0; int nProbExotic = 0; int nProbLight = 0; int nProbMedium = 0; int nProbHeavy = 0; int nSpecialRanger = 0; // 2 Means to treat the ranger as a barbarian. A 1 is to treat it as a fighter // * May 2002: Changed using Preston's multiclass function // * it randomly chooses one of your classes int nClass = nDetermineClassToUse(oAdventurer); // * SPECIAL RANGER BEHAVIOR // * If the ranger has the Heavy Armor proficiency, will treat the ranger if ( nClass == CLASS_TYPE_RANGER && GetHasFeat(FEAT_ARMOR_PROFICIENCY_HEAVY)) { nSpecialRanger = 1; } else if (nClass == CLASS_TYPE_RANGER) { nSpecialRanger = 2; } //* SETUP probabilities based on Class if ( nClass == CLASS_TYPE_FIGHTER || nClass == CLASS_TYPE_PALADIN || nSpecialRanger == 1) { //dbSpeak("I am fighter or paladin or heavy ranger"); nProbMisc = 20; nProbClass = 0; nProbRodStaffWand = 5; nProbSimple = 5; nProbMartial = 20; nProbExotic = 10; nProbLight = 5; nProbMedium = 15; nProbHeavy = 20; } else if (nClass == CLASS_TYPE_WIZARD || nClass == CLASS_TYPE_SORCERER) { //dbSpeak("I am wizard or sorcerer"); nProbMisc = 40; nProbClass = 30; nProbRodStaffWand = 15; nProbSimple = 3; nProbMartial = 3; nProbExotic = 3; nProbLight = 2; nProbMedium = 2; nProbHeavy = 2; } else if (nClass == CLASS_TYPE_BARBARIAN || nSpecialRanger == 2) { //dbSpeak("I am barbarian or light ranger"); nProbMisc = 20; nProbClass = 0; nProbRodStaffWand = 5; nProbSimple = 17; nProbMartial = 27; nProbExotic = 15; nProbLight = 8; nProbMedium = 5; nProbHeavy = 3; } else if (nClass == CLASS_TYPE_CLERIC) { //dbSpeak("I am cleric"); nProbMisc = 20; nProbClass = 10; nProbRodStaffWand = 10; nProbSimple = 25; nProbMartial = 7; nProbExotic = 5; nProbLight = 5; nProbMedium = 8; nProbHeavy = 10; } else if (nClass == CLASS_TYPE_DRUID) { //dbSpeak("I am druid"); nProbMisc = 20; nProbClass = 25; nProbRodStaffWand = 15; nProbSimple = 10; nProbMartial = 5; nProbExotic = 5; nProbLight = 10; nProbMedium = 5; nProbHeavy = 5; } else if (nClass == CLASS_TYPE_MONK) { //dbSpeak("I am monk"); nProbMisc = 20; nProbClass = 50; nProbRodStaffWand = 2; nProbSimple = 7; nProbMartial = 2; nProbExotic = 7; nProbLight = 4; nProbMedium = 4; nProbHeavy = 4; } else if (nClass == CLASS_TYPE_ROGUE) { //dbSpeak("I am rogue"); nProbMisc = 25; nProbClass = 10; nProbRodStaffWand = 10; nProbSimple = 25; nProbMartial = 5; nProbExotic = 5; nProbLight = 10; nProbMedium = 5; nProbHeavy = 5; } else if (nClass == CLASS_TYPE_BARD) { //dbSpeak("I am bard"); nProbMisc = 25; nProbClass = 5; nProbRodStaffWand = 5; nProbSimple = 25; nProbMartial = 10; nProbExotic = 10; nProbLight = 10; nProbMedium = 5; nProbHeavy = 5; } //else //{ // dbSpeak("No Valid Class"); //} //dbSpeak("Table2Item: After Class Distribution"); //* Create Items based on Probabilities int nRandom = d100(); if (nRandom <= nProbMisc) { if (nSpecific == 0) CreateGenericMiscItem(oTarget, oAdventurer); else CreateSpecificMiscItem(oTarget, oAdventurer); } else if (nRandom <= nProbMisc + nProbClass) { // * no need for a seperate specific function here CreateGenericClassItem(oTarget, oAdventurer, nSpecific); } else if (nRandom <= nProbMisc + nProbClass + nProbRodStaffWand) { if (nSpecific == 0) CreateGenericRodStaffWand(oTarget, oAdventurer); else CreateSpecificRodStaffWand(oTarget, oAdventurer); } else if (nRandom <= nProbMisc + nProbClass + nProbRodStaffWand + nProbSimple) { if (nSpecific == 0) CreateGenericSimple(oTarget, oAdventurer); else CreateSpecificSimple(oTarget, oAdventurer); } else if (nRandom <= nProbMisc + nProbClass + nProbRodStaffWand + nProbSimple + nProbMartial) { if (nSpecific == 0) CreateGenericMartial(oTarget, oAdventurer); else CreateSpecificMartial(oTarget, oAdventurer); } else if (nRandom <= nProbMisc + nProbClass + nProbRodStaffWand + nProbSimple + nProbMartial + nProbExotic) { if (nSpecific == 0) CreateGenericExotic(oTarget, oAdventurer); else CreateSpecificExotic(oTarget, oAdventurer); } else if (nRandom <= nProbMisc + nProbClass + nProbRodStaffWand + nProbSimple + nProbMartial + nProbExotic + nProbLight) { if (nSpecific == 0) CreateGenericLightArmor(oTarget, oAdventurer); else CreateSpecificLightArmor(oTarget, oAdventurer); } else if (nRandom <= nProbMisc + nProbClass + nProbRodStaffWand + nProbSimple + nProbMartial + nProbExotic + nProbLight + nProbMedium) { if (nSpecific == 0) CreateGenericMediumArmor(oTarget, oAdventurer); else CreateSpecificMediumArmor(oTarget, oAdventurer); } else if (nRandom <= nProbMisc + nProbClass + nProbRodStaffWand + nProbSimple + nProbMartial + nProbExotic + nProbLight + nProbMedium + nProbHeavy) { if (nSpecific == 0) CreateGenericHeavyArmor(oTarget, oAdventurer); else CreateSpecificHeavyArmor(oTarget, oAdventurer); } //else //{ // dbSpeak("Generic Generic or Specific; error: 3524"); //} } //:://///////////////////////////////////////////// //:: GenerateTreasure //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Generate Treasure NOTE: When used by NPCs, the treasure is scaled to how powerful the NPC is. If used by containers, it is scaled by how powerful the PC is. PARAMETERS oLastOpener = The creature that opened the container oCreateOn = The place to put the treasure. If this is invalid then the treasure is placed on oLastOpener |