Jump to content

SpellCast([PC],0) doesn't always work for me


Guest Heeswijk

Recommended Posts

Guest Heeswijk

The code used in Athkatla to summon the cowled wizards for illegal spellcasting punishment doesn't work as expected for me.

 

IF
   SpellCast([PC],0)
   !GlobalTimerNotExpired("SpellsBad","GLOBAL")
   Global("BribedCowled","GLOBAL",0)
   GlobalLT("CowledWarning","GLOBAL",7)
THEN
   RESPONSE #100
       CreateCreatureObjectDoor("COWENF2",LastTrigger,0,0,0) // Cowled Enforcer
       SetGlobalTimer("SpellsBad","GLOBAL",300)
END

 

It triggers fine for some spells, like burning hands, armor and chromatic orb, but fails to trigger for at least color spray and grease. I can't find any differences between those spells (they are all in spell.ids).

 

When you change the 0 in spellcast to WIZARD_GREASE, it doesn't trigger either.

 

Does anyone have a clue what could cause this, or how to solve it?

I want to do something whenever a PC casts a spell, and I don't really feel like editing every single spell to set some variable.

Link to comment
Guest Heeswijk

I've been trying to locate the problem futher.I had heard SpellCastRES doesn't work as intended and triggers on every spell instead of just the one named as the resource, but the same problem arises.

 

It seems only to occur when the code block is in baldur.bcs, not when it is linked to an area-bcs, as is the case in the original game.

 

(When linked to another script that should always be running like the DPlayer-scripts, the spells are recognized correctly, but moving right after casting any spell will prevent the action from happening)

 

I try to apply an effect on any sorcerer party member casting a spell at any time. Any thoughts how to accomplish this?

Link to comment
moving right after casting any spell will prevent the action from happening
This is perhaps somewhat of a clue. I noticed some of the spells you mentioned have a casting speed of 1, for what that's worth. But it might be possible if you cast quickly and then do something else, the script will no longer recognise the fact that spell had just been cast.
I try to apply an effect on any sorcerer party member casting a spell at any time. Any thoughts how to accomplish this?
You might be able to do something in the style of Detectable Spells or Galactygon's SpellPack. I don't know much more, but there've been some posts on the subject lately.
Link to comment
It seems only to occur when the code block is in baldur.bcs, not when it is linked to an area-bcs, as is the case in the original game.

 

OK, more testing done (accidentally, I had let it rest but stumbled upon it with another spell,

 

It always works when linked to the area bcs

In SOME areas, it works even if the check is linked to baldur.bcs

It doesn't alway work or not work in the same area. It usually does work at least once after MoveToArea-ing to the area.

I noticed some of the spells you mentioned have a casting speed of 1, for what that's worth.
Checked that, but it's not consistent. They did however had something else in common, the spells that don't fire the trigger all seem to be area-effects (not sure though, maybe not all, maybe not limited to)

 

My guess would be it's some kind of overload, the game doesn't proces the trigger in time. Maybe the number of areas in memory, the number of triggers in the area, or the number of non-continue() triggers, have influence on this. (I can imagine the engine runs the script only 15 times before the trigger expires, so when other things trigger and it jumps out of the routine that many times before it fires it could be gone. Untested.)

Link to comment
You might be able to do something in the style of Detectable Spells or Galactygon's SpellPack. I don't know much more, but there've been some posts on the subject lately.

 

Thanks for the suggestion; I'll check Galactygon's thing. As far as I know, Detectable Spells actually does change all spells. I'm planning to go with that as well for the moment.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...