home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 May / maximum-cd-2000-05.iso / Invictus / data1.cab / Game_Files / Assets / Scripts / modules / Adjust.py next >
Encoding:
Python Source  |  2000-02-25  |  2.3 KB  |  62 lines

  1. # Script file:  Adjust.py
  2. # Purpose:      Various procedures to adjust the gold, experience, 
  3. #         and god point bonuses, as well as to adjust AI values
  4. #         and the experience point penalty of dead innocents.
  5. # Detail for bonuses: Gets the value from the tag and makes the adjustment and
  6. #          stores it back into the tag.
  7. #
  8. from environ import *
  9. def Gold( amount ) :
  10.     # Get old gold amount
  11.     gold_string = sTagDefinition( 1, "*SBg" )
  12.     # Increment by amount (could be a negative amount)
  13.     gold_integer = eval( gold_string ) + amount
  14.     # Save in tag
  15.     sAddTagDef( 1, "*SBg", "%d" % gold_integer )
  16. def Experience( amount ) :
  17.     # Get old experience amount
  18.     experience_string = sTagDefinition( 1, "*SBe" )
  19.     # Increment by amount (could be a negative amount)
  20.     experience_integer = eval( experience_string ) + amount
  21.     # Save in tag
  22.     sAddTagDef( 1, "*SBe", "%d" % experience_integer )
  23. def GodPoints( amount ) :
  24.     if not sTagExists( 1, "*SBp" ) :
  25.         godpoints_string = "0"
  26.     else :
  27.         # Get old experience amount
  28.         godpoints_string = sTagDefinition( 1, "*SBp" )
  29.     # Increment by amount (could be a negative amount)
  30.     godpoints_integer = eval( godpoints_string ) + amount
  31.     # Save in tag
  32.     sAddTagDef( 1, "*SBp", "%d" % godpoints_integer )
  33. def VillagerPenalty( amount ) :
  34.     # The amount will always be -25 or -50
  35.     # Get old penalty amount
  36.     # No tag means 0 so far.
  37.     if not sTagExists( 0, "MKil" ) :
  38.         sAddTagDef( 0, "MKil", "0" )
  39.     villager_string = sTagDefinition( 0, "MKil" )
  40.     # Increment by the negative amount
  41.     villager_integer = eval( villager_string ) + amount
  42.     # Save in tag
  43.     sAddTagDef( 0, "MKil", "%d" % villager_integer )
  44.     # Make the adjustment to experience
  45.     Experience( amount )
  46. def SetAttack( attacker, radius=20, eval=750 ) :
  47.     if type(attacker) == ListType :
  48.         for unit in attacker :
  49.             SetAttack( unit, radius, eval )
  50.     else:
  51.         sSetGoalProperty( attacker, "AttackNearBy", "radius", radius )
  52.         sSetGoalProperty( attacker, "AttackNearBy", "radius", eval )
  53. def GroupDefend( group, radius, eval ) :
  54.     if type(group) == ListType :
  55.         for unit in group :
  56.             SetDefend( unit, radius, eval )
  57.     else:
  58.         sSetGoalProperty( group, "AttackNearBy", "radius", 3 )
  59.         sSetGoalProperty( group, "AttackNearBy", "eval", 500 )
  60.         sSetGoalProperty( group, "CommonDefense", "eval", 800 )
  61. # end of routines
  62.