reaper7
04-27-10, 08:36 AM
Following a thread on the Main Forum regarding if Starshells are in the Game. I did a bit of digging through the AI Scripts and have spotted a few interesting bits.
All the scripts are located @ C:\Ubisoft\Silent Hunter 5\data\Scripts\AI
The first script regarding Ship AI Strategy is: Ship.aix
Most of the script is disabled bar a few lines at the bottom which define the basic ship strategies
(A Section of code from that Script)
strategy ShipStrategy(Ship)
{
strategies
{
ShipNavigate,
CrewState,
ShipFire,
Commander,
ShipOperations
}
}
I have highlighted ShipFire as this relates to the Ship-weapons.aix and the weapons fired stratagies it uses (StarShells being one of them).
Also we have the Ship-commander.aix script that defines the ship manouver stratagies that are used.
(A Section of code from that Script)
# Commanding ship tactics management
strategy Commander(Ship)
{
precond
{
Ship:IsCommander()
}
strategies
{
#OperationPlasterComm,
OperationSpiralSearchComm,
OperationFollow,
#OperationSinglePlasterComm,
#PineappleComm,
#RaspberryComm,
TerminateOperationComm
I belive this is what tactics the AI Commander will define for each AI ship under its command. You'll notice that only Spiralsearch and Follow are the currently working strategies.
SinglePlaster, Pineapple and Rasberry are disabled here so will never be called in the game :nope:.
The next script appears to control AI ships that do not have an AI commander (Single ships etc) Ship-tactics.aix
(A Section of code from that Script)
#####################################
#
# Ship Tactics:
#
# This is work-in-progress; Operation Plaster, OperationSpiralSearch and OperationSinglePlaster are the only tactics implemented
#
### Ship Operations
strategy ShipOperations(Ship)
{
strategies
{
OperationPlaster #,
# OperationPineapple,
# OperationRaspberry
}
}
Here also we can see that most of the Tactics are disable, the only working one is OperationPlaster. Once Again Pineapple and Raspberry will not happen in game.
There is also the Ship-navigation.aix script appears to be the script for defineing tha tactics employed by the AI ships
(A Section of code from that Script)
#####################################
#
# Ship navigation:
#
strategy EscortNavigate(Ship)
{
precond
{
Ship:IsType(ESCORT)
}
strategies
{
ShipFollow,
ShipSpiral,
ShipPlaster
}
strategy ShipSpiral(Ship)
{
precond
{
Ship:ContactDetected() and Ship:GetRole() == ROLE_SPIRAL
and Ship:ContactPresenceIs(PRESENCE_LOOSING, 0) and Ship:GetContactLostTime() > CRITICAL_LOST_TIME
}
action
{
Ship:SetGotoDestRelToContact(50);
Ship:GotoAction(0, false, 700);
Ship:Spiral(0.3, 3700.0, 40.0, 5.0); #time is in seconds
Ship:EndCurrentTactic();
}
}
}
strategy ShipPlaster(Ship)
{
precond
{
Ship:GetRole() == ROLE_SINGLE_PLASTER and
Ship:ContactDetected() and Ship:ContactPresenceIs(PRESENCE_SENSORS, 0) and
Ship:GetContactSpeed() <= 3 and Ship:GetContactDepth() < -5.0
}
action
{
Ship:SetGotoDestRelToContact(-250);
Ship:GotoAction(0, false, 100);
# throw first round of DCs while passing over the contact
Ship:SetGotoDestRelToContact(200);
Ship:StartFiringDCs();
Ship:GotoAction(0, false, 100);
Ship:StopFiringDCs();
# throw second round of DCs on the way back
Ship:SetGotoDestRelToContact(200);
Ship:StartFiringDCs();
Ship:GotoAction(0, false, 100);
Ship:StopFiringDCs();
Ship:EndCurrentTactic();
}
}
Here I've just shown the relevant bit to do with the Plaster Tactic.
this script sets up the tactics that each ship type use for each stratagy
Here an Escort is following the Ship Plaster, the command when it passes over it a the subs position is StartFiringDCs() to fire depthcharges.
Which leads us on to the last script Ship-weapons.aix
(A Section of code from that Script)
Ship-weapons.aix
################################################## #################################################
#
# Ship weapons:
#
strategy ShipFire(Ship)
{
precond
{
Ship:ContactDetected()
}
strategies
{
DC,
ShipFireStarShells,
Cannons
}
}
strategy ShipFireStarShells(Ship)
{
precond
{
Ship:CanFireStarShells()
}
action
{
Ship:FireStarShells();
}
}
Now here we have the fire controls for the weapon types that each ship carries.
Going through all the scripts its my opinion that the only Tactic that calls for the StarShells to be Fired is the OperationPineapple Strategy whish is disabled in the scripts above.
I have been unable to test this at the moment and maybe this info will be of use to someone wishing to implement the StarShells in game.
It may only be a matter of removing the # in fornt of the bits in scripts to get the Pineapple tactic working in-game, or even to script in the FireStarShells() command into the ShipSpiral(Ship) part of the scripts or even the evasive manover and zigzag Tactics so at least the Starshells are fired when a contact is made. :up:
All the scripts are located @ C:\Ubisoft\Silent Hunter 5\data\Scripts\AI
The first script regarding Ship AI Strategy is: Ship.aix
Most of the script is disabled bar a few lines at the bottom which define the basic ship strategies
(A Section of code from that Script)
strategy ShipStrategy(Ship)
{
strategies
{
ShipNavigate,
CrewState,
ShipFire,
Commander,
ShipOperations
}
}
I have highlighted ShipFire as this relates to the Ship-weapons.aix and the weapons fired stratagies it uses (StarShells being one of them).
Also we have the Ship-commander.aix script that defines the ship manouver stratagies that are used.
(A Section of code from that Script)
# Commanding ship tactics management
strategy Commander(Ship)
{
precond
{
Ship:IsCommander()
}
strategies
{
#OperationPlasterComm,
OperationSpiralSearchComm,
OperationFollow,
#OperationSinglePlasterComm,
#PineappleComm,
#RaspberryComm,
TerminateOperationComm
I belive this is what tactics the AI Commander will define for each AI ship under its command. You'll notice that only Spiralsearch and Follow are the currently working strategies.
SinglePlaster, Pineapple and Rasberry are disabled here so will never be called in the game :nope:.
The next script appears to control AI ships that do not have an AI commander (Single ships etc) Ship-tactics.aix
(A Section of code from that Script)
#####################################
#
# Ship Tactics:
#
# This is work-in-progress; Operation Plaster, OperationSpiralSearch and OperationSinglePlaster are the only tactics implemented
#
### Ship Operations
strategy ShipOperations(Ship)
{
strategies
{
OperationPlaster #,
# OperationPineapple,
# OperationRaspberry
}
}
Here also we can see that most of the Tactics are disable, the only working one is OperationPlaster. Once Again Pineapple and Raspberry will not happen in game.
There is also the Ship-navigation.aix script appears to be the script for defineing tha tactics employed by the AI ships
(A Section of code from that Script)
#####################################
#
# Ship navigation:
#
strategy EscortNavigate(Ship)
{
precond
{
Ship:IsType(ESCORT)
}
strategies
{
ShipFollow,
ShipSpiral,
ShipPlaster
}
strategy ShipSpiral(Ship)
{
precond
{
Ship:ContactDetected() and Ship:GetRole() == ROLE_SPIRAL
and Ship:ContactPresenceIs(PRESENCE_LOOSING, 0) and Ship:GetContactLostTime() > CRITICAL_LOST_TIME
}
action
{
Ship:SetGotoDestRelToContact(50);
Ship:GotoAction(0, false, 700);
Ship:Spiral(0.3, 3700.0, 40.0, 5.0); #time is in seconds
Ship:EndCurrentTactic();
}
}
}
strategy ShipPlaster(Ship)
{
precond
{
Ship:GetRole() == ROLE_SINGLE_PLASTER and
Ship:ContactDetected() and Ship:ContactPresenceIs(PRESENCE_SENSORS, 0) and
Ship:GetContactSpeed() <= 3 and Ship:GetContactDepth() < -5.0
}
action
{
Ship:SetGotoDestRelToContact(-250);
Ship:GotoAction(0, false, 100);
# throw first round of DCs while passing over the contact
Ship:SetGotoDestRelToContact(200);
Ship:StartFiringDCs();
Ship:GotoAction(0, false, 100);
Ship:StopFiringDCs();
# throw second round of DCs on the way back
Ship:SetGotoDestRelToContact(200);
Ship:StartFiringDCs();
Ship:GotoAction(0, false, 100);
Ship:StopFiringDCs();
Ship:EndCurrentTactic();
}
}
Here I've just shown the relevant bit to do with the Plaster Tactic.
this script sets up the tactics that each ship type use for each stratagy
Here an Escort is following the Ship Plaster, the command when it passes over it a the subs position is StartFiringDCs() to fire depthcharges.
Which leads us on to the last script Ship-weapons.aix
(A Section of code from that Script)
Ship-weapons.aix
################################################## #################################################
#
# Ship weapons:
#
strategy ShipFire(Ship)
{
precond
{
Ship:ContactDetected()
}
strategies
{
DC,
ShipFireStarShells,
Cannons
}
}
strategy ShipFireStarShells(Ship)
{
precond
{
Ship:CanFireStarShells()
}
action
{
Ship:FireStarShells();
}
}
Now here we have the fire controls for the weapon types that each ship carries.
Going through all the scripts its my opinion that the only Tactic that calls for the StarShells to be Fired is the OperationPineapple Strategy whish is disabled in the scripts above.
I have been unable to test this at the moment and maybe this info will be of use to someone wishing to implement the StarShells in game.
It may only be a matter of removing the # in fornt of the bits in scripts to get the Pineapple tactic working in-game, or even to script in the FireStarShells() command into the ShipSpiral(Ship) part of the scripts or even the evasive manover and zigzag Tactics so at least the Starshells are fired when a contact is made. :up: