Script modding exemple: vehicles in melee
Posted: Sat Jan 28, 2017 4:10 pm
Here is how to change the scripts to make vehicles not stuck in melee anymore, that should help those unfamiliar with the engine to make other changes to the scripts:
First, create a new campaign by cloning an existing one (aka select the option to copy an existing campaign when you create a new one) in the editor.
Then, create the following folders in the new campaign folder (it should be in my documents/SanctusReach):
MyDocs/SanctusReach/MyCampaig/Data
MyDocs/SanctusReach/MyCampaig/Data/Scripts
MyDocs/SanctusReach/MyCampaig/Data/Battle/Scripts
copy Move.BSF(from your SanctusReach main folder: SteamApps/Common/Warhammer40000SanctusReach/Data/Battle/Scripts/Move.BSF to MyDocs/SanctusReach/MyCampaign/Data/Battle/Scripts
copy Functions.BSF(from your SanctusReach main folder: SteamApps/Common/Warhammer40000SanctusReach/Scripts/Functions.BSF to MyDocs/SanctusReach/MyCampaign/Data/Battle/Scripts
In your copy of
Move.BSF:
in
FUNCTION CHECK_ALL_MOVE(me, tilex, tiley, force)
replace if (IsMeleeEnemyAdjacent2(me) > 0)
with
if (IsMeleeEnemyAdjacent2(me) > 0 && GetAttrib(me, "IsVehicle") == 0)
and in
Functions.BSF
FUNCTION CheckMovePossible ( me, x, y, retreating, showRoute, ignoreUnseen )
replace :
if (IsMeleeEnemyAdjacentToTile(me, GetCheckRouteX(r-1), GetCheckRouteY(r-1)) > 0 )
with
if (IsMeleeEnemyAdjacentToTile(me, GetCheckRouteX(r-1), GetCheckRouteY(r-1)) > 0 && GetAttrib(me, "IsVehicle") == 0)
To enable the new files, copy SteamApps/Common/Warhammer40000SanctusReach/Scripts/$DEFAULT.BSF to MyDocs/SanctusReach/MyCampaign/Data/Battle/Scripts
Unless I forgot something, it should work.
Note that vehicles will also ignore walkers ZoC when moving.
First, create a new campaign by cloning an existing one (aka select the option to copy an existing campaign when you create a new one) in the editor.
Then, create the following folders in the new campaign folder (it should be in my documents/SanctusReach):
MyDocs/SanctusReach/MyCampaig/Data
MyDocs/SanctusReach/MyCampaig/Data/Scripts
MyDocs/SanctusReach/MyCampaig/Data/Battle/Scripts
copy Move.BSF(from your SanctusReach main folder: SteamApps/Common/Warhammer40000SanctusReach/Data/Battle/Scripts/Move.BSF to MyDocs/SanctusReach/MyCampaign/Data/Battle/Scripts
copy Functions.BSF(from your SanctusReach main folder: SteamApps/Common/Warhammer40000SanctusReach/Scripts/Functions.BSF to MyDocs/SanctusReach/MyCampaign/Data/Battle/Scripts
In your copy of
Move.BSF:
in
FUNCTION CHECK_ALL_MOVE(me, tilex, tiley, force)
replace if (IsMeleeEnemyAdjacent2(me) > 0)
with
if (IsMeleeEnemyAdjacent2(me) > 0 && GetAttrib(me, "IsVehicle") == 0)
and in
Functions.BSF
FUNCTION CheckMovePossible ( me, x, y, retreating, showRoute, ignoreUnseen )
replace :
if (IsMeleeEnemyAdjacentToTile(me, GetCheckRouteX(r-1), GetCheckRouteY(r-1)) > 0 )
with
if (IsMeleeEnemyAdjacentToTile(me, GetCheckRouteX(r-1), GetCheckRouteY(r-1)) > 0 && GetAttrib(me, "IsVehicle") == 0)
To enable the new files, copy SteamApps/Common/Warhammer40000SanctusReach/Scripts/$DEFAULT.BSF to MyDocs/SanctusReach/MyCampaign/Data/Battle/Scripts
Unless I forgot something, it should work.
Note that vehicles will also ignore walkers ZoC when moving.