Jump to content

Global Difficulty System

Overview
Creator: Moosh Updated: 26 Dec 2020 Tags: FFC, Global Downloads: 38
Rating[?]: Rating: 4.33/5 (2 ratings)
View Script Download Package
(995.91 KB)
Information

Description Setup Reviews Comments

Global Script:

For this script to work, you'll need to create 2-5 difficulty token items for tracking the player's current selected difficulty. These items can be any itemclass, though Peril Rings (with Maximum Hearts set to 99) are recommended (as they have innate damage divsion) if you're doing global damage multipliers with easy modes. Give each difficulty token its own item level.

Set the following five constants in the script to the item IDs of your difficulty items as seen in the editor:
  • I_DIFF_VERYEASY
  • I_DIFF_EASY
  • I_DIFF_NORMAL
  • I_DIFF_HARD
  • I_DIFF_VERYHARD
You don't need to have all 5 difficulties as items if you don't need them. The remaining constants can be left as 0. The names for the five difficulties in the script are completely arbitrary and your difficulty token items don't need to align with them (for example, you could put your hard mode token over I_DIFF_NORMAL), but it may help you stay organized.

Set the following constants to your desired difficulty settings:

Below are global damage multipliers. Any times Link takes damage from any source, it will get multiplied by these. If <1, you'll likely want to use Peril Ring damage divisors on the difficulty tokens instead.
  • DIFFICULTY_VERYEASY_DAMAGE_MULTIPLIER
  • DIFFICULTY_EASY_DAMAGE_MULTIPLIER
  • DIFFICULTY_NORMAL_DAMAGE_MULTIPLIER
  • DIFFICULTY_HARD_DAMAGE_MULTIPLIER
  • DIFFICULTY_VERYHARD_DAMAGE_MULTIPLIER?
The following three sets of constants require DIFFICULTY_APPLY_NPC_SCALING to be set to 1 in order to function, else they will be ignored:

Below are enemy damage multipliers. These will be applied only to enemies when they spawn in. They will not affect damage caused by combos or scripts.
  • DIFFICULTY_ENEMY_VERYEASY_DAMAGE_MULTIPLIER
  • DIFFICULTY_ENEMY_EASY_DAMAGE_MULTIPLIER
  • DIFFICULTY_ENEMY_NORMAL_DAMAGE_MULTIPLIER
  • DIFFICULTY_ENEMY_HARD_DAMAGE_MULTIPLIER
  • DIFFICULTY_ENEMY_VERYHARD_DAMAGE_MULTIPLIER
Below are enemy HP multipliers. These will be applied only to enemies when they spawn in. Some enemies (splitters and gleeoks) will not apply these due to ZC behaviors.
  • DIFFICULTY_ENEMY_VERYEASY_HP_MULTIPLIER
  • DIFFICULTY_ENEMY_EASY_HP_MULTIPLIER
  • DIFFICULTY_ENEMY_NORMAL_HP_MULTIPLIER
  • DIFFICULTY_ENEMY_HARD_HP_MULTIPLIER
  • DIFFICULTY_ENEMY_VERYHARD_HP_MULTIPLIER
Below are enemy step speed multipliers. These will be applied only to enemies when they spawn in. Changing enemy step can have more dramatic consequences, so not using large multipliers and adding exceptions as needed is recommended.
  • DIFFICULTY_ENEMY_VERYEASY_STEP_MULTIPLIER
  • DIFFICULTY_ENEMY_EASY_STEP_MULTIPLIER
  • DIFFICULTY_ENEMY_NORMAL_STEP_MULTIPLIER
  • DIFFICULTY_ENEMY_HARD_STEP_MULTIPLIER
  • DIFFICULTY_ENEMY_VERYHARD_STEP_MULTIPLIER
The script also depends on an NPC Misc[] index to remember which enemies have already had their stats altered. These are occasionally used by other scripts, so if something breaks, make sure NPCM_DIFFICULTYFLAG is set to a unique value for NPC Misc[].

If you're using ghost.zh, you should also swap the commented lines (//) in the following comments. So if you're using ghost.zh
void DifficultyGlobal_SetEnemyHP(npc n, int val){
	//If using ghost.zh, uncomment the following and comment out the line below
		//SetEnemyProperty(n, ENPROP_HP, val);
		n->HP = val;
}

int DifficultyGlobal_GetEnemyHP(npc n){
	//If using ghost.zh, uncomment the following and comment out the line below
		//return GetEnemyProperty(n, ENPROP_HP);
		return n->HP;
}
would become:
void DifficultyGlobal_SetEnemyHP(npc n, int val){
	//If using ghost.zh, uncomment the following and comment out the line below
		SetEnemyProperty(n, ENPROP_HP, val);
		// n->HP = val;
}

int DifficultyGlobal_GetEnemyHP(npc n){
	//If using ghost.zh, uncomment the following and comment out the line below
		return GetEnemyProperty(n, ENPROP_HP);
		// return n->HP;
}
For the final step, you'll need to combine Difficulty_Example with your quest's global script.

FFC and Item Scripts:
Item Script: Difficulty_PickupItem


FFC Script: Difficulty_Override


FFC Script: Difficulty_SelectionScreen


FFC Script: Difficulty_ReplaceScreen


FFC Script: Difficulty_ReplaceCombo


FFC Script: Difficulty_ChangeWarp


Enemy Specific Exceptions (Advanced):
Spoiler


This script only requires std.zh. If you're on 2.53 and need to reference constants for some of the setup, remember it's been moved to include/std_zh/std_constants.zh.