// Wolf Roleplay example - COMBAT SETUP (run once by the game's owner on a region running their // game). Defines the mana stat, the weapons and armour the two combat examples use, and registers // those two scripts as the game's OWN (wolfGameTrustScript) - only the game's own scripts may hurt // players, take mana, and move ammunition. // // Put copies of "combat_sword_and_spell" and "combat_gun" in THIS object's inventory first: a // script is trusted by its asset, and a copy has the same asset as long as nobody edits it. // Everything here can also be done from the control panel's Roleplay section. // TRUE makes this region an arena: Game Mode stays on for everyone here, so nobody can switch it // off to avoid a fight (their own saved choice is untouched; it applies again when they leave). // FALSE leaves the region as it is - it never turns off forcing set from the control panel; // wolfGameForceMode(FALSE) does that. integer FORCE_GAME_MODE = FALSE; say(string what, integer ok) { if (ok) llOwnerSay(what + ": OK"); else llOwnerSay(what + ": REFUSED - " + wolfGetLastError()); } default { touch_start(integer n) { if (llDetectedKey(0) != llGetOwner()) return; if (wolfGameKey() == "") { llOwnerSay("This region runs no game - wolfGameCreate first."); return; } // Mana: spells cost it, it comes back 6 a minute. The region TAKES the cost of an // ability set by the game's own script, so the spell script never counts mana itself. say("stat mana", wolfGameDefineStat("mana", ["label", "Mana", "min", 0, "max", 100, "start", 100, "rate", 6, "colour", "#3b82f6", "order", 3])); // Weapons and armour. The damage/range/firemode/defence are what the weapons panel SHOWS; // the scripts decide the real numbers. say("item sword", wolfGameDefineItem("sword", ["label", "Iron sword", "kind", "weapon", "slot", "main", "damage", "12-18", "range", "3 m", "firemode", "melee", "max", 1, "order", 10])); say("item rifle_ammo", wolfGameDefineItem("rifle_ammo", ["label", "Rifle rounds", "kind", "consumable", "max", 600, "order", 12])); say("item rifle", wolfGameDefineItem("rifle", ["label", "Hunting rifle", "kind", "weapon", "slot", "ranged", "damage", "8-12", "range", "100 m", "firemode", "semi-auto", "magazine", 30, "ammo", "rifle_ammo", "max", 1, "order", 11])); say("item leather", wolfGameDefineItem("leather", ["label", "Leather jerkin", "kind", "armour", "slot", "body", "defence", "5", "max", 1, "order", 13])); // The two worn weapon scripts are the game's own. say("trust combat_sword_and_spell", wolfGameTrustScript("combat_sword_and_spell")); say("trust combat_gun", wolfGameTrustScript("combat_gun")); if (FORCE_GAME_MODE) say("force Game Mode", wolfGameForceMode(TRUE)); } }