View Single Post
Old 11-15-13, 05:43 AM   #9
Husksubsky
XO
 
Join Date: May 2008
Location: oslo,Norway
Posts: 424
Downloads: 254
Uploads: 0
Default

Heres mine is ok no?

HTML Code:
# Edited by TheDarkWraith for IRAI_0_0_39
# Edited on 1/20/2013 @ 1700

# Copyright notice:
# The code changes made to this file are the intellectual property of TheDarkWraith and may not be used, modified, or duplicated in whole,
# or in part, without the express written permission of TheDarkWraith. The code changes made to this file may not be used in any commercial
# application of any form without the express written permission of TheDarkWraith.


###################################################################################################
#
#    Ship weapons:
#

strategy ShipFire(Ship)
 {
    precond
    {
        Ship:ContactPresenceIs(PRESENCE_SENSORS, 0) or (Ship:ContactPresenceIs(PRESENCE_LOOSING, 0) and Ship:GetContactLostTime() <= 360.0)
    }
    strategies
    {
        DC,
        Cannons,
        CannonsAtSubmerged,
        #CheckStarshellEnable,
        ShipFireStarShells,
        ShipFireStarShellsDistance
    }
}

strategy DC(Ship)
{
    precond
    {
        Ship:ContactIs(SUBMARINE) or (Ship:ContactIs(UNITUNKNOWN) and Ship:GetContactDepth() <= -4.0)        #SUBISSUBMERGEDDEPTH
    }
    strategies
    {
        DCRacks,
        HHogs,
        DCThrower
    }
}

strategy DCRacks(Ship)
{
    precond
    {
        Ship:CanFireDCRacks() and Ship:GetContactDepth() <= -4.0 and Ship:GetCurrentSpeed() >= 2        #SUBISSUBMERGEDDEPTH
    }
    action
    {
        Ship:FireDCRacks();
    }
}

strategy HHogs(Ship)
{
    precond
    {
        Ship:CanFireHHogs()
    }
    action
    {
        Ship:FireHHogs();
    }
}

strategy DCThrower(Ship)
{
    precond
    {
        Ship:CanFireDCThrowers()
    }
    action
    {
        Ship:FireDCThrowers();
    }
}

strategy Cannons(Ship)
{
    precond
    {
        Ship:CanFireCannons()
    }
    action
    {
        Ship:FireCannons();
    }
}

strategy CannonsAtSubmerged(Ship)
{
    precond
    {
        (Ship:ContactPresenceIs(PRESENCE_LOOKOUT, 0) or Ship:ContactPresenceIs(PRESENCE_SONAR, 0)) and (Ship:ContactIs(SUBMARINE) or Ship:ContactIs(UNITUNKNOWN)) and Ship:GetContactDepth() <= 0.0 and Ship:GetContactDepth() >= -20.0 and Ship:GetContactRelDist() <= 8000
    }
    action
    {
        Ship:FireCannons();
    }
}

#strategy CheckStarshellEnable(Ship)
#{
#    precond
#    {
#        (Ship:ContactPresenceIs(PRESENCE_SENSORS, 0) or Ship:ContactPresenceIs(PRESENCE_LOOSING, 0)) and Ship:GetContactRelDist() <= 10000
#    }
#    action
#    {
#        Ship:EnableStarshells();
#    }
#}

strategy ShipFireStarShells(Ship)
{
    precond
    {
        Ship:CanFireStarShells() and Ship:GetContactRelDist() <= 10000
    }
    action
    {
        Ship:FireStarShells();
    }
}

strategy ShipFireStarShellsDistance(Ship)
{
    precond
    {
        Ship:GetContactRelDist() <= 10000
    }
    action
    {
        Ship:FireStarShells();
        #Ship:ShipWaitAction(10)
        Ship:TimeEventHappen(5);
    }

This is third attempt no idea why some stuff turn blue
Husksubsky is offline   Reply With Quote