This isn't really new, it's a revision of a system I saw that ShadoOow posted on the nwvault...
Anyway, here it is, in it's entirety (you will have to code the other Mode Event scripts)
Suggestions?
---------------------------------------------
For some bizarre reason these forums are converting my constants to lower case, also, it' making the "C" a "c" as well, as you notice in this script that it's not posting corectly! Maybe forum moderators should check this out?
---------------------------------------------
// sim_monk_ac (sim = simulated)
////////////////////////////////
// Created by Genisys / Guile
// Co-Created by ShadoOow
// Created / Updated on 5/3/2012
//////////////////////////////////////////////////////////////////////
/*
This script allows the Builder to design a special Monk like
AC Bonus for any class, however, they cannot be wearing a shield!
Because we use SHIELD as the Type of AC Bonus to give to he PC!
Also the PC cannot use any armor that isn't cloth!
This system could be used for a variety of things, like adding a special
styles of Kung Fu to monk class, where they use thier Strength Bonus to AC, for
strength based monks... (Including Wisdom & Dex) Or maybe to alter Ranger
The list goes on an on, however, you can change it to your taste if you script.
This script is fired from multiple scripts, you MUST use the
ExecuteScript("sim_monk_ac", oPC);
Function within your Module Event Scripts to apply the effects!
(should be regained upon OnEnter / OnRest (finished rest!) / Respawn /etc)
You can test this using a Lever's OnUsed Event, just use this...
void main()
{object oPC = GetLastUsedBy();
ExecuteScript("sim_monk_ac", oPC);}
*/
//////////////////////////////////////////////////////////////////////
//Settings
//Set this to the constant class you will be check to give the AC Bonus to..
const int SIM_MONK_AC_class = class_TYPE_ROGUE; //Default = Rogue
//Set this to the How much AC the PC Gains / X Levels (see X levels Below)
const int SIM_MONK_AC_BONUS = 1; //(Note SIM = Simulated AC Bonus)
//Set this to how many Levels In class the PC Must have to gain the above AC Bonus
const int SIM_MONK_AC_LVL_BONUS = 5; //+ X / 5 Levels = Default
//Set this to which Ability Modify Is used to give the AC Bonus
const int MONK_AC_ABILITY_SCORE = ABILITY_INTELLIGENCE; //Intelligence is used by Default
///////////////////////////////////////////////////////////////////////////////
//##### WARNING DON"T TOUCH ANYTHING BELOW THIS LINE!!! ####
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// Prototype to determine if the PC is qualified to get the AC Bonus!
// PC MUST NOT be wearing a Shield or any armor that isn't cloth!
int GetItemACBase(object oItem);
// Prototype to remove any "former supernatural" AC Bonuses (If relogging)
void RemoveACBonuses(object oPC);
// Prototype to remove any "former supernatural" Movement Increases
void RemoveSpeedBonuses(object oPC);
// Prototype to apply the "Monk AC Bonus"
void SimMonkAC(object oPC);
////////////////////////////////////////////////////////////////////////////////
//Main Script
void main()
{
object oPC = OBJECT_SELF; //The Caller (through ExecuteScript Function)
int nCL = GetLevelByclass(SIM_MONK_AC_class, oPC);
int iPass = TRUE;
int nSL, nSpeed, nSA;
effect eMove;
//First See if they qualify!
object oShield = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
if(GetItemACBase(oShield) >= 1 || GetItemACBase(oArmor) >=1) { iPass = FALSE; }
if(nCL == 0) { return; } //Just stop here, there is no sense in continuing!
//If so, apply the AC!
if(iPass) { SimMonkAC(oPC); }
//End Main Script..
}
////////////////////////////////////////////////////////////////////////////////
int GetItemACBase(object oItem)
{
int nRet = 0; //No Base Bonus by default...
switch(GetBaseItemType(oItem))
{
case BASE_ITEM_SMALLSHIELD: nRet = 1; break;
case BASE_ITEM_LARGESHIELD: nRet = 2; break;
case BASE_ITEM_TOWERSHIELD: nRet = 3; break;
case BASE_ITEM_ARMOR:
{
//The item must be UnIdentified to return the BASE Value to deterimine the BASE AC!
if(GetIdentified(oItem))
{
SetIdentified(oItem,FALSE);
AssignCommand(OBJECT_SELF,SetIdentified(oItem,TRUE));
}
switch(GetGoldPieceValue(oItem))
{
case 5: nRet = 1; break;// Padded
case 10: nRet = 2; break;// Leather
case 15: nRet = 3; break;// Studded Leather / Hide
case 100: nRet = 4; break;// Chain Shirt / Scale Mail
case 150: nRet = 5; break;// Chainmail / Breastplate
case 200: nRet = 6; break;// Splint Mail / Banded Mail
case 600: nRet = 7; break;// Half Plate
case 1500: nRet = 8; break;// Full Plate
}
}
}
return nRet;
}
/////////////////////////////////////////////////////////////////////////
void RemoveACBonuses(object oPC)
{
effect eAC;
int nType, nSub;
//Remove any prior Supernatural AC Increase Effects
eAC = GetFirstEffect(oPC);
while(GetIsEffectValid(eAC))
{
nType = GetEffectType(eAC);
if(nType == EFFECT_TYPE_AC_INCREASE)
{
nSub = GetEffectSubType(eAC);
if(nSub == SUBTYPE_SUPERNATURAL)
{ RemoveEffect(oPC, eAC); }
}
eAC = GetNextEffect(oPC);
}
}
//////////////////////////////////////////////////////////////////////////
void SimMonkAC(object oPC)
{
int nBon = GetAbilityModifier(MONK_AC_ABILITY_SCORE, oPC);
int nLvl = GetLevelByclass(SIM_MONK_AC_class, oPC);
int nAdj = 0;
//If qualified (by levels for a bonus)
if(nLvl > SIM_MONK_AC_LVL_BONUS)
{ nAdj = nLvl / SIM_MONK_AC_LVL_BONUS; }
int nLvlBon = SIM_MONK_AC_BONUS * nAdj;
int nFinal = nBon + nLvlBon;
effect eAC = EffectACIncrease(nFinal, AC_SHIELD_ENCHANTMENT_BONUS, AC_VS_DAMAGE_TYPE_ALL);
eAC = SupernaturalEffect(eAC);
//Seal it! (Till rest or death, cannot be dispelled!)
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAC, oPC);
}
///////////////////////////////////////////////////////////////////////////
Modifié par _Guile, 08 mai 2012 - 12:42 .