home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 May / maximum-cd-2000-05.iso / Invictus / data1.cab / Game_Files / Assets / Scripts / modules / S28_E0x.PY < prev    next >
Encoding:
Python Source  |  2000-02-25  |  2.0 KB  |  46 lines

  1. # Script file:  S28_E0x_DEAD.TXT  Script: E0x_DEAD
  2. # Purpose:      Control the generators.
  3. # Detail:       Counts the number of units left in group E05, when
  4. #                 the number goes to 0 checks to see if the associated
  5. #          group has been destroyed. If the associated group has
  6. #          also been destroyed, the associated group is regenerated.
  7. #
  8. # Dependencies: The first links of this script are done in init and the
  9. #                 count tags are also initialized there.
  10. #
  11. from environ import *
  12. def DEAD( ThisGroup, AssociatedGroup) :
  13.     sPythonSay( sTriggeredUnit() + " died" )
  14. #    ThisGroup = "E05"
  15. #    AssociatedGroup = "E10"
  16.     ThisGroupTag = ThisGroup + "c"
  17.     AssociatedGroupTag = AssociatedGroup + "c"
  18.     t1 = sTagDefinition( 0, ThisGroupTag )
  19.     c1 = eval( t1 ) - 1
  20.     t1 = "%d" % c1
  21.     sAddTagDef( 0, ThisGroupTag, t1 )
  22.     sPythonSay( t1 + " more left alive in group " + ThisGroup )
  23.     # The last unit has died, check for a regenerate of the associated group
  24.     if c1 == 0 :
  25.         t2 = sTagDefinition( 0, AssociatedGroupTag )
  26.         c2 = eval( t2 )
  27.         if c2 == 0 :
  28.             # The associated group is also destroyed so it is regenerated.
  29.             # Create the units in the correct location
  30.             x = eval( sTagDefinition( 0, AssociatedGroup + "x" ) )
  31.             y = eval( sTagDefinition( 0, AssociatedGroup + "y" ) )
  32.             s1 = sCreateUnit( "&LSP", x, y, 0, 2, 2, 2 )
  33.             s2 = sCreateUnit( "&SPI", x, y, 0, 1, 1, 1 )
  34.             sLinkScriptToUnit( s1, AssociatedGroup + "_DEAD", "DEAD" )
  35.             sLinkScriptToUnit( s2, AssociatedGroup + "_DEAD", "DEAD" )
  36.             # Delete the old group (it's got no one left in it)
  37.             sRemoveGroup( AssociatedGroup )
  38.             # ReBuild the group and it's properties
  39.             sAddGroup( AssociatedGroup, [ s1, s2 ] )
  40.             sSetGoalProperty( AssociatedGroup, "CommonDefense", "eval", 500 )
  41.             sSetGoalProperty( AssociatedGroup, "AttackNearBy", "radius", 8 )
  42.             sSetGoalProperty( AssociatedGroup, "AttackNearBy", "eval", 900 )
  43.             # Set the "number left alive tag".
  44.             sAddTagDef( 0, AssociatedGroupTag, "2")    
  45.     sPythonSay( "S28_" + ThisGroup + "_DEAD.TXT done" )
  46.