Author Topic: New Simulated Monk AC Bonus  (Read 364 times)

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
New Simulated Monk AC Bonus
« on: May 03, 2012, 07:28:47 am »


               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 .
                     
                  


            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
New Simulated Monk AC Bonus
« Reply #1 on: May 03, 2012, 03:01:21 pm »


               I tried it again this post, same thing, the script is being altered by the forums!  ':crying:'

If you type the word "class" in call CAPITALS, it will be reduced to lower case for some reason..

Try typing "C"lass , without the "", the capital will be converted to "class"

-----------------------

Anyway, to fix the above script you will have to do a search and replace for ALL instances of "class" and replace it with the apropriate Capital letter C...  You will also need to search for all instances of "class_" & replace them with capital letters... (Match case when searching in the script editor)
               
               

               


                     Modifié par _Guile, 03 mai 2012 - 02:08 .
                     
                  


            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
New Simulated Monk AC Bonus
« Reply #2 on: May 03, 2012, 04:41:10 pm »


               I am finding that a better way to post script is to block with quote, then code.

[ quote] [ code] 
stuff goes here
[ /code] [ /quote]
that block should give a mono-spaced verbatim of your code, but I am still dubious.



This will also help keep multiple scripts in one post from bleeding together and cornfusing us scrubs


               
               

               


                     Modifié par Leurnid, 03 mai 2012 - 03:42 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
New Simulated Monk AC Bonus
« Reply #3 on: May 03, 2012, 11:42:10 pm »


               

_Guile wrote...

Suggestions?


The simulated speed is questionable (especially for values above 50%).  Characters that do not have the monk speed feat acquired through leveling up will be subject to the cap of 1.5 * base speed.  There is no way around this.  Since haste already makes the 1.5 factoring multiple speed bonuses beyond this will not affect the character unless they are subject to a movement speed decrease or slow.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
New Simulated Monk AC Bonus
« Reply #4 on: May 08, 2012, 01:39:26 am »


               Thanks WhiZard, I noticed you are correct after testing the speed increases, they are indeed capped at 1.5 X base movement rate...  I guess we can scratch that off the list, unfortunately.

--------------------------------


Leurnid wrote...

I am finding that a better way to post script is to block with quote, then code.

[ quote] [ code] 
stuff goes here
[ /code] [ /quote]
that block should give a mono-spaced verbatim of your code, but I am still dubious.



This will also help keep multiple scripts in one post from bleeding together and cornfusing us scrubs




This did NOT work either, sorry...  (see above @ the edited OP)
               
               

               


                     Modifié par _Guile, 08 mai 2012 - 12:43 .