Modifié par rjshae, 12 octobre 2010 - 07:57 .
Ring of Spell Storing?
#1
Posté 12 octobre 2010 - 07:55
#2
Posté 12 octobre 2010 - 08:05
#3
Posté 12 octobre 2010 - 09:48
#4
Posté 12 octobre 2010 - 09:53
If you want to do more - how about a script that skips the game's "charges" property altogether and keeps track of its own "uses" variables? You might have to use a dialogue box for the description etc.
Modifié par I_Raps, 12 octobre 2010 - 09:54 .
#5
Posté 13 octobre 2010 - 12:43
#6
Posté 13 octobre 2010 - 07:51
What I did was use the spellhook system to trap the events of the spell being cast on the item, and the item casting the spell. I think NWN2 already traps the casting of spells on items and funnels it into tagbased scripting, but when the spell is cast out again, you need to check if it was cast by the ring, check which spell it was, and remove the item property from the spell. I'd use a property with something like 5 charges a use (or maybe one use/day) to minimise the cost increase of adding the property. You might have to reset the charges to full each time a spell is cast, though.
Modifié par The Fred, 13 octobre 2010 - 07:51 .
#7
Posté 13 octobre 2010 - 11:06
If you'd like to see the code, let me know.
Modifié par _Knightmare_, 13 octobre 2010 - 11:08 .
#8
Posté 13 octobre 2010 - 03:47
_Knightmare_ wrote...
I had a similar problem on an item with the charges (item was not a spell storing though). I just coded it so that if the ability was used in an invalid way I added the charge back to the item. If that was the final charge and the item disappeared, I had the script create a new copy of the item on the PC, added the charge back to it and re-equipped it back to the appropriate slot. The drawback though is that if the player has it assigned to a quickslot, it would disappear from there and they would have to reassign it.
If you'd like to see the code, let me know.
I'm curious to know how you trapped the event where the item disappears. It doesn't seem to call the unequip script. Maybe with a heartbeat script?
Another approach I was thinking about was to have the stored spells in the ring appear as separate scroll-like items in the player's inventory when the ring was equipped, then remove the scrolls (and tally their usage) when the ring was unequipped.
Thanks.
#9
Posté 13 octobre 2010 - 11:05
rjshae wrote...
I'm curious to know how you trapped the event where the item disappears. It doesn't seem to call the unequip script. Maybe with a heartbeat script?
I just have it as part of the OnActivate tag-based script. Apparently, the used charge is removed before the tag-based script actually fires, so you can catch it there:
// Add the used charge back to the item
int nCharges = GetItemCharges(oItem);
if(nCharges == 0)
{
object oNewItem = CreateItemOnObject("item_resref", oPC, 1, "", TRUE);
SetItemCharges(oNewItem, 1);
return;
}
SetItemCharges(oItem, nCharges + 1);
Modifié par _Knightmare_, 13 octobre 2010 - 11:08 .
#10
Posté 14 octobre 2010 - 04:15
#11
Posté 15 octobre 2010 - 02:18
#12
Posté 26 octobre 2010 - 07:27
Modifié par rjshae, 26 octobre 2010 - 07:29 .





Retour en haut







