home *** CD-ROM | disk | FTP | other *** search
- # Script file: S28_E0x_DEAD.TXT Script: E0x_DEAD
- # Purpose: Control the generators.
- # Detail: Counts the number of units left in group E05, when
- # the number goes to 0 checks to see if the associated
- # group has been destroyed. If the associated group has
- # also been destroyed, the associated group is regenerated.
- #
- # Dependencies: The first links of this script are done in init and the
- # count tags are also initialized there.
- #
- from environ import *
- def DEAD( ThisGroup, AssociatedGroup) :
- sPythonSay( sTriggeredUnit() + " died" )
- # ThisGroup = "E05"
- # AssociatedGroup = "E10"
- ThisGroupTag = ThisGroup + "c"
- AssociatedGroupTag = AssociatedGroup + "c"
- t1 = sTagDefinition( 0, ThisGroupTag )
- c1 = eval( t1 ) - 1
- t1 = "%d" % c1
- sAddTagDef( 0, ThisGroupTag, t1 )
- sPythonSay( t1 + " more left alive in group " + ThisGroup )
- # The last unit has died, check for a regenerate of the associated group
- if c1 == 0 :
- t2 = sTagDefinition( 0, AssociatedGroupTag )
- c2 = eval( t2 )
- if c2 == 0 :
- # The associated group is also destroyed so it is regenerated.
- # Create the units in the correct location
- x = eval( sTagDefinition( 0, AssociatedGroup + "x" ) )
- y = eval( sTagDefinition( 0, AssociatedGroup + "y" ) )
- s1 = sCreateUnit( "&LSP", x, y, 0, 2, 2, 2 )
- s2 = sCreateUnit( "&SPI", x, y, 0, 1, 1, 1 )
- sLinkScriptToUnit( s1, AssociatedGroup + "_DEAD", "DEAD" )
- sLinkScriptToUnit( s2, AssociatedGroup + "_DEAD", "DEAD" )
- # Delete the old group (it's got no one left in it)
- sRemoveGroup( AssociatedGroup )
- # ReBuild the group and it's properties
- sAddGroup( AssociatedGroup, [ s1, s2 ] )
- sSetGoalProperty( AssociatedGroup, "CommonDefense", "eval", 500 )
- sSetGoalProperty( AssociatedGroup, "AttackNearBy", "radius", 8 )
- sSetGoalProperty( AssociatedGroup, "AttackNearBy", "eval", 900 )
- # Set the "number left alive tag".
- sAddTagDef( 0, AssociatedGroupTag, "2")
- sPythonSay( "S28_" + ThisGroup + "_DEAD.TXT done" )
-