Jump to content

SpellCastInnate()


cirerrek

Recommended Posts

-----------

devSin

 

SpellCastInnate() will only return true if the innate spell has the right level (e.g., SPCL412 needs to be level 4).

-----------

 

Confirmed in the following test

 

IF
 SpellCastInnate(Myself,4414)
THEN
 RESPONSE #100
   DisplayStringHead(Myself,22724) // say "Gong Mallet"
END  

 

devSin is correct. The string was only displayed when the spell level was set to 4.

 

Setting the spell level to 0

 

String is not displayed

No crash when cast from a script, the spell is simply not cast (it was in series with a couple of other spells to be cast, the Set Snares with its level set to 1 was cast, Set Special Snares with its level set to 0 was not cast.

 

Setting the spell level to 1

 

String is not displayed

No crash when cast from a script, both Set Snares and Set Special Snares were cast as expected.

 

Setting the spell to level 4

 

String was displayed

Crash to desktop when cast from a script.

 

---------------------------------------------------

 

If you check for an Innate or Class spell using either the HaveSpell or HaveSpellRES triggers, and the Innate or Class spell is not set to level 1, you will get a crash to desktop.

 

So the general reaction is to set all Innate and Class spells to level 1.

 

But, this can break game scripts that use SpellCastInnate().

 

Thanks,

Link to comment

Have you tried an addition to Trigger.ids in your .tp2 file?

 

APPEND ~TRIGGER.IDS~ ~0x00A7 SpellCastInnateRES(S:Spell*,O:Object*)~  UNLESS ~0x00A7 SpellCastInnateRES(S:Spell\*,O:Object\*)~

 

with the spell set to level 1, and the following script snippet:

 

IF
SpellCastInnateRES("SPCL414",Myself)
THEN
RESPONSE #100
  DisplayStringHead(Myself,22724) // say "Gong Mallet"
END

Link to comment

The following is excerpted from a post elsewhere. I tested them. Cirerrek produced similar results, and Sim concurred.

I finally got a moment to check why Odren's scroll fails if the spell level is set to 1, and made some boring observations. We append triggers to the IDS files and include scriptable spells, so I'm posting this here for none to see.

 

It turns out that SpellCastInnate() will *only* return true if the spell level is correct (i.e., the spell number / 100). If the spell is any other level, the SpellCastInnate() trigger will return false. Additionally, SpellCastInnate() is the only trigger that will return true when an innate spell is cast, so it has to be used.

 

APPEND ~TRIGGER.IDS~ ~0x00A1 SpellCastOnMeRES(S:Spell*,O:Caster*)~
APPEND ~TRIGGER.IDS~ ~0x0091 SpellCastRES(S:Spell*,O:Object*)~
APPEND ~TRIGGER.IDS~ ~0x00A6 SpellCastPriestRES(S:Spell*,O:Object*)~
APPEND ~TRIGGER.IDS~ ~0x00A7 SpellCastInnateRES(S:Spell*,O:Object*)~
APPEND ~TRIGGER.IDS~ ~0x4031 HaveSpellRES(S:Spell*)~

I am unable to verify that most of these actually work. HaveSpellRES() does work, as from the following script:

IF
 HaveSpellRES("CAMDAWG")
THEN
 RESPONSE #100
   DisplayStringHead(Myself,67787) // I'd say it's time to die, demon.
   Continue()
END

IF
 HaveSpellRES("SPWI406") // Minor Globe of Invulneribility
 Global("SexBomb","LOCALS",0)
THEN
 RESPONSE #100
   CreateVisualEffectObject("SPFIREPI",Myself)
   SetGlobal("SexBomb","LOCALS",1)
END

When loaded, Imoen will never run the string, and will always play the effect (any spell she has can be substituted for 2406).

 

SpellCastInnateRES() doesn't seem to work at all. It looks like the resource reference is ignored entirely, and the game is just treating it at SpellCastInnate(O:O,I:0), from the following code:

IF
 SpellCastInnateRES("DING0",[GOODCUTOFF])
THEN
 RESPONSE #100
   DisplayStringHead(Player1,21792) // What if I'm not interested in having my eyes removed?
   Continue()
END

Any innate spell of any level can be cast, and the string will always run over Player1 (regardless of the reference specified). The behavior is the same whether a generic object ([30], [0], etc.), or an explicit object (e.g., "IMOEN", Player1) is used (although, that aspect does work as expected). The same continues to be true if SpellCastPriestRES() or SpellCastRES() are used in place of SpellCastInnateRES() (again, the matching to spell type and the caster still works, it just picks up any spell).

 

I didn't check HaveSpellPartyRES() or SpellCastOnMeRES(). I don't care.

Link to comment

Right. The trap I fell into during testing is probably what led most people to believe they worked. SpellCastRES *will* work when you test it, precisely because it returns true for any spell, rather than just the one you want. This led to the infamous "Mummies behave strangely when you cast spells on them" bug in Quest Pack.

Link to comment

Archived

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

×
×
  • Create New...