home *** CD-ROM | disk | FTP | other *** search
- # Script file: Adjust.py
- # Purpose: Various procedures to adjust the gold, experience,
- # and god point bonuses, as well as to adjust AI values
- # and the experience point penalty of dead innocents.
- # Detail for bonuses: Gets the value from the tag and makes the adjustment and
- # stores it back into the tag.
- #
- from environ import *
- def Gold( amount ) :
- # Get old gold amount
- gold_string = sTagDefinition( 1, "*SBg" )
- # Increment by amount (could be a negative amount)
- gold_integer = eval( gold_string ) + amount
- # Save in tag
- sAddTagDef( 1, "*SBg", "%d" % gold_integer )
- def Experience( amount ) :
- # Get old experience amount
- experience_string = sTagDefinition( 1, "*SBe" )
- # Increment by amount (could be a negative amount)
- experience_integer = eval( experience_string ) + amount
- # Save in tag
- sAddTagDef( 1, "*SBe", "%d" % experience_integer )
- def GodPoints( amount ) :
- if not sTagExists( 1, "*SBp" ) :
- godpoints_string = "0"
- else :
- # Get old experience amount
- godpoints_string = sTagDefinition( 1, "*SBp" )
- # Increment by amount (could be a negative amount)
- godpoints_integer = eval( godpoints_string ) + amount
- # Save in tag
- sAddTagDef( 1, "*SBp", "%d" % godpoints_integer )
- def VillagerPenalty( amount ) :
- # The amount will always be -25 or -50
- # Get old penalty amount
- # No tag means 0 so far.
- if not sTagExists( 0, "MKil" ) :
- sAddTagDef( 0, "MKil", "0" )
- villager_string = sTagDefinition( 0, "MKil" )
- # Increment by the negative amount
- villager_integer = eval( villager_string ) + amount
- # Save in tag
- sAddTagDef( 0, "MKil", "%d" % villager_integer )
- # Make the adjustment to experience
- Experience( amount )
- def SetAttack( attacker, radius=20, eval=750 ) :
- if type(attacker) == ListType :
- for unit in attacker :
- SetAttack( unit, radius, eval )
- else:
- sSetGoalProperty( attacker, "AttackNearBy", "radius", radius )
- sSetGoalProperty( attacker, "AttackNearBy", "radius", eval )
- def GroupDefend( group, radius, eval ) :
- if type(group) == ListType :
- for unit in group :
- SetDefend( unit, radius, eval )
- else:
- sSetGoalProperty( group, "AttackNearBy", "radius", 3 )
- sSetGoalProperty( group, "AttackNearBy", "eval", 500 )
- sSetGoalProperty( group, "CommonDefense", "eval", 800 )
- # end of routines
-