First, you need to grab the require link for the latest version of the script. Head over to Greasy Fork https://greasyfork.org/en/scripts/491625-pixel-combat and copy the bit that starts with // @require, but remove the ?version=whatever bit at the end. This needs to be added to your script's metadata (on top of the script). If you wish to target a specific version however, you can leave the ?version in - but this is not recommended as it can lead to multiple versions of the library being included and conflicting with each other.
All enemies follow a pattern of how they should be created
//This is a enemy with all possible keys:
enemyName: {
name:'Enemy Name',
image:"https://example.com/example.png",
hp:1,
maxHp:1,
accuracy:0,
damage:1,
speed:3,
defence:0,
multiPhase: false,
nextPhase:'',
arrowImunity:false,
magicImunity:false,
needsLight:false,
defender: false,
weakToFire:false,
weakToIce:false,
ghost: false,
fish: false,
lootTable: "",
lootFunction: "",
winFunction: "",
abilities: []
}
//Use this as a template, if there is any missing key the script will use the default enemy stats.
These are the stats that don't have special properties.
name:'Enemy Name', //The displayed Name
image:"https://example.com/example.png", //The image shown during the fight, 500x600px is the perfect resolution
hp:1, //How much hp the enemy stats with, can't be higher than maxHp
maxHp:1, //The maximum HP the enemy can get
accuracy:0, //The change of hitting the player
damage:1, //The maximum damage each hit can get
speed:3, //How fast it attacks
defence:0 //The change of dodging the player attack
These are stats that grant Immunities to the enemy or apply Debuffs to the player.
arrowImunity:false, //If true every ranged attack will miss
magicImunity:false, //If true it can't be damaged with spells
needsLight:false, //If true and Latern or Ring of Light are not equiped the player will receive a penalty on Hit Chance
defender: false //If true the player will loss 1 HP each successful hit
These are stats that change the amound of damage inflicted on the enemy
weakToFire:false, //If true Fire based attacks and spells with inflict double damage
weakToIce:false, //If true Ice based attacks and spells with inflict double damage
ghost: false, //If true Scythe with inflict double damage and Double Scythe 4x damage
fish: false //If true Tridents will inflict double damage
This can be used if your script has any type of custom loot
The lootFunction can be useless, but it needs to exist if you want the loot to be displayed
//You can add as many items to as you want, the format is as follow:
lootTable: [lootableItems]
let lootableItem1 = {
item:'testLoot', //The item name, this will be returned if the player get any
image:'https://example.com/exampleLoot.png', //Image displayed if the player get any
min:1, //The minimum amount of the item the player can get
max:10, //The maximum amount of the item the player can get
chance:0.5 //The change of getting the item (0-1)
}
lootTable: [lootableItem1,lootableItem2,lootableItem100]
lootFunction: function(){IdlePixelPlus.plugins.myplugin.myFunction()} //This function will be called with the loot as objects inside a single array
Example of how the function will be called: lootFunction([{item:'basalt',amount:20}, {item:'jade',amount:2}, {item:'jasmin',amount:560}])
//In case you don't need/want this feature you can have both lootTable and lootFunction as empty strings
This can be used if you want to call a function after winning the fight
winFunction: function(){IdlePixelPlus.plugins.myplugin.myFunction()} //After winning this function will be called
//In case you don't need/want this feature you can have winFunction as empty string
This can be used to create chained fights like the Robot Waves
The next enemy needs to be defined before the current one
multiPhase: true, //If true the next enemy will be loaded as soon as the HP of the current enemy reaches 0
nextPhase:enemyName2, //The enemy that will be spawned after the current is defeated
//In case you don't need/want this feature you can have multiPhase as false and nextPhase as empty string
There are multiple types of abilities, each enemy can have as many as you want, being it different abilities or multiple of the same
The types are: Heal, Poison, Damage, Charge Damage, Life Steal, Invisibility, Reflect and Kamikaze
//You can add as many abilities as you want, the format is as follow:
abilities:[ability1,ability2,ability100]
//Each type of ability has its own parameters, but some are always required
let ability1 = {
type: 'abilityType', // This will define which ability will be used
limit: 3, //How many times the ability can be used, use -1 for unlimited amount of uses
chance: 0.21, //The change of the ability being used (0-1)
cooldown: 3, //The amount of seconds between each use
cd:10 //The amount of time between startIn reaches 0 and the first use of the ability
}
//If the enemy does not have abilities leave abilities as an empty array
Regen the enemy's HP
let ability1 = {
type: 'heal',// This will define which ability will be used
limit: -1, //How many times the ability can be used, use -1 for unlimited amount of uses
chance: 1, //The change of the ability being used (0-1)
cooldown: 3, //The amount of seconds between each use
min:5, //The minimum HP restored when used
max:20, //The maximum HP restored when used
cd:10 //The amount of time between startIn reaches 0 and the first use of the ability
}
Damage the player once each 4 seconds, can only be used once
let ability1 = {
type: 'poison',// This will define which ability will be used
limit: 1, //Use 1, unless the chance is bellow 1
chance: 1, //The change of the ability being used (0-1)
cooldown: 3, //The amount of seconds between each use, only matters if the chance is bellow 1
poison: 5, //The damage inflicted each 4 seconds
cd:10 //The amount of time between startIn reaches 0 and the use of the ability
}
Damage the player as soon as it is used
let ability1 = {
type: 'damage',// This will define which ability will be used
limit: -1, //How many times the ability can be used, use -1 for unlimited amount of uses
chance: 0.1, //The change of the ability being used (0-1)
cooldown: 3, //The amount of seconds between each use
min:5, //The minimum damage done when used
max:20, //The maximum damage done when used
cd:10 //The amount of time between startIn reaches 0 and the first use of the ability
}
Damage the player after 4 seconds
The cooldown should not be bellow 4
let ability1 = {
type: 'chargeDamage',// This will define which ability will be used
limit: -1, //How many times the ability can be used, use -1 for unlimited amount of uses
chance: 1, //The change of the ability being used (0-1)
cooldown: 4, //The amount of seconds between each use
min:5, //The minimum damage done when used
max:20, //The maximum damage done when used
cd:10 //The amount of time between startIn reaches 0 and the first use of the ability
}
//The cooldown will be shown bellow the enemy's health bar
Steal an amount of HP from the player
let ability1 = {
type: 'lifeSteal',// This will define which ability will be used
limit: -1, //How many times the ability can be used, use -1 for unlimited amount of uses
chance: 0.31, //The change of the ability being used (0-1)
cooldown: 3, //The amount of seconds between each use
min:5, //The minimum HP stolen when used
max:20, //The maximum HP stolen when used
cd:10 //The amount of time between startIn reaches 0 and the first use of the ability
}
Ignore all damage
let ability1 = {
type: 'invisibility',// This will define which ability will be used
limit: -1, //How many times the ability can be used, use -1 for unlimited amount of uses
chance: 0.71, //The change of the ability being used (0-1)
cooldown: 4, //The amount of seconds between each use
min:1, //The minimum amount of seconds invisible when used
max:5, //The maximum amount of seconds invisible when used
cd:10 //The amount of time between startIn reaches 0 and the first use of the ability
}
//It will be ignored if the enemy already is invisible
//The invisible time will be shown bellow the enemy's health bar
Reflect the next player's Phisical Attack
let ability1 = {
type: 'reflect',// This will define which ability will be used
limit: -1, //How many times the ability can be used, use -1 for unlimited amount of uses
chance: 1, //The change of the ability being used (0-1)
cooldown: 4, //The amount of seconds between each use
cd:10 //The amount of time between startIn reaches 0 and the first use of the ability
}
//It will be ignored if the enemy already is reflecting
//An icon will be shown bellow the enemy's health bar
Kill the player and ends the fight
let ability1 = {
type: 'kamikaze',// This will define which ability will be used
limit: 1, //Use 1, unless the chance is bellow 1
chance: 1, //The change of the ability being used (0-1)
cooldown: 3, //The amount of seconds between each use, only matters if the chance is bellow 1
cd:160 //The amount of time between startIn reaches 0 and the use of the ability
}