Skip to content

Commit

Permalink
update to v4.1
Browse files Browse the repository at this point in the history
- Optimized the 7th party member fighting scripts: Solaufein can be given instructions via PID to "stay in sight" and how to engage with enemies.
  • Loading branch information
Gitjas committed Apr 9, 2023
1 parent 7cc26fa commit 16c266d
Show file tree
Hide file tree
Showing 24 changed files with 1,237 additions and 80 deletions.
45 changes: 45 additions & 0 deletions c#solaufein/7thpmm/c#7thpmm_thingies.tpa
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
COMPILE EVALUATE_BUFFER ~%MOD_FOLDER%/7thpmm/scripts/~

/* This line is crappy but I need one that works for Grey the dog, too */
ADD_SECTYPE C#1HPEffect @200000

/* 5 HP effect spell and a lot of other protections against deaths + Regeneration */
COPY ~%MOD_FOLDER%/7thpmm/spells/c#min5hp.spl~ ~override~
WRITE_BYTE 0x27 C#1HPEffect
WRITE_BYTE 0xa2 C#1HPEffect

/* remove 5 HP effect and all other protections */
COPY ~%MOD_FOLDER%/7thpmm/spells/c#min0hp.spl~ ~override~
WRITE_BYTE 0xa2 C#1HPEffect

/* Work-around: NPC gets restored after a fight */

COPY ~%MOD_FOLDER%/7thpmm/spells/c#7rest.spl~ ~override~ //This is A7REST from Argent's Djinni Companion!
SAY NAME1 @200000
SAY NAME2 @200000

/* bgee, bgt, eet, tob, bg2:ee */
ACTION_IF GAME_IS ~bgee bgt tob bg2ee eet~ THEN BEGIN
ACTION_IF !(FILE_CONTAINS_EVALUATED (~baldur.BCS~ ~"C#FATIG1"~))
THEN BEGIN
EXTEND_TOP ~baldur.bcs~ ~%MOD_FOLDER%/7thpmm/script_patch/c#_7thpm_baldur_add.baf~
COPY ~%MOD_FOLDER%/7thpmm/spells/C#FATIG1.SPL~ ~override~
END
END

/* SoD, eet */
ACTION_IF (GAME_IS ~bgee eet~ AND FILE_EXISTS_IN_GAME ~bd0103.are~) THEN BEGIN ACTION_IF !(FILE_CONTAINS_EVALUATED (~bdbaldur.BCS~ ~"C#FATIG1"~))
THEN BEGIN
EXTEND_TOP ~bdbaldur.bcs~ ~%MOD_FOLDER%/7thpmm/script_patch/c#_7thpm_baldur_add.baf~
COPY ~%MOD_FOLDER%/7thpmm/spells/C#FATIG1.SPL~ ~override~
END
END

/* bgt, eet, tob, bg2:ee */
ACTION_IF GAME_IS ~bgt tob bg2ee eet~ THEN BEGIN
ACTION_IF !(FILE_CONTAINS_EVALUATED (~baldur25.BCS~ ~"C#FATIG1"~))
THEN BEGIN
EXTEND_TOP ~baldur25.bcs~ ~%MOD_FOLDER%/7thpmm/script_patch/c#_7thpm_baldur_add.baf~
COPY ~%MOD_FOLDER%/7thpmm/spells/C#FATIG1.SPL~ ~override~
END
END
File renamed without changes.
118 changes: 118 additions & 0 deletions c#solaufein/7thpmm/script_patch/set_7pmm_scripts.baf
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/* automatic scripts for 7th party member mode */

/* reset scripts choice if no 7th PM */
IF
OR(2) InParty(Myself) Global("C#%NPCname%Joined","GLOBAL",0)
OR(9)
GlobalGT("c#gotopc","LOCALS",0)
GlobalGT("c#traps","LOCALS",0)
GlobalGT("c#mage1","LOCALS",0)
GlobalGT("c#mage2","LOCALS",0)
GlobalGT("c#cautio","LOCALS",0)
GlobalGT("c#melee","LOCALS",0)
GlobalGT("c#ranged","LOCALS",0)
GlobalGT("c#defend","LOCALS",0)
GlobalGT("c#nothin","LOCALS",0)
THEN
RESPONSE #100
SetGlobal("c#gotopc","LOCALS",0)
SetGlobal("c#traps","LOCALS",0)
SetGlobal("c#mage1","LOCALS",0)
SetGlobal("c#mage2","LOCALS",0)
SetGlobal("c#cautio","LOCALS",0)
SetGlobal("c#melee","LOCALS",0)
SetGlobal("c#ranged","LOCALS",0)
SetGlobal("c#defend","LOCALS",0)
SetGlobal("c#nothin","LOCALS",0)
END


/* stay in sight */
IF
Global("C#%NPCname%Joined","GLOBAL",2)
Global("c#gotopc","LOCALS",1)
THEN
RESPONSE #100
ChangeAIScript("c#gotopc",DEFAULT)
SetGlobal("c#gotopc","LOCALS",2)
END

/* look out for traps */
IF
Global("C#%NPCname%Joined","GLOBAL",2)
Global("c#traps","LOCALS",1)
THEN
RESPONSE #100
ChangeAIScript("c#traps",GENERAL)
SetGlobal("c#traps","LOCALS",2)
END

/* c#mage1 - fight enemies you see with magic */
IF
Global("C#%NPCname%Joined","GLOBAL",2)
Global("c#mage1","LOCALS",1)
THEN
RESPONSE #100
ChangeAIScript("c#mage1",CLASS)
SetGlobal("c#mage1","LOCALS",2)
END

/* c#mage2 - prepare yourself and fight enemies with magic */
IF
Global("C#%NPCname%Joined","GLOBAL",2)
Global("c#mage2","LOCALS",1)
THEN
RESPONSE #100
ChangeAIScript("c#mage2",CLASS)
SetGlobal("c#mage2","LOCALS",2)
END

/* c#cautio - run away from enemies */
IF
Global("C#%NPCname%Joined","GLOBAL",2)
Global("c#cautio","LOCALS",1)
THEN
RESPONSE #100
ChangeAIScript("c#cautio",CLASS)
SetGlobal("c#cautio","LOCALS",2)
END

/* c#melee - fight with melee weapons */
IF
Global("C#%NPCname%Joined","GLOBAL",2)
Global("c#melee","LOCALS",1)
THEN
RESPONSE #100
ChangeAIScript("c#melee",CLASS)
SetGlobal("c#melee","LOCALS",2)
END

/* c#ranged - fight with ranged weapons */
IF
Global("C#%NPCname%Joined","GLOBAL",2)
Global("c#ranged","LOCALS",1)
THEN
RESPONSE #100
ChangeAIScript("c#ranged",CLASS)
SetGlobal("c#ranged","LOCALS",2)
END

/* c#defend - only defend yourself if attacked */
IF
Global("C#%NPCname%Joined","GLOBAL",2)
Global("c#defend","LOCALS",1)
THEN
RESPONSE #100
ChangeAIScript("c#defend",CLASS)
SetGlobal("c#defend","LOCALS",2)
END

/* do absolutely nothing in a fight */
IF
Global("C#%NPCname%Joined","GLOBAL",2)
Global("c#nothin","LOCALS",1)
THEN
RESPONSE #100
ChangeAIScript("",CLASS)
SetGlobal("c#nothin","LOCALS",2)
END
26 changes: 26 additions & 0 deletions c#solaufein/7thpmm/scripts/c#cautio.baf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
IF
HPPercentLT(Myself,75)
See(NearestEnemyOf(Myself))
THEN
RESPONSE #100
Help()
Continue()
END

IF
ActionListEmpty()
AttackedBy([ANYONE],DEFAULT)
THEN
RESPONSE #100
RunAwayFrom(LastAttackerOf(Myself),150)
END

IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
Range(LastSeenBy(Myself),20)
ActionListEmpty()
THEN
RESPONSE #100
RunAwayFrom(LastSeenBy(Myself),150)
END
19 changes: 19 additions & 0 deletions c#solaufein/7thpmm/scripts/c#defend.baf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
IF
AttackedBy([ENEMY],DEFAULT)
Range(LastAttackerOf(Myself),4)
ActionListEmpty()
THEN
RESPONSE #100
EquipMostDamagingMelee()
AttackReevaluate(LastAttackerOf(Myself),30)
END

IF
AttackedBy([ENEMY],DEFAULT)
!Range(LastAttackerOf(Myself),4)
ActionListEmpty()
THEN
RESPONSE #100
EquipRanged()
AttackReevaluate(LastAttackerOf(Myself),30)
END
8 changes: 8 additions & 0 deletions c#solaufein/7thpmm/scripts/c#gotopc.baf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
IF
ActionListEmpty()
InMyArea(Player1)
!Range(Player1,15)
THEN
RESPONSE #100
MoveToObject(Player1)
END
Loading

0 comments on commit 16c266d

Please sign in to comment.