Author Topic: Looking for some help adding a variable to on equip and unequip events...  (Read 449 times)

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Looking for some help adding a variable to on equip and unequip events...
« Reply #15 on: November 07, 2013, 06:34:59 am »


               Best way would be to put it in a library, like a script called

thisisalibrary

and then at the top of the equip and unequip write

#include "thisisalibrary"

At that point you can use the onequip and unequip code blocks Whiz mentioned because it knows what GetArmorMaxAC means.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Looking for some help adding a variable to on equip and unequip events...
« Reply #16 on: November 07, 2013, 07:57:00 pm »


               You can leave the function declaration above the void main() of the event code, or you can place it into an include.  If you are going to change the max values often, remember all scripts will need to be updated, whether they have this function in the actual script or are referencing it from an include.  Also, when a function is inside an include it gets declared once and defined once in order to use elsewhere.

For instance, my function would be presented as below in an include file:

// Summary of function goes here. Use
// a double slash before each line  
// This enables the summary to be displayed
// in the bottom window of NWScript
int GetArmorMaxAC(object oArmor);

int GetArmorMaxAC(object oArmor)
{
//Contents of function go here.
}
               
               

               


                     Modifié par WhiZard, 07 novembre 2013 - 08:04 .
                     
                  


            

Legacy_Lazarus Magni

  • Hero Member
  • *****
  • Posts: 1837
  • Karma: +0/-0
Looking for some help adding a variable to on equip and unequip events...
« Reply #17 on: November 08, 2013, 01:21:00 am »


               This appears to be working. Thank you very much guys!