Jump to content


Photo

A spell state detection problem


  • Please log in to reply
14 replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 21 February 2018 - 03:34 PM

Scripts for some reason recognize when people are in spell states but don't want to recognize the opposite. In BALDUR.BCS, if you put this check:

 

IF
    CheckSpellState(Player1,PROTECTION_FROM_EVIL)
THEN
    RESPONSE #1
        Kill(Player1)
END

 

and give the player an item that puts him in this state, he will die. But this check does nothing:

 

IF
    !CheckSpellState(Player1,PROTECTION_FROM_EVIL)
THEN
    RESPONSE #1
        Kill(Player1)
END



#2 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 25 February 2018 - 10:38 PM

Offhand, I'm just looking at what *should be* the logic. What you're saying is "if (don't bother checking) whether the player should be in this state." Well of course this should always have no effect. Just guessing there as a logician, but I'll admit IE scripting isn't always logical.


Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#3 Avenger_teambg

Avenger_teambg
  • Member
  • 604 posts

Posted 26 February 2018 - 09:05 AM

Offhand, I'm just looking at what *should be* the logic. What you're saying is "if (don't bother checking) whether the player should be in this state." Well of course this should always have no effect. Just guessing there as a logician, but I'll admit IE scripting isn't always logical.

 

Bad logic.

!false should be true.

!true should be false.

 

And i'm fairly sure, it works that way too. I don't know what exactly went wrong in the example, though.


Avenger

#4 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 26 February 2018 - 09:33 AM

Negating a trigger don't seem to always be binary. E.g. neither TriggerOverride("ff_camp",IsOverMe("corwin")) nor !TriggerOverride("ff_camp",IsOverMe("corwin")) would return true if there was no ff_camp object.

 

I don't remember seeing such with spellstates, though/


Retired from modding.


#5 Avenger_teambg

Avenger_teambg
  • Member
  • 604 posts

Posted 26 February 2018 - 09:40 AM

Negating a trigger don't seem to always be binary. E.g. neither TriggerOverride("ff_camp",IsOverMe("corwin")) nor !TriggerOverride("ff_camp",IsOverMe("corwin")) would return true if there was no ff_camp object.

 

I don't remember seeing such with spellstates, though/

 

Yeah, you should use  TriggerOverride("ff_camp",!IsOverMe("corwin")) anyway i think. (And still fail the negation, if the object doesn't exist).

 

I don't know if triggeroverride would even notice the negation.

 

Anyway, this is triggeroverride's problem, not checkspellstate's.


Edited by Avenger_teambg, 26 February 2018 - 09:42 AM.

Avenger

#6 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 26 February 2018 - 11:51 AM

I'm using !CheckSpellState in some dialogues, to determine your proficiency level in place of CheckStat, and it seems to be working fine for me.

https://github.com/U...files/d5profx.d

#7 temnix

temnix
  • Member
  • 983 posts

Posted 26 February 2018 - 01:37 PM

I can't say anything about dialogues. The example is from scripts, and he who wants to look into it should replicate what is written.

 

And what is this with an explosion of answers on this board? Like someone has blasted it in his pants.



#8 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 26 February 2018 - 02:07 PM

Well, from what I can tell dialogues use precisely the same triggers and actions as scripts. Before people (including devs) start freaking out that the trigger is broken, I just wanted to point out that the trigger seems fine. At least in one context. And that I have an installable mod people can use to test further.

I suspect the problem here has to do with your test environment, not the trigger. But OTOH maybe there is some difference between how triggers are handled in .DLG versus .BCS. I'm no expert.

Edited by subtledoctor, 26 February 2018 - 02:08 PM.


#9 temnix

temnix
  • Member
  • 983 posts

Posted 26 February 2018 - 02:10 PM

Just insert the freaking dildo, I mean the code, in your BALDUR and see if you have different results. Instead of cooing like that Gaelan guy that everything is coo.



#10 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 26 February 2018 - 03:08 PM

Bad logic.

!false should be true.

!true should be false.

Yeah, it should be. You seem to be assuming the engine works logically though, and you should know better by now (basically what GeN1e said - negation doesn't always seem to work binarily).


Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#11 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 26 February 2018 - 03:17 PM

You keep your dildo, I'll stick to data points. Of which I have provided one. You'recwelcome.

#12 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 26 February 2018 - 04:15 PM

Works perfectly.

 

LAF ds_resolve_stat INT_VAR ids=1 STR_VAR id=PROTECTION_FROM_EVIL RET bless_state=stat_ind END

COPY_EXISTING sppr107.spl override
  LPF ADD_SPELL_EFFECT INT_VAR opcode=328 target=2 duration=36 parameter2=bless_state special=1 END

CLEAR_IDS_MAP

<<<<<<<<extend.baf
IF
    CheckSpellState(Player1,PROTECTION_FROM_EVIL)
THEN
    RESPONSE #1
        DisplayStringHead(Player1,~Protected.~)
END

IF
    !CheckSpellState(Player1,PROTECTION_FROM_EVIL)
THEN
    RESPONSE #1
        DisplayStringHead(Player1,~Not protected.~)
END
>>>>>>>>
EXTEND_TOP baldur25.bcs extend.baf

 


Retired from modding.


#13 Avenger_teambg

Avenger_teambg
  • Member
  • 604 posts

Posted 27 February 2018 - 08:43 AM

Bad logic.

!false should be true.

!true should be false.

Yeah, it should be. You seem to be assuming the engine works logically though, and you should know better by now (basically what GeN1e said - negation doesn't always seem to work binarily).

I know only about 'triggeroverride' and 'or' that are ignoring the negation flag. These are not real triggers.


Edited by Avenger_teambg, 27 February 2018 - 08:44 AM.

Avenger

#14 temnix

temnix
  • Member
  • 983 posts

Posted 27 February 2018 - 04:16 PM

TriggerOverride is real enough, and negation works with it. But Ardanis is right about spell states, and so is subtledoctor. Apparently my "environment" was to blame. When I reproduce the issue as Ardanis wrote, everything works.



#15 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 28 February 2018 - 07:47 AM

Blame climate change