SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 04-27-10, 08:36 AM   #1
reaper7
sim2reality
 
Join Date: Jun 2007
Location: AM 82
Posts: 2,280
Downloads: 258
Uploads: 30
Default Working StarShells Possibe ???

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)
Code:

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)
Code:
# 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 .

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)
Code:
#####################################
#
# 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)
Code:
#####################################
#
# 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)
Code:
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.
reaper7 is offline   Reply With Quote
Old 04-27-10, 12:09 PM   #2
Athlonic
Chief
 
Join Date: Apr 2005
Location: France
Posts: 311
Downloads: 51
Uploads: 2
Default

Hi,

I tried with adding this :

Quote:
# throw first round of DCs while passing over the contact
Ship:EnableStarshells(true);
Ship:SetGotoDestRelToContactKeepFormationOrientati on(200);
Ship:StartFiringDCs();
Ship:GotoAction(0, false, 100);
Ship:StopFiringDCs();
Ship:EnableStarshells(false);
Ship:WaitForFormation();
and this :

Quote:
strategy Role_OP_Directing(Ship)
{
precond
{
Ship:GetRole() == ROLE_DIRECTING
}
action
{
Ship:EnableStarshells(true);
Ship:SetGotoDestRelToContact(-1500);
Ship:GotoAction(0, true, 100);
Ship:FireStarShells();
Ship:WaitAction(15.0);
Ship:EnableStarshells(false);
}
}
But still no starShells in the sky

Tried with some DD V&W, Elite, late war equiped
Athlonic is offline   Reply With Quote
Old 04-27-10, 12:20 PM   #3
Nisgeis
Ocean Warrior
 
Join Date: Jan 2008
Posts: 2,909
Downloads: 77
Uploads: 11
Default

If you want to see starshells when you are detected, then add in '1 or' to the precond of Ship:CanFireStarShells(), so that it becomes:

Quote:
strategy ShipFireStarShells(Ship)
{
precond
{
1 or Ship:CanFireStarShells()
}
action
{
Ship:FireStarShells();
}
}
In that way, the ships that are capable will all fire star shells as soon as you are detected. They will fire them repeatedly (after they have reloaded) even during the day time. If you want a bit more control, then you'll need to decide what conditions you want them to fire starshells (like whether it's night time and whether they need to) and script that in (replace the 1).

CanFireStarShells() comes from the game engine as to whether or not it is the right conditions to fire. They do fire in stock, according to one reply in that thread. I will be developing the star shells further, as they are an essential part of Operation Pineapple and some early war tactics.
__________________
--------------------------------
This space left intentionally blank.
Nisgeis is offline   Reply With Quote
Old 04-27-10, 12:54 PM   #4
reaper7
sim2reality
 
Join Date: Jun 2007
Location: AM 82
Posts: 2,280
Downloads: 258
Uploads: 30
Default

Quote:
Originally Posted by Nisgeis View Post
If you want to see starshells when you are detected, then add in '1 or' to the precond of Ship:CanFireStarShells(), so that it becomes:

In that way, the ships that are capable will all fire star shells as soon as you are detected. They will fire them repeatedly (after they have reloaded) even during the day time. If you want a bit more control, then you'll need to decide what conditions you want them to fire starshells (like whether it's night time and whether they need to) and script that in (replace the 1).

CanFireStarShells() comes from the game engine as to whether or not it is the right conditions to fire. They do fire in stock, according to one reply in that thread. I will be developing the star shells further, as they are an essential part of Operation Pineapple and some early war tactics.

Nice . Thanks for reply.

could we do something like:

Code:
 
strategy ShipFireStarShells(Ship)
{
precond
{
!Ship:IsDay() or Ship:CanFireStarShells()
}
action
{
Ship:FireStarShells();
}
reaper7 is offline   Reply With Quote
Old 04-27-10, 01:01 PM   #5
Nisgeis
Ocean Warrior
 
Join Date: Jan 2008
Posts: 2,909
Downloads: 77
Uploads: 11
Default

If you took out the 1, yeah. But they'd still be firing starshells all the time. You'd need a wait command in there at least, or they'd run out of star shells pretty quick.
__________________
--------------------------------
This space left intentionally blank.
Nisgeis is offline   Reply With Quote
Old 04-27-10, 01:02 PM   #6
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

add a variable count. After they fired count shells disable it

or even a counter in a counter to limit the speed they can fire them at
TheDarkWraith is offline   Reply With Quote
Old 04-28-10, 04:30 AM   #7
Pintea
Sparky
 
Join Date: Jan 2010
Posts: 152
Downloads: 6
Uploads: 0
Default

Perhaps you should update the starshell effect in the fx file.
Pintea is offline   Reply With Quote
Old 04-28-10, 05:23 AM   #8
The General
The Old Man
 
Join Date: Aug 2006
Location: Mountain Ash, Wales, U.K.
Posts: 1,548
Downloads: 179
Uploads: 3
Default

Quote:
Originally Posted by Pintea View Post
Perhaps you should update the starshell effect in the fx file.
Thanks Pintea
__________________
***THE GENERAL***
The General is offline   Reply With Quote
Old 05-19-10, 12:51 AM   #9
Redtail
Seaman
 
Join Date: Apr 2005
Location: Northern Highlands Scotland
Posts: 32
Downloads: 211
Uploads: 0
Default

The General, How is the work on the star shells going? The threads the other day seemed quite hopeful Nothing seems to have changed after 1.2,but I dont think we were expecting it to!
Redtail is offline   Reply With Quote
Old 05-19-10, 07:11 AM   #10
walsh2509
XO
 
Join Date: Apr 2005
Posts: 410
Downloads: 18
Uploads: 0
Default

Was reading the book The Battle Of The Atlantic , in part of it was parts of Kretschmer war dairy and in it descibing a convoy attack he was saying that in a moon lit night the use of Starshells by british escorts were all but useless.
walsh2509 is offline   Reply With Quote
Old 05-19-10, 07:20 AM   #11
icecold
Gunner
 
Join Date: Jul 2007
Location: Periscope depth 200 yards from your stern!
Posts: 93
Downloads: 84
Uploads: 0
Default

Quote:
Originally Posted by walsh2509 View Post
Was reading the book The Battle Of The Atlantic , in part of it was parts of Kretschmer war dairy and in it descibing a convoy attack he was saying that in a moon lit night the use of Starshells by british escorts were all but useless.
Ok is there someway of linking the script to certain skyboxes, so they use them when the moon/sun/storm function/script/materials/skybox is not on.

Im not sure how this game uses the moon effects, is the moon part of the skybox or does it have its own scripting/materials?


Get that linked, add it to the tactics and restrict how many fired and you got yourself a winner
icecold is offline   Reply With Quote
Old 05-20-10, 01:20 PM   #12
wamphyri
Lieutenant
 
wamphyri's Avatar
 
Join Date: May 2004
Location: Lethbridge, Alberta
Posts: 260
Downloads: 40
Uploads: 0
Default

Did anyone actually try putting star shells into the inventory of any of the guns? By default I don't believe any of the guns have star shells equipped.
wamphyri is offline   Reply With Quote
Old 05-20-10, 01:40 PM   #13
Nisgeis
Ocean Warrior
 
Join Date: Jan 2008
Posts: 2,909
Downloads: 77
Uploads: 11
Default

They will fire star shells if you tell them to, so the guns must have them available.
__________________
--------------------------------
This space left intentionally blank.
Nisgeis is offline   Reply With Quote
Old 05-20-10, 04:18 PM   #14
Hartmann
Sea Lord
 
Join Date: Mar 2005
Location: Grid CH 26, Spain ,Barcelona
Posts: 1,857
Downloads: 204
Uploads: 0
Default

operation plaster was one tactics used by jonh Walker, similar to a carpet bombing but with depth charges

With the time shV is showing his huge modding potential but still there are a lot of things to improve by ubi
__________________
But this ship can't sink!...

She is made of iron, sir. I assure you, she can. and she will. It is a mathematical certainty.

Strength and honor
Hartmann is offline   Reply With Quote
Old 05-22-10, 01:23 AM   #15
ingsoc84
Navy Dude
 
Join Date: Mar 2010
Posts: 173
Downloads: 26
Uploads: 0
Default

Starshells woulde be AWESOME , hope someone will do them!
ingsoc84 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.