Jump to content

Photo

Questions to scripting: cast/detect innate ability


4 replies to this topic

#1 jastey

jastey
  • Gibberlings
  • 7530 posts
  • Gender:Female

Posted 21 July 2018 - 11:45 AM

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?



#2 argent77

argent77
  • Modders
  • 825 posts
  • Gender:Male

Posted 21 July 2018 - 12:10 PM

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).
 



#3 K4thos

K4thos
  • Modders
  • 1208 posts
  • Gender:Male

Posted 21 July 2018 - 12:20 PM

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.



#4 jastey

jastey
  • Gibberlings
  • 7530 posts
  • Gender:Female

Posted 22 July 2018 - 09:55 AM

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.
 



#5 Ardanis

Ardanis

    A very GAR character

  • Modders
  • 2631 posts
  • Gender:Male
  • Location:Saint-Petersburg, Russia

Posted 23 July 2018 - 12:01 PM

Make c#brxxxx cast c#brxxxy via 146 effect, make your NPC immune to c#brxxxy (via 206), and have it set a global variable you can check in scripts.


Retired from modding.




Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users