Author Topic: Cure Light Wounds Modification  (Read 310 times)

Legacy_Kingdom_Of_Hearts

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Cure Light Wounds Modification
« on: February 03, 2014, 08:28:05 pm »


               Hello. I'm working on a modification to all the Cure X Wounds spells, and I am not sure if this would work. I am attempting to script if the PC is wearing a certain amulet, all the spells are 25% more effective.

Script is pastebin.com/8fCC6KEn.
               
               

               


                     Modifié par Kingdom_Of_Hearts, 03 février 2014 - 08:28 .
                     
                  


            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
Cure Light Wounds Modification
« Reply #1 on: February 04, 2014, 04:55:39 am »


               Whenever you convert a float to an int, anything after the decimal is dropped. So in this script, nExtra will always be 1 and the spell will not heal any more than normal. What you need to do is calculate the amount of healing as a float, then convert that to an int.

You're also going to want to recalculate max healing (the third parameter of spellsCure()) to account for the possible bonus, since Cure spells do max healing on lower difficulties.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Cure Light Wounds Modification
« Reply #2 on: February 04, 2014, 05:15:22 am »


               Try this at the end

int nMax;

  if ( "AmuletofNaturalHealing" == GetTag(GetItemInSlot(INVENTORY_SLOT_NECK, OBJECT_SELF)) )
   {
   nMax = 10;  // (5 * 8  / 4)
   }
   else
   {
    nMax = 8;
   }

   spellsCure(d8() * nMax / 8, 5, nMax, VFX_IMP_SUNSTRIKE, VFX_IMP_HEALING_S, GetSpellId());


EDIT: One problem that Squatting Monk didn't pick up on, is that your nExtra that you used will always be 0.  This is because the variable you defined outside of the if statements was not the variable you updated within the if statements.  Instead you defined a new variable with the same name gave it a value and then never used it.


For example

int nVar;
if(0==0)
{
int nVar = 1;
}

defines two variables with the same name.  The first one will be used outside of the if statement, while the second is used only within the if statement starting from when it is defined.  Since when an integer is defined, its starting value is zero, any call to that variable after the if statement has been concluded will find the value 0.

However

int nVar;
if(0==0)
{
nVar = 1;
}

Defines only one variable and then updates it to a new value.  Calls outside the if statement can now properly find the value one.
               
               

               


                     Modifié par WhiZard, 04 février 2014 - 05:26 .