Skip to content

What are Scenarios?

Ad5001 edited this page Jun 10, 2016 · 3 revisions

Scenarios

Scenarios for UHC are like plugins for server.
Download them then put them in your scenarios folder to add them.
To add a scenario to your UHC game, you need to be in waiting for more players, then type “/uhc scenarios add \”

How to create a scenario?

Requirements:
- PHP knowledges. You can learn it on CodeAcademy
- Some pocketmine API knowledeges that are essentials to know how to code it.

If you know all those, let’s start:
First, create a new File that will be your scenario code named “YOUR_SCENARIO_NAME.php”.
Then, you’ll need to add the class that will be your main class. So to do that, add some code inside:

<?php
# This is an example !
class YOUR_SCENARIO_NAME extends \Ad5001\UHC\scenario\Scenario {   
}

Great ! Now you know that, let’s learn a bit about the functions of the API:





Function name Function parameters Description
onEnable none Execute the code when the game start !
onStop none Execute the code when the game finish
getConfig none Return you the params of the scenario’s config
getServer none Return you the Server instance
reloadConfig none Reload the config
saveConfig config Save all the args you want in the config
getScenarioFolder none Get the path/folder of the scenarios.

Hope you will play around with those !
You can publish your scenario here on the scenario resources/scenarios by clicking the “Fork” button, adding your scenario, then make a “Pull request” to merge your changes