# Quick Start
Noble SDK provides a powerful set of game development tools that allow developers to easily create various game scripts and plugins. This article will guide you on how to install and start using Noble SDK.
# Installation
- Download the latest version of Noble SDK
- Place the extracted files in your project directory
- Include the Noble.h header file in your project
#include "Noble.h"
# Initialize SDK
First, you need to initialize the SDK and register your plugin.
// Initialize SDK, create a champion plugin
Noble::Init(PluginType::Champion, "My First Script", { "Annie", "Ashe" });
# Register Events
Noble SDK provides a rich event system. You can register callback functions to respond to various events in the game.
// Declare event callback functions
void OnLoad();
void OnUnload();
void OnUpdate();
void OnDraw();
void OnSpellCast(AIBaseClient* sender, SpellCastInfo const& args);
void OnNewPath(AIBaseClient* sender, std::vector<Vector> const& path, bool isDash, float dashSpeed);
// Register events
void RegisterEvents() {
// Register core events
Event::OnLoad::Add(OnLoad);
Event::OnUnload::Add(OnUnload);
Event::OnUpdate::Add(OnUpdate);
Event::OnDraw::Add(OnDraw);
// Register game events
Event::OnSpellCast::Add(OnSpellCast);
Event::OnNewPath::Add(OnNewPath);
}
# Create Menu
Create a user-friendly configuration menu for your script.
Menu* mainMenu;
MenuOption* comboKey;
MenuOption* useQ;
MenuOption* useW;
MenuOption* useE;
MenuOption* useR;
void CreateMenu() {
// Create main menu
mainMenu = Menu::Create("My First Script");
// Add combo settings
Menu* comboMenu = mainMenu->AddMenu("Combo Settings");
comboKey = comboMenu->AddHotKey("Combo Key", 0x20); // Space key
useQ = comboMenu->AddCheckBox("Use Q", true);
useW = comboMenu->AddCheckBox("Use W", true);
useE = comboMenu->AddCheckBox("Use E", true);
useR = comboMenu->AddCheckBox("Use R", true);
}
# Implement Combo System
Below is a simple implementation of a combo system, showing how to detect key presses and cast skills.
// Define skills
Spell Q, W, E, R;
// Initialize skills
void InitializeSpells() {
Q = Spell(eSpellSlot::Q, 625.f);
Q.SetTargetted(0.25f, 1400.f);
W = Spell(eSpellSlot::W, 600.f);
W.SetSkillshot(0.25f, 100.f, 2000.f, false, eSkillshotType::SkillshotCone);
E = Spell(eSpellSlot::E, 425.f);
E.SetSkillshot(0.25f, 200.f, FLT_MAX, false, eSkillshotType::SkillshotCircle);
R = Spell(eSpellSlot::R, 600.f);
R.SetSkillshot(0.25f, 250.f, FLT_MAX, false, eSkillshotType::SkillshotCircle);
}
// Execute combo
void ExecuteCombo() {
// Get target
AIBaseClient* target = TargetSelector::GetTarget(900.f, eDamageType::Magical);
if (!target) return;
// Use R skill
if (useR->GetBoolean() && R.IsReady() && target->GetHealthPercent() <= 40.f) {
R.Cast(target);
}
// Use E skill
if (useE->GetBoolean() && E.IsReady()) {
E.Cast(target);
}
// Use Q skill
if (useQ->GetBoolean() && Q.IsReady()) {
Q.Cast(target);
}
// Use W skill
if (useW->GetBoolean() && W.IsReady()) {
W.Cast(target);
}
}
// Update event handler
void OnUpdate() {
// Check if combo key is pressed
if (comboKey->GetBoolean()) {
ExecuteCombo();
}
}
# Complete Example
Here is a complete example showing how to create a simple script, register events, and execute combos:
#include "Noble.h"
// Global variables
Menu* mainMenu;
MenuOption* comboKey;
MenuOption* useQ;
MenuOption* useW;
MenuOption* useE;
MenuOption* useR;
Spell Q, W, E, R;
// Initialize skills
void InitializeSpells() {
Q = Spell(eSpellSlot::Q, 625.f);
Q.SetTargetted(0.25f, 1400.f);
W = Spell(eSpellSlot::W, 600.f);
W.SetSkillshot(0.25f, 100.f, 2000.f, false, eSkillshotType::SkillshotCone);
E = Spell(eSpellSlot::E, 425.f);
E.SetSkillshot(0.25f, 200.f, FLT_MAX, false, eSkillshotType::SkillshotCircle);
R = Spell(eSpellSlot::R, 600.f);
R.SetSkillshot(0.25f, 250.f, FLT_MAX, false, eSkillshotType::SkillshotCircle);
}
// Create menu
void CreateMenu() {
// Create main menu
mainMenu = Menu::Create("My First Script");
// Add combo settings
Menu* comboMenu = mainMenu->AddMenu("Combo Settings");
comboKey = comboMenu->AddHotKey("Combo Key", 0x20); // Space key
useQ = comboMenu->AddCheckBox("Use Q", true);
useW = comboMenu->AddCheckBox("Use W", true);
useE = comboMenu->AddCheckBox("Use E", true);
useR = comboMenu->AddCheckBox("Use R", true);
}
// Execute combo
void ExecuteCombo() {
// Get target
AIBaseClient* target = TargetSelector::GetTarget(900.f, eDamageType::Magical);
if (!target) return;
// Use R skill
if (useR->GetBoolean() && R.IsReady() && target->GetHealthPercent() <= 40.f) {
R.Cast(target);
}
// Use E skill
if (useE->GetBoolean() && E.IsReady()) {
E.Cast(target);
}
// Use Q skill
if (useQ->GetBoolean() && Q.IsReady()) {
Q.Cast(target);
}
// Use W skill
if (useW->GetBoolean() && W.IsReady()) {
W.Cast(target);
}
}
// Load event
void OnLoad() {
Console::Add("Script loaded!");
InitializeSpells();
CreateMenu();
}
// Unload event
void OnUnload() {
Console::Add("Script unloaded!");
}
// Update event
void OnUpdate() {
// Check if combo key is pressed
if (comboKey->GetBoolean()) {
ExecuteCombo();
}
}
// Draw event
void OnDraw() {
AIBaseClient* player = ObjectManager::Player();
// Draw skill ranges
if (Q.IsReady()) {
Drawing::DrawCircle(player->Position(), Q.Range(), MAKE_COLOR(255, 0, 0, 100));
}
if (W.IsReady()) {
Drawing::DrawCircle(player->Position(), W.Range(), MAKE_COLOR(0, 255, 0, 100));
}
if (E.IsReady()) {
Drawing::DrawCircle(player->Position(), E.Range(), MAKE_COLOR(0, 0, 255, 100));
}
if (R.IsReady()) {
Drawing::DrawCircle(player->Position(), R.Range(), MAKE_COLOR(255, 255, 0, 100));
}
}
// Spell cast event
void OnSpellCast(AIBaseClient* sender, SpellCastInfo const& args) {
// Check if it's myself
if (sender->IsMe()) {
Console::Add("I cast a spell: %s", args.Name);
}
}
// Path update event
void OnNewPath(AIBaseClient* sender, std::vector<Vector> const& path, bool isDash, float dashSpeed) {
// Check if it's an enemy hero and dashing
if (sender->IsEnemy() && sender->IsHero() && isDash) {
Console::Add("Enemy champion %s is dashing!", sender->ChampionName());
}
}
// Register events
void RegisterEvents() {
Event::OnLoad::Add(OnLoad);
Event::OnUnload::Add(OnUnload);
Event::OnUpdate::Add(OnUpdate);
Event::OnDraw::Add(OnDraw);
Event::OnSpellCast::Add(OnSpellCast);
Event::OnNewPath::Add(OnNewPath);
}
// Plugin entry function
PLUGIN_API void OnPluginStart() {
// Initialize SDK
Noble::Init(PluginType::Champion, "My First Script", { "Annie", "Ashe" });
// Register events
RegisterEvents();
}
By following the steps above, you have created a complete script that can:
- Initialize the SDK and register the plugin
- Create a user interface
- Register various game events
- Implement a combo system
You can further expand on this example by adding more features and custom logic to meet your needs.