Page 1 of 1

Issue with Assault.BSF script file

Posted: Mon Feb 25, 2019 7:33 am
by kvnrthr
Recently I was trying to change evasion behavior and was unable to get it to work.

I copied Assault.BSF into CustomCampaignName/Data/Scripts and edited it there.

I modified the function "DoEvadeAndPursuit", specifically this section here:

if ((IsUnitSquadType(me, "Cavalry") == 1) || (IsUnitSquadType(me, "Camelry") == 1)) // Cavalry and camelry can evade if not charged by cavalry or camelry
{
if ((IsUnitSquadType(enemy, "Cavalry") == 0) && (IsUnitSquadType(enemy, "Camelry") == 0))
{
evade = 1;
}
}

Basically I wanted to allow all cavalry/camelry to be able to evade other units, but cavalry would not be able to evade cavalry.

However I tested it in game and could not get it to work. The game didn't crash but the behavior didn't change. Do you know what might be causing this?

I tried testing this in Sengoku Jidai which has a similar file structure and ended up having to change the file in the main game directory rather than the custom campaign folder. Could there be some issue with which file takes precedence?

Re: Issue with Assault.BSF script file

Posted: Mon Feb 25, 2019 10:22 am
by rbodleyscott
Look at the chart at the end of this document:

http://archonwiki.slitherine.com/index.php/Modding

Modded scripts are supposed to go in

CustomCampaignName/Data/Battle/Scripts

rather than

CustomCampaignName/Data/Scripts
kvnrthr wrote: Mon Feb 25, 2019 7:33 amCould there be some issue with which file takes precedence?
There have been issues with that in the past, but I think they were fixed in ARCHON - possibly not in the STUB engine used by Sengoku Jidai. The old workaround was to add a copy of $DEFAULT.BSF to CustomCampaignName/Data/Battle/Scripts

-------------------------

You can test whether the game is running your modded script as follows:

1) Add the line

DEBUGMODE 1

to

/Documents/My Games/FieldOfGlory2/User.txt

2) Add the code

DebugLog("Yes, it is running this modded script");

after the variable definitions at the start of your DoEvadeAndPursuit() function.

3) Run the game and make something evade (or not evade).

4) Look at

/Documents/My Games/FieldOfGlory2/Error.log

to see if

Yes, it is running this modded script

appears.