Jump to content

Party AI on/off: Detection in game?


Recommended Posts

Is there a way to detect whether the party AI is toggled off (or on)?

My problem is that I assign a script as CLASS script to my NPC when in 7th party member mode (FAMILIAR) which gets executed also if AI is off, which is bad.

Alternatively: Is there a script slot for a FAMILIAR party member that is also affected by the AI button?

Link to comment

I'm afraid it's impossible in classic games. The only place the engine exposes such information is to the UI in v2.0+ Enhanced Edition games, (to render the button on the worldscreen in the correct state). It would be possible to rig UI.MENU to toggle a GLOBAL according to the current state of the party AI, but that's about it.

Link to comment
34 minutes ago, Bubb said:

It would be possible to rig UI.MENU to toggle a GLOBAL according to the current state of the party AI, but that's about it.

Meaning I would need to mod the UI so it gives the GLOBAL?

Thank you very much for the info!

Link to comment
1 hour ago, Bubb said:

I'm afraid it's impossible in classic games. The only place the engine exposes such information is to the UI in v2.0+ Enhanced Edition games, (to render the button on the worldscreen in the correct state). It would be possible to rig UI.MENU to toggle a GLOBAL according to the current state of the party AI, but that's about it.

Well, PSTEE provides a PartyScriptsActive() trigger, which does exactly what the name suggests. Unfortuntately it hasn't been implemented in the other EE games. This feature would have been useful in some of my mods as well.

Link to comment
42 minutes ago, jastey said:

Meaning I would need to mod the UI so it gives the GLOBAL?

Correct - you can do something like this:

Append to the very top of UI.MENU =>

Spoiler

`
B3OldPartyAI = nil

function B3CheckPartyAITick()
    if aiButtonToggle ~= B3OldPartyAI then
        B3OldPartyAI = aiButtonToggle
        C:SetGlobal("B3PartyAI", "GLOBAL", aiButtonToggle)
    end
    return false
end
`

menu
{
    name "B3CheckPartyAI"
    label
    {
        enabled "B3CheckPartyAITick()"
    }
}

 

Use WeiDU to replace this part of UI.MENU:

Spoiler

Infinity_PushMenu('WORLD_MESSAGES')
if(groundItemsButtonToggle == 1) then

 

with =>

Spoiler

if not Infinity_IsMenuOnStack('B3CheckPartyAI') then
    Infinity_PushMenu('B3CheckPartyAI')
end
Infinity_PushMenu('WORLD_MESSAGES')
if(groundItemsButtonToggle == 1) then

 

 

This patch works for the vanilla UI, (it might break if a UI mod alters the wrong part of WORLD_ACTIONBAR). You can then, in scripts, check if Party AI is enabled with:

Global("B3PartyAI","GLOBAL",1)

Zero being disabled, of course.

 

12 minutes ago, argent77 said:

Well, PSTEE provides a PartyScriptsActive() trigger, which does exactly what the name suggests. Unfortuntately it hasn't been implemented in the other EE games. This feature would have been useful in some of my mods as well.

I always forget that PST:EE had some unique features; I agree, would be nice if some of those were merged into the normal EE branch.

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