Skip to main content

RPG sample

A proof of concept of RPG mobs in the style of Wynncraft or Hypixel, shipped as a separate plugin (graycore-rpg-sample.jar, from samples/rpg-sample/) that adds the rpg-sample module to GrayCore. It is not part of graycore-paper.jar.

What you need​

  • GrayCore on the game server, and BetterModel 3.6 (it draws the 3D models and builds the resource pack).
  • A web server that serves the resource pack over HTTP, with its address in pack.publicUrl. In the dev stack, the resource-packs service does it on http://localhost:8088/.
  • Minecraft 26.3 for the HUD's shader. The mobs and the zones work without it.

What it does​

PartWhat it isPage
MobsMobs of the game (a zombie, a skeleton) with levels, a life of their own, damage, defense, loot and a name, or with a 3D model; skills with a warning on the ground; splitting; a mini-boss with phases.Mobs
CombatA damage model with attack, defense and critical hits, base damage and a hit interval per weapon, damage numbers.Combat
ZonesAreas of the world, boxes or polygons, with sub-zones. Each one makes mobs appear near the players, shows a recommended level, and can be a safe zone.Zones
HUDThe zone and the position at the top right, a card with life and mana at the top left, the mana bar in place of the hunger bar.HUD
Resource packBetterModel's pack with the HUD's files added, published over HTTP and sent to players when they join.For developers

Try it​

In the dev stack, accept the resource pack when you join, then:

/rpgsample list
/rpgsample spawn stone_sentinel
/rpgsample spawn stone_warden

The test platform at 2000 123 2000 in world has zones that fill with mobs when you stand on it.

Commands​

/rpgsample needs graycore.commands.rpgsample.admin.

CommandWhat it does
/rpgsample listLists the mobs of mobs.yml.
/rpgsample spawn <mob> [world x y z]Spawns a mob at your position. The console gives the place.
/rpgsample resize <factor>Changes the size of every mob alive, relative to its definition.
/rpgsample clearRemoves every mob.
/rpgsample zonesLists each zone and sub-zone with its levels, its mobs alive and what it spawns.
/rpgsample whereNames the zone you stand in.
/rpgsample packSends the resource pack to you again.
/rpgsample pack rebuildBuilds the pack again from BetterModel's file and the HUD's, publishes it and sends it to everyone.
/rpgsample statusMobs alive, mobs with a model, and the hash of the pack.

Files​

All in plugins/GrayCorePaper/modules/rpg-sample/, written from the plugin's defaults when they are missing and read again by /gcadmin reload:

FileWhat it holds
config.ymlblockNaturalSpawns, combat:, pack: and hud:.
mobs.ymlThe mobs.
zones.ymlThe zones and the mobs of each.
hud.ymlThe lines of the HUD.
locale/en.ymlThe texts.

A mob spawned before a reload keeps the settings it had. The same files are described setting by setting on the pages above.

Limits​

  • Mobs are not saved: they disappear with their chunk or on a restart, and the zones fill up again.
  • A recommended level is shown, nothing stops a player from going in.
  • A player's level and mana are placeholders (hud.mockLevel, hud.mockMana) until players have stats of their own.