I'm trying to make a quest reward script, that adds spell slots to a character's amulet. The script takes the quest item, and gives xp and gold, but it does not add the spell slots. The script compiled fine, so I'm not sure why it did not add the spell slots. Is there something I do not know about? Any help would be greatly appreciated.
Here is the script:
#include "x2_inc_itemprop"
void main()
{
// Get the PC who is in this conversation.
object oPC = GetPCSpeaker();
object oParty = GetFirstFactionMember(oPC);
object oItem;
itemproperty ipAdd;
// Alter the necklace equipped by the PC.
oItem = GetItemInSlot(INVENTORY_SLOT_NECK, oPC);
ipAdd = ItemPropertyBonusLevelSpell(IP_CONST_class_WIZARD, IP_CONST_SPELLLEVEL_6);
IPSafeAddItemProperty(oItem, ipAdd);
IPSafeAddItemProperty(oItem, ipAdd);
IPSafeAddItemProperty(oItem, ipAdd);
IPSafeAddItemProperty(oItem, ipAdd);
IPSafeAddItemProperty(oItem, ipAdd);
oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{
if (GetTag(oItem)=="IlaniasBlackHeart")
{
DestroyObject(oItem);
}
oItem = GetNextItemInInventory(oPC);
}
while(GetIsObjectValid(oParty))
{
if(GetArea(oPC)==GetArea(oParty))
{
GiveGoldToCreature(oParty, 50000);
GiveXPToCreature(oParty, 5000);
}
oParty = GetNextFactionMember(oPC);
}
}
Adding Spell Slots By Script
Débuté par
Sadira of Tyr
, févr. 26 2013 11:32
#1
Posté 26 février 2013 - 11:32
#2
Posté 26 février 2013 - 11:36
remove "IPSafe" and it should work, the IPSafeAddItemProperty is a custom function that has built-in check for existence of the same property
#3
Posté 26 février 2013 - 11:45
Thank you for that.
I have a question though. I would like the script to only give the spell slots if the amulet has not gotten the spell slots before. I'm sure that sounds confusing, lol. What I mean is that I would like the amulet to have only five spell slots, even if the character completes the quest again. Allowing the slots to go to 10, then 15, etc, would be unbalancing.
I have a question though. I would like the script to only give the spell slots if the amulet has not gotten the spell slots before. I'm sure that sounds confusing, lol. What I mean is that I would like the amulet to have only five spell slots, even if the character completes the quest again. Allowing the slots to go to 10, then 15, etc, would be unbalancing.
#4
Posté 26 février 2013 - 11:58
I guess I could solve that on my own by adding a variable to the amulet as well. Silly me, lol.
Thank you ShaDoOoW.
Thank you ShaDoOoW.
Modifié par Sadira of Tyr, 26 février 2013 - 11:59 .
#5
Posté 27 février 2013 - 12:26
yup, variable on amulet is probably best approach for this
#6
Posté 27 février 2013 - 12:45
Oops! I guess I should have tried the fix first.
I removed the IPSafe, but the script would not compile, declaration does not match parameters, on the line with AddItemProperty. I guess I need to make another change, but I'm not sure what that would be. I guess I could use some more help, lol.
I removed the IPSafe, but the script would not compile, declaration does not match parameters, on the line with AddItemProperty. I guess I need to make another change, but I'm not sure what that would be. I guess I could use some more help, lol.
Modifié par Sadira of Tyr, 27 février 2013 - 12:47 .
#7
Posté 27 février 2013 - 12:54
try this then
AddItemProperty(DURATION_TYPE_PERMANENT,ipAdd,oItem);
AddItemProperty(DURATION_TYPE_PERMANENT,ipAdd,oItem);
#8
Posté 27 février 2013 - 01:21
Ah, now it compiles fine. I have tested it, and the spell slots were added. I just need to add the variable, but I can manage that on my own. Well, I hope so, lol.
Thank you for helping me.
Thank you for helping me.





Retour en haut






