(info) Other great resources: Official JS API docs, Scripting Forum

difficulty

A constant representing the difficulty level selected for your script.

 

Overview

End users can choose a difficulty level for AI players in skirmish or multiplayer games on the game set-up screen:

In challenges, the difficultly level is defined in the player sections of the challenge settings file. If a particular AI player doesn't have a difficulty specified, the end-user can choose the difficulty for that player.

The difficulty global tells your script what level has been selected for the player your script is associated with. Ideally, your script should become more challenging as the difficulty level increases.

You can determine the difficultly level set for other AI players by looking at their playerData[].

Values

If you're making Challenge Games, the "Difficulty" property for a player in the .ini file should be assigned a string value as shown in the "Challenge Value" column.

ValueIconDescriptionChallenge Value
EASY

Mostly harmless, like a bunny rabbit. (Not a killer bunny though!)

  • On Warzone 3.2+, "Easy" AIs produce 25% less oil
"Easy"
MEDIUMKeep the enemy on their toes."Medium"
HARDBe a fierce opponent."Hard"
INSANE

Take no prisoners. Cheat if you have to. Pwn the enemy.

Warzone helps your AI cheat:

  • Oil production is doubled (on Warzone 3.2 and above)
  • Fewer structures are removed based on the base type setting
"Insane"

Availability

Requires:

  • Warzone 3.1 Beta 1 and above

See also

JS API features that return difficulty setting:

Difficulty level constants:

  • EASY – act like a punch bag
  • MEDIUM – act like a skirmish player
  • HARD – act like a seasoned MP player
  • INSANE – be evil, cheat if you have to

Â