Jump to content

Questions to scripting: cast/detect innate ability


jastey

Recommended Posts

I'd need help with the following problems:

 

1. My NPC has an innate ability which he should trigger if kicked out of the party. How do I script this? I tried "Spell(Myself,"c#brxxxx")" but (of course) it complains that "c#brxxxx" is not in the spell.ids.

 

2. I want to check whether a custom innate ability of my NPC was cast onto someone else. I tried "SpellCastOnMe("c#grey","c#grxxxx")" but it complaints that "c#grxxxx" is not in the spell.ids, either.

 

I'm not even sure this would trigger/detect innate abilities at all. (And as far as I understood, I can't include those spells in the spell.ids because then it screws up the spell choice for the PC.)

 

How would I script the use / detection of a custom innate ability?

Link to comment

1. Try SpellRES("c#brxxxx",Myself) or ApplySpellRES("c#brxxxx",Myself) if you want it applied instantly.
2. Only for EE games: try SpellCastOnMeRES("c#brxxxx","c#grey") - Returns true only if cast in the last script round. Another option would be using spell states: Add a spell state to the spell in question (opcode 328) and check it via CheckSpellState("c#grey",MY_SPELL_STATE). It has the advantage that the spell state can be checked as long as the spell is active.

No need to add entries to SPELL.IDS. This is only really needed if you want spells to be available at spell selection (e.g. during character creation or for sorcerers at level up).

Link to comment
2. Only for EE games: try SpellCastOnMeRES("c#brxxxx","c#grey") - Returns true only if cast in the last script round. Another option would be using spell states: Add a spell state to the spell in question (opcode 328) and check it via CheckSpellState("c#grey",MY_SPELL_STATE). It has the advantage that the spell state can be checked as long as the spell is active.

 

 

And for not EE games you can try setting opcode #309 (Modify Local Variable) directly in spell to 1 on hit and to 0 when the spell is over, in order to make the spell detectable via Global("SomeVarSetBySpell","LOCALS",1) in scripts. If the check is done via baldur.bcs this feature would require TriggerOverride functionality added by ToBEX.

Link to comment

Thank you both!

For my first question I am using ApplySpellRES (although ignoring the IESDP description of max 7 letters for now until I experience in game that an 8 letter name really doesn't work.)

 

The second thing I realized is more complex to accomplish than I thought, so I will just leave it.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...