Author Topic: Spells for items  (Read 552 times)

Legacy_Eagles Talon

  • Full Member
  • ***
  • Posts: 192
  • Karma: +0/-0
Spells for items
« on: May 21, 2011, 10:43:01 am »


               Does anyone know if (and if so, how) to make additional spells available for the items - in particular potions.  There are a couple of spells I'd like to have available as potions, but they are not on the list in the item creation.

Any clues would be much ap[preciated.

ET
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Spells for items
« Reply #1 on: May 21, 2011, 03:55:40 pm »


               try my community patch, its in iprp_spells.2da otherwise
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Spells for items
« Reply #2 on: May 21, 2011, 07:54:21 pm »


               You can just make the potion a unique item and have the PC cast the spell when they drink the potion. For instance and essence of cure from my campaign:

//essence of cure ffbj
#include "x2_inc_switches"
void main()
   {
     int nEvent =GetUserDefinedItemEventNumber();
      if (!nEvent == X2_ITEM_EVENT_ACTIVATE)
     return;

        object  oPC =  GetItemActivator();
        object oItem = GetItemActivated();
        object   oCaster = oPC;
        int iHeal = GetSkillRank(SKILL_HEAL, oCaster, TRUE);

         AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_CURE_MODERATE_WOUNDS, oPC, 10 +iHeal, TRUE, TRUE));
         DelayCommand (1.0, AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_REGENERATE, oPC, 10 +iHeal, TRUE, TRUE)));
         DelayCommand (2.0, AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_REMOVE_DISEASE, oPC, 10 +iHeal, TRUE, TRUE)));
  }
               
               

               


                     Modifié par ffbj, 21 mai 2011 - 07:06 .
                     
                  


            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Spells for items
« Reply #3 on: May 21, 2011, 11:55:27 pm »


               

ffbj wrote...

You can just make the potion a unique item and have the PC cast the spell when they drink the potion. For instance and essence of cure from my campaign:

//essence of cure ffbj
#include "x2_inc_switches"
void main()
   {
     int nEvent =GetUserDefinedItemEventNumber();
      if (!nEvent == X2_ITEM_EVENT_ACTIVATE)
     return;

        object  oPC =  GetItemActivator();
        object oItem = GetItemActivated();
        object   oCaster = oPC;
        int iHeal = GetSkillRank(SKILL_HEAL, oCaster, TRUE);

         AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_CURE_MODERATE_WOUNDS, oPC, 10 +iHeal, TRUE, TRUE));
         DelayCommand (1.0, AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_REGENERATE, oPC, 10 +iHeal, TRUE, TRUE)));
         DelayCommand (2.0, AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_REMOVE_DISEASE, oPC, 10 +iHeal, TRUE, TRUE)));
  }



You can also make one script that also checks the name of the item as well instead of a few hundred smaller scripts.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Spells for items
« Reply #4 on: May 25, 2011, 12:22:27 am »


               Well he was asking for a few spells for potions.  Along the lines of what TSM was saying though you could use the item activated and check if it's a potion and then have all your altered potions scripts in one place, all your activated item weapon scripts, etc...in one location.  Putting all you activated items in one script could get a bit messy if you have lots of them, though seperating them into categories might not be a bad idea.
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Spells for items
« Reply #5 on: May 25, 2011, 12:37:42 pm »


               It is how we did it by having several catagories which has made it a lot easier to adjust with having 4 groups of Weapons, Potions, Clothing, Misc.

Then named the scripts tsm_wep, tsm_pot, tsm_worn, tsm_misc so to adjust any of them is very simple.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Spells for items
« Reply #6 on: May 25, 2011, 11:40:18 pm »


               Yeah that makes a lot of sense.  Great minds...etc...