Aller au contenu

Photo

Spells for items


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
Eagles Talon

Eagles Talon
  • Members
  • 107 messages
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

#2
Shadooow

Shadooow
  • Members
  • 4 470 messages
try my community patch, its in iprp_spells.2da otherwise

#3
ffbj

ffbj
  • Members
  • 593 messages
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 .


#4
TSMDude

TSMDude
  • Members
  • 865 messages

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.

#5
ffbj

ffbj
  • Members
  • 593 messages
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.

#6
TSMDude

TSMDude
  • Members
  • 865 messages
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.

#7
ffbj

ffbj
  • Members
  • 593 messages
Yeah that makes a lot of sense. Great minds...etc...