Jump to content

Detect state: Maze


Recommended Posts

I'm looking for a way to reliable detect that object is under maze effect. It seems there is not built-in state for it. There is also no spell state, but I'm thinking about adding one. Problem is that maze opcode can have dynamic duration, dependent on objects intelligence and also has some randomness in it. So, if I understand correctly, I will not be able to apply spell state with accurate duration. TBH maybe I don't need super accurate sync between spell state and actual effect, still it would be nice to have one if possible. Anyone maybe some hints regarding this?

Link to comment

What are you trying to do with this detection? Because it might be a moot point; mazed objects don't run scripts, and there may be other ways in which they register as "not there". If a mazed creature would earn experience from a kill with a lingering spell effect, for example, that experience doesn't come in until the creature returns to the field.

Link to comment
1 hour ago, jmerry said:

What are you trying to do with this detection? Because it might be a moot point; mazed objects don't run scripts, and there may be other ways in which they register as "not there". If a mazed creature would earn experience from a kill with a lingering spell effect, for example, that experience doesn't come in until the creature returns to the field.

Basically I wan to run script actions when all PCs are in maze.

I do similar thing for charm, I extended global script with script block:

    IF
        StateCheck(Player1, STATE_CHARMED)
        OR(3)
            !Exists(Player2)
            StateCheck(Player2, STATE_REALLY_DEAD)
            StateCheck(Player2, STATE_CHARMED)
        OR(3)
            !Exists(Player3)
            StateCheck(Player3, STATE_REALLY_DEAD)
            StateCheck(Player3, STATE_CHARMED)
        OR(3)
            !Exists(Player4)
            StateCheck(Player4, STATE_REALLY_DEAD)
            StateCheck(Player4, STATE_CHARMED)
        OR(3)
            !Exists(Player5)
            StateCheck(Player5, STATE_REALLY_DEAD)
            StateCheck(Player5, STATE_CHARMED)
        OR(3)
            !Exists(Player6)
            StateCheck(Player6, STATE_REALLY_DEAD)
            StateCheck(Player6, STATE_CHARMED)
    THEN
        RESPONSE #100
            ClearAllActions()
            StartCutSceneMode()
            StartCutSceneEx("%respawn_execution_cutscene%", TRUE)
    END

I want to extend with with "maze" check. That's why I thought about state and spell state.

On a side note: normally this situation means "Game Over", but I have "Player1 can die" flag set on area, that prevents this.

 

Link to comment
On 3/30/2023 at 10:25 AM, jmerry said:

What are you trying to do with this detection? Because it might be a moot point; mazed objects don't run scripts, and there may be other ways in which they register as "not there". If a mazed creature would earn experience from a kill with a lingering spell effect, for example, that experience doesn't come in until the creature returns to the field.

I tested that and you are right, checking spell state not work correctly for creatures in maze. It seems it returns always false.

IESDP says:

Quote

[...] targeted creature(s) is suspended from the area:

  • They can not be targeted by Area-Effect projectiles, only with effect targets Party or Everyone or similar.
  • They are not detectable by any script triggers, though they may still be targeted with actions directly by scriptname or partyslot.
  • Excluding Opcodes #211/#212/#213:
    • All other effects on the creature are suppressed until this effect is removed.
  • Excluding opcode #212:
    • Delayed effects that would trigger will be further delayed until this effect is removed.
    • Effects that would expire will not expire until this effect is removed.

I tried to get desired effect with "partyslot" objects ( PartySlot1, Player1Fill etc), but no luck so far. :( 

Link to comment

Ok, this spell state is dead end. Now I'm not surprised that such state not exists, since creatures in maze are untargetable anyway.

I think I found solution for my case. Is uses variables instead of spell state. I take advantage of fact that I need to only track state of 6 specific objects in game. And even synchronization of detection and actual effect is good. It goes more or less like this:

  • for every maze effect set local variable on object before maze effect triggers
  • for every maze effect set delayed unset of this local variable (note: "Delayed effects that would trigger will be further delayed until this effect is removed." from IESDP)
  • in global script synchronize local variable with global variable dedicated to creature (if Player1 local InMaze = 1 then set global Player1InMaze = 1 and other way round etc.)
  • watch in scripts for global variables (obviously this works despite of any creature being or not in maze)

In time between setting local var and triggering maze (what would make accessing local var impossible), local and global var is synchronized. Then, when creature is back form maze, delayed unset of local var is triggered and synchronization in global script removes global variable.

BTW It seems that ClearAllActions() removes maze effect. Maybe it triggers this delayed freedom effect that removes maze? Hard to say. Or maybe this works like this only for my case for some particular reason.

 

Link to comment

You should be able to check the local variables directly. Note that mazed creatures can only be targeted via script name or a static-ish OBJECT.IDS reference. Actions that "target" creatures (i.e. make the target's marker change) are specifically disallowed from seeing mazed creatures. ActionOverride() should be able to get a mazed creature to do an instant action. Triggers seem to evaluate normally, e.g. the following works:

TriggerOverride(PartySlot1,Global("B3MAZE","LOCALS",1))

The reason why spell states can't be detected during maze / imprisonment is that the engine stops applying opcodes to the creature, except for #212 (0xD4) Protection: Freedom, #213 (0xD5) Spell Effect: Maze, and #233 (0xE9) Stat: Proficiency Modifier.

Link to comment
18 hours ago, Bubb said:

You should be able to check the local variables directly. Note that mazed creatures can only be targeted via script name or a static-ish OBJECT.IDS reference. Actions that "target" creatures (i.e. make the target's marker change) are specifically disallowed from seeing mazed creatures. ActionOverride() should be able to get a mazed creature to do an instant action. Triggers seem to evaluate normally, e.g. the following works:

TriggerOverride(PartySlot1,Global("B3MAZE","LOCALS",1))

You are right! Works even with Player1 instead of PartySlot1. I'm quite sure I tested that with Player1 and it didn't work, but well.. I guess engine haven't changed its behavior during time in between. :D Thank you! You saved me 12 blocks in global script and now this synchronization between check and actual effect is exact.

 

18 hours ago, Bubb said:

The reason why spell states can't be detected during maze / imprisonment is that the engine stops applying opcodes to the creature, except for #212 (0xD4) Protection: Freedom, #213 (0xD5) Spell Effect: Maze, and #233 (0xE9) Stat: Proficiency Modifier.

So internally it is something like engine for each game tick iterate over all "active" creatures (global + in active area?), checks their effects and acts accordingly (remove if duration is finished, apply when delay is finished, apply damage if this is poison opcode etc)? And for creatures in maze engine ignores in this process all opcodes besides those you mentioned. Then spell state is not recognized because it was not "applied" in this game tick, despite of being applied as effect in general (it is still visible in EEKeeper etc). I hope this is at least more or less what is happening. :D 

***

I know what makes my previous test not accurate. This. Beware for this TriggerOverride + OR pitfall.

Edited by marchitek
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...