I'm trying to figure out how to force cast or remove, a pc and companions, available spells. So when they awaken, naked and weaponless, the mages and clerics don't have any spells to cast.
After giving it some thought, and looking through the list of functions, I realized I don't even know where to begin.
If someone could point me in the right direction, I would be very thankful.
remove available spells?
Débuté par
bealzebub
, janv. 09 2012 04:22
#1
Posté 09 janvier 2012 - 04:22
#2
Posté 09 janvier 2012 - 04:30
You could try reducing their spell-casting ability to 10 via a supernatural effect. Or you can apply 100% spell failure to them. Their spells won't be gone, but they won't be able to cast them.
I too have looked for a function that does what you want, and had no luck. The closest I could find was a function that reduces the number of uses a feat has left per day. There doesn't seem to be a corresponding function for spells though.
I too have looked for a function that does what you want, and had no luck. The closest I could find was a function that reduces the number of uses a feat has left per day. There doesn't seem to be a corresponding function for spells though.
#3
Posté 09 janvier 2012 - 10:05
Right out of the Lexicon...
Decrease the number of spell uses of a particular spell for a given creature.
void DecrementRemainingSpellUses( object oCreature, int nSpell);
Parameters:
oCreature
Creature to decrement the remaining spell uses of a particular spell.
nSpell: SPELL_*
Description
Decreases the remaining number of spell uses per day for a creature by one. A creature must have at least one spell use for this function to work. To make this work correctly, it should be used with GetHasSpell().
nSpell doesn't have to be a spell. It can be any entry in the spells.2da file.
If they do not have any castings of nSpell memorised, then nothing will happen.
Note that this has to be added into a loop, with GetHasSpell(), to remove all the avalible castings of nSpell.
Decrease the number of spell uses of a particular spell for a given creature.
void DecrementRemainingSpellUses( object oCreature, int nSpell);
Parameters:
oCreature
Creature to decrement the remaining spell uses of a particular spell.
nSpell: SPELL_*
Description
Decreases the remaining number of spell uses per day for a creature by one. A creature must have at least one spell use for this function to work. To make this work correctly, it should be used with GetHasSpell().
nSpell doesn't have to be a spell. It can be any entry in the spells.2da file.
If they do not have any castings of nSpell memorised, then nothing will happen.
Note that this has to be added into a loop, with GetHasSpell(), to remove all the avalible castings of nSpell.
#4
Posté 09 janvier 2012 - 07:04
I wonder what would happen if you temporarily reduced their intelligence and wisdom. Would that make them automatically lose their spells?
#5
Posté 09 janvier 2012 - 07:46
Kaldor Silverwand wrote...
I wonder what would happen if you temporarily reduced their intelligence and wisdom. Would that make them automatically lose their spells?
Urg! Me Mage! .....Oh yes my good fellow I have no spells anymore!
#6
Posté 09 janvier 2012 - 08:05
Hello,
The function below will remove cast spelling capabalities from any creature (PC, party member ...) :
// prevent magic
void NoMagic(object oCreature)
{
effect eAnti = EffectSpellFailure(100);
eAnti = SupernaturalEffect(eAnti);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAnti, oCreature);
}
usage sample : NoMagic(GetFirstPC());
The function below gives cast spelling capabilities back to the creature :
// restore magic
void Magic(object oCreature)
{
effect eEffect = GetFirstEffect(oCreature);
while (GetIsEffectValid(eEffect) == TRUE)
{
if (GetEffectSubType(eEffect) == SUBTYPE_SUPERNATURAL)
{
if (GetEffectType(eEffect) == EFFECT_TYPE_SPELL_FAILURE)
{
RemoveEffect(oCreature, eEffect);
}
}
eEffect = GetNextEffect(oCreature);
}
}
usage sample : Magic(GetFirstPC());
You can use them in a loop to prevent/restore party's and/or opposition magic capabilities. Put the cooresponding scripts in the connexion to an area event and to the exit area event to forbid any spell in a specific area. Sorry for the appromative translation, my toolset is in French.
The function below will remove cast spelling capabalities from any creature (PC, party member ...) :
// prevent magic
void NoMagic(object oCreature)
{
effect eAnti = EffectSpellFailure(100);
eAnti = SupernaturalEffect(eAnti);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAnti, oCreature);
}
usage sample : NoMagic(GetFirstPC());
The function below gives cast spelling capabilities back to the creature :
// restore magic
void Magic(object oCreature)
{
effect eEffect = GetFirstEffect(oCreature);
while (GetIsEffectValid(eEffect) == TRUE)
{
if (GetEffectSubType(eEffect) == SUBTYPE_SUPERNATURAL)
{
if (GetEffectType(eEffect) == EFFECT_TYPE_SPELL_FAILURE)
{
RemoveEffect(oCreature, eEffect);
}
}
eEffect = GetNextEffect(oCreature);
}
}
usage sample : Magic(GetFirstPC());
You can use them in a loop to prevent/restore party's and/or opposition magic capabilities. Put the cooresponding scripts in the connexion to an area event and to the exit area event to forbid any spell in a specific area. Sorry for the appromative translation, my toolset is in French.
#7
Posté 09 janvier 2012 - 09:43
Morbane wrote...
Right out of the Lexicon...
Decrease the number of spell uses of a particular spell for a given creature.
void DecrementRemainingSpellUses( object oCreature, int nSpell);
Now I remember what it was I was trying to do - I was trying to *increase* the number of uses per day of an item that could only be used outside (the Horn of the Skymage). If you used it inside you got a message instead of it activating - except that you lost a use per day anyway. At the time I could only find ways of decrementing feat/spell usages, and no way of incrementing the uses per day of an item (if it was a fixed-charge item it wouldn't have been a problem).
Stupid memory. At least it's not as bad as my memory though.
#8
Posté 09 janvier 2012 - 10:40
hmm,
So if I took the DecrementRemainingSpellUses route, to remove all spells, I would have to script a check for every possible spell, and loop it for every spell, say 6 times, to make sure I got all the uses per day. I want to remove only spells, not feats and such, so I would need to go through the spells.2da and just get the int of spells I want to remove. That's a lot of spells.
Claudiaus33's, prevent magic route, would mean that scrolls would not work either. I want to leave a few scrolls, so that's out.
Reducing intelligence, wisdom, and charisma would be the easiest, and scrolls would still work. Though it is not really what I want to do.
Do ya'll think that about summs it up?
So if I took the DecrementRemainingSpellUses route, to remove all spells, I would have to script a check for every possible spell, and loop it for every spell, say 6 times, to make sure I got all the uses per day. I want to remove only spells, not feats and such, so I would need to go through the spells.2da and just get the int of spells I want to remove. That's a lot of spells.
Claudiaus33's, prevent magic route, would mean that scrolls would not work either. I want to leave a few scrolls, so that's out.
Reducing intelligence, wisdom, and charisma would be the easiest, and scrolls would still work. Though it is not really what I want to do.
Do ya'll think that about summs it up?
#9
Posté 10 janvier 2012 - 12:42
I'm surprised there isn't a function to return the spells someone has readied so you could just loop through them and remove them.
I'm not suggesting you leave them stupid by the way, just drop the intelligence, wisdom, (and charisma I guess) and then restore them. I'm guessing the engine will remove the spells for you. Never tried it though.
Regards
I'm not suggesting you leave them stupid by the way, just drop the intelligence, wisdom, (and charisma I guess) and then restore them. I'm guessing the engine will remove the spells for you. Never tried it though.
Regards
Modifié par Kaldor Silverwand, 10 janvier 2012 - 12:43 .
#10
Posté 10 janvier 2012 - 03:40
There is a bug with sorcerers whereby if you repeatedly remove and replace a nymph cloak (after having rested with it on) you gradually lose all of your spells. The game engine removes the additional spell usages you got when your charisma was boosted before you slept, but doesn't notice that you are re-requipping the cloak, so it keeps removing spell usage as you keep unequiping the cloak (or anything else that boosts charisma).
This might suggest that reducing the casting ability to 10 for a few seconds (I'd do it for at least a round - maybe 7 seconds to make sure) will remove the spell usages. As Kaldor suggests, it requires some experimentation to confirm though.
This might suggest that reducing the casting ability to 10 for a few seconds (I'd do it for at least a round - maybe 7 seconds to make sure) will remove the spell usages. As Kaldor suggests, it requires some experimentation to confirm though.
#11
Posté 10 janvier 2012 - 08:06
Kaldor Silverwand wrote...
I'm surprised there isn't a function to return the spells someone has readied so you could just loop through them and remove them.
A while ago when I was trying to figure out a way to make a custom quickspell menu, this was exactly the problem I ran into. If you only have to loop over all spells once (as in the situation the OP is discussing) that's not really a terrible thing. I was facing a potential need to do it repeatedly. I unfortunately never found a good work-around.
It's also too bad that the only way currently available to restore spells is to force rest. I'm pretty sure that's how Tiberius did it in The Maimed God's Saga: "resting" not at an altar would just restore hit points, but praying at an altar would actually result in a rest (then decrement your HP back to where it was).
It would be nice if some of the brilliant NWNX
#12
Posté 11 janvier 2012 - 04:47
I'll give reducing ability scores a try. I'll let ya'll know if it works. (It may take a day or so).
#13
Posté 11 janvier 2012 - 11:58
You could probably hook into the GUI to keep your own track of what spells people have known and/or readied. It's probably more work than it's worth, though.
#14
Posté 12 janvier 2012 - 12:09
And the prize goes to... *drum roll* ... Kaldor Silverwand, for his lower the ability scores suggestion!
I just made a simple OnEnter script that lowers ability scores by 10 for 10 seconds, and wallah, no more available spells. Thanks Kaldor.
I just made a simple OnEnter script that lowers ability scores by 10 for 10 seconds, and wallah, no more available spells. Thanks Kaldor.
#15
Posté 12 janvier 2012 - 01:26
and stuff... taking spammer off the most recent post...
#16
Posté 12 janvier 2012 - 04:43
Glad it works. Rereading DannJ's post before mine though he also suggested reducing the spell-casting ability. I just didn't read his post (sorry, DannJ). So in the spirit of the holiday season I pass this tremendous prize on to DannJ. I'm keeping the drumroll though.
#17
Posté 12 janvier 2012 - 10:32
NWN1 used to have a Spell hook which when cast would fire a script prior to the spell.. Does NWN2 have that ability?
#18
Posté 12 janvier 2012 - 11:53
Yep.





Retour en haut







