Jump to content

Controls auto-haste of party members (EE 2.0+ solution) - Include Familiar


Guest Goluff

Recommended Posts

Hey, can't add a commit suggestion to the github page and I don't know where to post it elsewhere. I was looking for a solution to include the familiar this morning, couldn't find one, so I changed the code. My solution works well after 3h of gameplay. If you want to add it to the Tweak Anthology, here is the modified file : a7#haste_splstate.baf

Spoiler

// Controls auto-haste of party members (EE 2.0+ solution)

IF
  Global("A7_AutoHasteActive","GLOBAL",1)
  OR(2)
    !GlobalTimerNotExpired("A7_AutoHasteTimerP1","GLOBAL")
    !CheckSpellState(Player1,A7_AUTO_SPEED)
  !TriggerOverride(Player1,Detect([ENEMY]))
  !ActuallyInCombat()
THEN
  RESPONSE #100
    SetGlobalTimer("A7_AutoHasteTimerP1","GLOBAL",6)
    ApplySpellRES("a7_wlk1",Player1)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",1)
  OR(2)
    !GlobalTimerNotExpired("A7_AutoHasteTimerP2","GLOBAL")
    !CheckSpellState(Player2,A7_AUTO_SPEED)
  !TriggerOverride(Player2,Detect([ENEMY]))
  !ActuallyInCombat()
THEN
  RESPONSE #100
    SetGlobalTimer("A7_AutoHasteTimerP2","GLOBAL",6)
    ApplySpellRES("a7_wlk1",Player2)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",1)
  OR(2)
    !GlobalTimerNotExpired("A7_AutoHasteTimerP3","GLOBAL")
    !CheckSpellState(Player3,A7_AUTO_SPEED)
  !TriggerOverride(Player3,Detect([ENEMY]))
  !ActuallyInCombat()
THEN
  RESPONSE #100
    SetGlobalTimer("A7_AutoHasteTimerP3","GLOBAL",6)
    ApplySpellRES("a7_wlk1",Player3)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",1)
  OR(2)
    !GlobalTimerNotExpired("A7_AutoHasteTimerP4","GLOBAL")
    !CheckSpellState(Player4,A7_AUTO_SPEED)
  !TriggerOverride(Player4,Detect([ENEMY]))
  !ActuallyInCombat()
THEN
  RESPONSE #100
    SetGlobalTimer("A7_AutoHasteTimerP4","GLOBAL",6)
    ApplySpellRES("a7_wlk1",Player4)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",1)
  OR(2)
    !GlobalTimerNotExpired("A7_AutoHasteTimerP5","GLOBAL")
    !CheckSpellState(Player5,A7_AUTO_SPEED)
  !TriggerOverride(Player5,Detect([ENEMY]))
  !ActuallyInCombat()
THEN
  RESPONSE #100
    SetGlobalTimer("A7_AutoHasteTimerP5","GLOBAL",6)
    ApplySpellRES("a7_wlk1",Player5)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",1)
  OR(2)
    !GlobalTimerNotExpired("A7_AutoHasteTimerP6","GLOBAL")
    !CheckSpellState(Player6,A7_AUTO_SPEED)
  !TriggerOverride(Player6,Detect([ENEMY]))
  !ActuallyInCombat()
THEN
  RESPONSE #100
    SetGlobalTimer("A7_AutoHasteTimerP6","GLOBAL",6)
    ApplySpellRES("a7_wlk1",Player6)
    Continue()
END

IF
    Global("A7_AutoHasteActive","GLOBAL",1)
    Exists(Familiar)
    OR(2)
        !GlobalTimerNotExpired("A7_AutoHasteTimerFam","GLOBAL")
        !CheckSpellState(Familiar,138)
    !TriggerOverride(Familiar,Detect([ENEMY]))
    !ActuallyInCombat()
THEN
    RESPONSE #100
        SetGlobalTimer("A7_AutoHasteTimerFam","GLOBAL",ONE_ROUND)
        ApplySpellRES("a7_wlk1",Familiar)
        Continue()
END


IF
  Global("A7_AutoHasteActive","GLOBAL",1)
  CheckSpellState(Player1,A7_AUTO_SPEED)
  OR(2)
    TriggerOverride(Player1,Detect([ENEMY]))
    ActuallyInCombat()
THEN
  RESPONSE #100
    ApplySpellRES("a7_wlk2",Player1)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",1)
  CheckSpellState(Player2,A7_AUTO_SPEED)
  OR(2)
    TriggerOverride(Player2,Detect([ENEMY]))
    ActuallyInCombat()
THEN
  RESPONSE #100
    ApplySpellRES("a7_wlk2",Player2)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",1)
  CheckSpellState(Player3,A7_AUTO_SPEED)
  OR(2)
    TriggerOverride(Player3,Detect([ENEMY]))
    ActuallyInCombat()
THEN
  RESPONSE #100
    ApplySpellRES("a7_wlk2",Player3)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",1)
  CheckSpellState(Player4,A7_AUTO_SPEED)
  OR(2)
    TriggerOverride(Player4,Detect([ENEMY]))
    ActuallyInCombat()
THEN
  RESPONSE #100
    ApplySpellRES("a7_wlk2",Player4)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",1)
  CheckSpellState(Player5,A7_AUTO_SPEED)
  OR(2)
    TriggerOverride(Player5,Detect([ENEMY]))
    ActuallyInCombat()
THEN
  RESPONSE #100
    ApplySpellRES("a7_wlk2",Player5)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",1)
  CheckSpellState(Player6,A7_AUTO_SPEED)
  OR(2)
    TriggerOverride(Player6,Detect([ENEMY]))
    ActuallyInCombat()
THEN
  RESPONSE #100
    ApplySpellRES("a7_wlk2",Player6)
    Continue()
END

IF
    Global("A7_AutoHasteActive","GLOBAL",1)
    Exists(Familiar)
    !CheckSpellState(Familiar,138)
    OR(2)
        TriggerOverride(Familiar,Detect([ENEMY]))
        ActuallyInCombat()
THEN
    RESPONSE #100
        ApplySpellRES("a7_wlk2",Familiar)
        Continue()
END


IF
  Global("A7_AutoHasteActive","GLOBAL",0)
  CheckSpellState(Player1,A7_AUTO_SPEED)
THEN
  RESPONSE #100
    ApplySpellRES("a7_wlk2",Player1)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",0)
  CheckSpellState(Player2,A7_AUTO_SPEED)
THEN
  RESPONSE #100
    ApplySpellRES("a7_wlk2",Player2)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",0)
  CheckSpellState(Player3,A7_AUTO_SPEED)
THEN
  RESPONSE #100
    ApplySpellRES("a7_wlk2",Player3)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",0)
  CheckSpellState(Player4,A7_AUTO_SPEED)
THEN
  RESPONSE #100
    ApplySpellRES("a7_wlk2",Player4)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",0)
  CheckSpellState(Player5,A7_AUTO_SPEED)
THEN
  RESPONSE #100
    ApplySpellRES("a7_wlk2",Player5)
    Continue()
END

IF
  Global("A7_AutoHasteActive","GLOBAL",0)
  CheckSpellState(Player6,A7_AUTO_SPEED)
THEN
  RESPONSE #100
    ApplySpellRES("a7_wlk2",Player6)
    Continue()
END

IF
    Global("A7_AutoHasteActive","GLOBAL",0)
    Exists(Familiar)
    !CheckSpellState(Familiar,138)
THEN
    RESPONSE #100
        ApplySpellRES("a7_wlk2",Familiar)
        Continue()
END

I could not test for the non-ee edition, so not included, must be really similar, but hey not sure. 

Any comments are welcome!

Link to comment

Thanks for the reminder. I planned to expand this feature to support familiars, but couldn't find the time to actually implement it until now. I have rewritten the code to be more flexible (see commit). Non-EE games and EE games prior to patch 2.0 don't (properly) support the Familiar target which makes it a bit more complicated for these games, but I found a workaround for this issue.

The code also supports special familiar-type followers (provided they exist at install time). @jastey I think one your mods provides a familiar-type follower? If you can tell me their cre resref and script name I can add it to the list.

Link to comment

@argent77 thank you! I have NPCs that can do both - be a full party member or follow in "familiar" mode. Does that make sense to add them? The cre files would be:

Brandock the Mage:  c#bran01.cre, c#bran02.cre, c#bran03.cre

Grey the Dog: c#grey02.cre, c#grey03.cre

Solaufein: C#Sola12.cre, C#Soltob.cre

I have another NPC in the make but the mod is not public yet.

 

Link to comment

Yes, that should work fine. The code checks the FAMILIAR status, so that speed increase is only applied when the creature is in follower mode.

@jastey Just to make sure, are these value correct? (Cre resref is only used to check for creature existence during install time.)

// cre resref => script name
~c#bran01~ => ~c#brandock~
~c#grey02~ => ~c#grey~
~c#sola12~ => ~c#solaufein~

 

Link to comment
15 minutes ago, argent77 said:

Just to make sure, are these value correct? (Cre resref is only used to check for creature existence during install time.)


// cre resref => script name
~c#bran01~ => ~c#brandock~
~c#grey02~ => ~c#grey~
~c#sola12~ => ~c#solaufein~

Yes, sorry, I forgot to give the script names. They are correct.

Link to comment
38 minutes ago, jastey said:

Yes, sorry, I forgot to give the script names. They are correct.

Should you not have a different script for the different states of either being a familiar type or a party member. Cause for me at least, having a party member that autolevels up is a horrible idea, but NOT if it's a familiar type, cause that kinda needs to happen or they will not level up at all.

EDIT: ahh, never mind, script name is not the assigned scripts name. ... horrible naming thing, hmm, I wish it were .cre's "command name".

Edited by Jarno Mikkola
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...