Jump to content

StateCheck("NPC",STATE_xxx) does not work?


Recommended Posts

Posted (edited)
IF ~~ THEN BEGIN JoinSixtarchInBetrayal
    SAY ~Sixtarch i want to join you for i have score to settle whoever betrayed us!~
    IF ~OR (10)
            !Dead("rqt5clf1")
            !StateCheck("rqt5clf1",STATE_HELPLESS)
            !StateCheck("rqt5clf1",STATE_STUNNED)
            !StateCheck("rqt5clf1",STATE_PANIC)
            !StateCheck("rqt5clf1",STATE_BERSERK)
            !StateCheck("rqt5clf1",STATE_SLEEPING)
            !StateCheck("rqt5clf1",STATE_SILENCED)
            !StateCheck("rqt5clf1",STATE_CHARMED)
            !StateCheck("rqt5clf1",STATE_FEEBLEMINDED)
            !StateCheck("rqt5clf1",STATE_CONFUSED)~ THEN EXTERN ~rqt5dea1~ YouTooItwantos
    IF ~~ THEN EXTERN ~rqt7dea2~ JoinUpThenSixtarchSays
END

I have created this check to see if neutral NPC is available for dialog however it does not work. My NPC fail every check despite not being afflicted by any of above negative status effects

Edited by svj
Link to comment
Posted (edited)

I'am not sure if this is your issue, but you check everything with "OR", why it should be checked with "AND". "OR" returns true if any of its statement is true. To start the dialog you want to be sure that the characeter is not dead and is not in panic and is not stunned, etc. So, the correct statement should be:

IF ~        !Dead("rqt5clf1")
            !StateCheck("rqt5clf1",STATE_HELPLESS)
            !StateCheck("rqt5clf1",STATE_STUNNED)
            !StateCheck("rqt5clf1",STATE_PANIC)
            !StateCheck("rqt5clf1",STATE_BERSERK)
            !StateCheck("rqt5clf1",STATE_SLEEPING)
            !StateCheck("rqt5clf1",STATE_SILENCED)
            !StateCheck("rqt5clf1",STATE_CHARMED)
            !StateCheck("rqt5clf1",STATE_FEEBLEMINDED)
            !StateCheck("rqt5clf1",STATE_CONFUSED)~ THEN

Hovewer, your OR statement should return true more oftern than the same AND statement, so idk why the original OR statement doesn't work for you (even if it is wrong).

Edited by paladin84
Link to comment

@argent77

No such check in state.ids

!StateCheck("rqt5clf1",CD_STATE_NOTVALID)

@lynx

32 minutes ago, lynx said:

I think the problem is that except in iwd2, all OR conditions get evaluated — it doesn't get short-circuited.

If i understood this correctly OR in BG2 does NOT work if either of these are conditions is correct. it evaluates true

 

 

 

 

Link to comment
2 minutes ago, svj said:

No such check in state.ids

!StateCheck("rqt5clf1",CD_STATE_NOTVALID)

Is this for original BG2? In that case you might have to add this entry manually to STATE.IDS:

0x80101FEF CD_STATE_NOTVALID

 

Link to comment
IF ~~ THEN BEGIN DSKnowledge
    SAY ~We can provide you with magical items and perhaps in future you might have use further use of our talents.~
    IF ~!Dead("rqt5clf1")
        !StateCheck("rqt5clf1",STATE_HELPLESS)
        !StateCheck("rqt5clf1",STATE_STUNNED)
        !StateCheck("rqt5clf1",STATE_PANIC)
        !StateCheck("rqt5clf1",STATE_BERSERK)
        !StateCheck("rqt5clf1",STATE_SLEEPING)
        !StateCheck("rqt5clf1",STATE_SILENCED)
        !StateCheck("rqt5clf1",STATE_CHARMED)
        !StateCheck("rqt5clf1",STATE_FEEBLEMINDED)
        !StateCheck("rqt5clf1",STATE_CONFUSED)~ THEN EXTERN ~rqt5dea1~ BetrayalIrgulisReaction
    IF ~!Dead("rqt6clf1")
        !StateCheck("rqt6clf1",STATE_HELPLESS)
        !StateCheck("rqt6clf1",STATE_STUNNED)
        !StateCheck("rqt6clf1",STATE_PANIC)
        !StateCheck("rqt6clf1",STATE_BERSERK)
        !StateCheck("rqt6clf1",STATE_SLEEPING)
        !StateCheck("rqt6clf1",STATE_SILENCED)
        !StateCheck("rqt6clf1",STATE_CHARMED)
        !StateCheck("rqt6clf1",STATE_FEEBLEMINDED)
        !StateCheck("rqt6clf1",STATE_CONFUSED)~ THEN EXTERN ~rqt6dea2~ JoinSixtarchInBetrayal
    IF ~~ THEN GOTO EyesandEars
END

If i use THEN EXTERN this check always fails however if use this in THEN REPLY it actually works.

Works

IF ~~ THEN BEGIN IdoNotKnowWhoisEnemy
    SAY ~If i knew who it was i would go kill it right now!~
    IF ~!Dead("rqt5clf1")
        !StateCheck("rqt5clf1",STATE_HELPLESS)
        !StateCheck("rqt5clf1",STATE_STUNNED)
        !StateCheck("rqt5clf1",STATE_PANIC)
        !StateCheck("rqt5clf1",STATE_BERSERK)
        !StateCheck("rqt5clf1",STATE_SLEEPING)
        !StateCheck("rqt5clf1",STATE_SILENCED)
        !StateCheck("rqt5clf1",STATE_CHARMED)
        !StateCheck("rqt5clf1",STATE_FEEBLEMINDED)
        !StateCheck("rqt5clf1",STATE_CONFUSED)~ THEN REPLY ~Why should i let you go?~ EXTERN ~rqt5dea1~ ItwantosTreasonReac2
    IF ~Dead("rqt5clf1")~ THEN REPLY ~Why should i let you go?~ GOTO EscapeAndGiveInventory
END

@argent77

Would that new statecheck work and not conflict other mods perhaps adding same?

Link to comment
29 minutes ago, svj said:

Would that new statecheck work and not conflict other mods perhaps adding same?

In a mod you would add it like this to prevent that the entry is added multiple times.

APPEND "state.ids" "0x80101FEF CD_STATE_NOTVALID" UNLESS "CD_STATE_NOTVALID"

CD_STATE_NOTVALID combines all of the individual disabling states as well as the various death states (STATE_DEAD, STATE_FROZEN_DEATH, ...), so it should cover all situations you have previously covered with the death check and individual state checks.

The reason why your first code sample (without REPLY) doesn't work as intended is that dialog transitions are checked bottom-up, and the first matching state will be executed. That's always "IF ~~ THEN GOTO EyesandEars" in your case. That can be fixed by reordering your list of transitions.

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