Skip to content

I cannot replace IfValidForPartyDialog(Myself)

[Deleted User][Deleted User] Posts: 0
edited May 2021 in General Modding
I want to modify the file bddefai.bcs. For this purpose I have written this code:
ACTION_IF FILE_EXISTS_IN_GAME ~bddefai.bcs~ BEGIN
	COPY_EXISTING ~bddefai.bcs~ ~override~
		DECOMPILE_BCS_TO_BAF
			REPLACE_TEXTUALLY ~IF[%TAB% %LNL%%MNL%%WNL%]*Global("BDAI_DISABLE_ATTACK","LOCALS",0)[%TAB% %LNL%%MNL%%WNL%]*ActionListEmpty()[%TAB% %LNL%%MNL%%WNL%]*IfValidForPartyDialog(Myself)[%TAB% %LNL%%MNL%%WNL%]*CheckStat(Myself,0,SANCTUARY)[%TAB% %LNL%%MNL%%WNL%]*!ModalState(BATTLESONG)[%TAB% %LNL%%MNL%%WNL%]*See(NearestEnemyOf(Myself))[%TAB% %LNL%%MNL%%WNL%]*!StateCheck(NearestEnemyOf(Myself),STATE_REALLY_DEAD)[%TAB% %LNL%%MNL%%WNL%]*!Allegiance(NearestEnemyOf(Myself),GOODCUTOFF)[%TAB% %LNL%%MNL%%WNL%]*!IfValidForPartyDialog(NearestEnemyOf(Myself))[%TAB% %LNL%%MNL%%WNL%]*THEN[%TAB% %LNL%%MNL%%WNL%]*RESPONSE #100[%TAB% %LNL%%MNL%%WNL%]*AttackOneRound(NearestEnemyOf(Myself))[%TAB% %LNL%%MNL%%WNL%]*END~
			~~
			REPLACE_TEXTUALLY ~IF[%TAB% %LNL%%MNL%%WNL%]*Global("BDAI_ATTACK_MODE","LOCALS",2)[%TAB% %LNL%%MNL%%WNL%]*ActionListEmpty()[%TAB% %LNL%%MNL%%WNL%]*IfValidForPartyDialog(Myself)[%TAB% %LNL%%MNL%%WNL%]*IsWeaponRanged(Myself)[%TAB% %LNL%%MNL%%WNL%]*Range(NearestEnemyOf(Myself),4)[%TAB% %LNL%%MNL%%WNL%]*THEN[%TAB% %LNL%%MNL%%WNL%]*RESPONSE #100[%TAB% %LNL%%MNL%%WNL%]*EquipMostDamagingMelee()[%TAB% %LNL%%MNL%%WNL%]*Continue()[%TAB% %LNL%%MNL%%WNL%]*END~
			~~
		COMPILE_BAF_TO_BCS
		BUT_ONLY
END
Unfortunately, the relevant places will not be changed.
I have tested the following with positive result:
REPLACE_TEXTUALLY ~Global("BDAI_ATTACK_MODE","LOCALS",2)[%TAB% %LNL%%MNL%%WNL%]*ActionListEmpty()~ ~~
And I have tested the following with negative result:
REPLACE_TEXTUALLY ~IfValidForPartyDialog(Myself)~ ~~
It seems that I cannot replace IfValidForPartyDialog(Myself).
Does anyone have a suggestion?

Comments

  • kjeronkjeron Member Posts: 2,367
    Weidu decompiles using the last matching entry for actions/triggers, in this case:
    IsValidForPartyDialogue()
  • Can you tell me what to do?
  • Thank you. I have done it now.
  • kjeronkjeron Member Posts: 2,367
    FYI :
    You can see exactly what weidu is decompiling the script into by running this on the bcs file:
    COPY_EXISTING ~bddefai.bcs~ override
    	DECOMPILE_AND_PATCH	BEGIN	READ_ASCII	0 text (BUFFER_LENGTH)	PATCH_PRINT	~%text%~	END
    BUT_ONLY IF_EXISTS
    
    (It will create a scrolling wall of text in the install prompt, so for long scripts it's easier to look at the results in the weidu debug file.)

    As well, this:
    [%TAB% %LNL%%MNL%%WNL%]
    
    can be shortened to this:
    [%TAB% %WNL%]
    
    as WNL includes both LNL and MNL characters.
  • kjeron wrote: »
    As well, this:
    [%TAB% %LNL%%MNL%%WNL%]
    
    can be shortened to this:
    [%TAB% %WNL%]
    
    as WNL includes both LNL and MNL characters.

    That's good to know. Thank you very much!

Sign In or Register to comment.