Seems very useful.
Why are targets separated in different blocks? Wouldn't it be sufficient to simply add an OR(x)?
Example:
Library definitions:
For example:
TARGET=test
[PC]
SecondNearest([PC])
Action definition:
BEGIN_ACTION_DEFINITION
Name(Spell)
TRIGGER
HaveSpell(scsargument1)
!CheckStatGT(scstarget,0,SANCTUARY)
CheckStatLT(Myself,50,SPELLFAILUREMAGE)
!CheckStat(scstarget,2,WIZARD_SPELL_TRAP)
ACTION
RESPONSE #scsprob1
SetGlobalTimer("castspell","LOCALS",6)
Spell(scstarget,scsargument1)
END
ssl script:
IF TRIGGER
TargetBlock(test)
THEN DO
Action(Spell,WIZARD_FIREBALL)
END
Will compile into:
IF
HaveSpell(WIZARD_FIREBALL)
!CheckStatGT([PC],0,SANCTUARY)
CheckStatLT(Myself,50,SPELLFAILUREMAGE)
!CheckStat([PC],2,WIZARD_SPELL_TRAP)
See([PC])
THEN
RESPONSE #100
SetGlobalTimer("castspell","LOCALS",6)
Spell([PC],WIZARD_FIREBALL)
END
IF
HaveSpell(WIZARD_FIREBALL)
!CheckStatGT(SecondNearest([PC]),0,SANCTUARY)
CheckStatLT(Myself,50,SPELLFAILUREMAGE)
!CheckStat(SecondNearest([PC]),2,WIZARD_SPELL_TRAP)
See(SecondNearest([PC]))
THEN
RESPONSE #100
SetGlobalTimer("castspell","LOCALS",6)
Spell(SecondNearest([PC]),WIZARD_FIREBALL)
END
Is there a way to compile it into the following instead?
IF
HaveSpell(WIZARD_FIREBALL)
OR(2)
See([PC])
See(SecondNearest([PC]))
!CheckStatGT(LastSeenBy(),0,SANCTUARY)
CheckStatLT(Myself,50,SPELLFAILUREMAGE)
!CheckStat(LastSeenBy(),2,WIZARD_SPELL_TRAP)
THEN
RESPONSE #100
SetGlobalTimer("castspell","LOCALS",6)
Spell(LastSeenBy(),WIZARD_FIREBALL)
END
I think the script would then be quicker, or am I wrong about that? Does infinity engine read triggers from bottom and up instead of top to bottom like I assume it does?