// Open the Shop NamedScript KeyBind void OpenShop(bool OpenLocker) { // If you're dead, return if (GetActorProperty(0, APROP_Health) <= 0) return; // If you're in an Outpost menu, return if (Player.OutpostMenu > 0) return; // If you're in any minigames, return if (Player.InMinigame) return; // If you're looking inside a crate, return if (Player.CrateOpen) return; // Close the main menu if it's open Player.InMenu = false; // Sanity check for pressing use while the shop is open in front of the counter in the Outpost if (Player.InShop && CheckInput(BT_USE, KEY_HELD, false, PlayerNumber())) return; if (Player.InShop) { ActivatorSound("menu/leave", 127); SetPlayerProperty(0, 0, PROP_TOTALLYFROZEN); Player.InShop = false; } else { ActivatorSound("menu/shop", 127); Player.InShop = true; if (OpenLocker) Player.LockerMode = true; } }
NamedScript DECORATE void TryStatusEffect(int Type, int Time, int Intensity) { // Can't get Status Effects if Pink Aura is active if (Player.Aura.Type[AURA_PINK].Active || Player.SoulActive[SOUL_PINK]) return; // Status Effect Resist check if (RandomFixed(0.0, 100.0) <= Player.StatusEffectResist) { ActivatorSound("health/statuseffect2", 127); Player.Payout.StatusEffectsEvaded++; } else // Apply status effect { ActivatorSound("health/statuseffect", 127); Player.StatusTypeHUD = Type; StatusEffect(Type, Time, Intensity); Player.Payout.StatusEffectHit++; } }
NamedScript MenuEntry void SaveCharacter() { char const *SaveString; char *EncodedSaveString; //CharSaveInfo Info; // You need to be in the Outpost to do this if (!CurrentLevel->UACBase && !GetCVar("drpg_debug")) { PrintError("\CgERROR: \CjYou must be in the Outpost to save and deposit your equipment"); ActivatorSound("menu/error", 127); return; }
void ShopItemTryAutoDeposit(ItemInfoPtr Item) { bool deposited = false; // Special handling for DRLA weapons since you can only keep one weapon with mods in the locker if (CompatMode == COMPAT_DRLA && Item->Category == 0 && Player.Locker[Item->Category][Item->Index] > 0) return; while (CheckInventory(Item->Actor) > 0 && (Player.EP >= LOCKER_EPRATE || CurrentLevel->UACBase)) { DepositItem(Item->Category, Item->Index, false, true); deposited = true; } if (deposited) ActivatorSound("shop/autostore", 127); }
NamedScript KeyBind void UseMedkit() { if (Player.Medkit <= 0 || Player.ActualHealth >= Player.HealthMax) return; int HealAmount = Player.HealthMax - Player.ActualHealth; if (Player.Medkit < HealAmount) HealAmount = Player.Medkit; else if (HealAmount + Player.ActualHealth > Player.HealthMax) HealAmount = Player.HealthMax - Player.ActualHealth; Player.ActualHealth += HealAmount; Player.Medkit -= HealAmount; ActivatorSound("items/health", 127); }
// Keeps current level and XP updated void CheckLevel() { if (Player.Level < MAX_LEVEL) Player.XPNext = XPTable[Player.Level]; if (Player.Level >= MAX_LEVEL) { Player.XP = XPTable[MAX_LEVEL - 1]; Player.XPNext = XPTable[MAX_LEVEL - 1]; } // Now check for a level up if (Player.XP >= XPTable[Player.Level] && Player.Level < MAX_LEVEL) { int Modules = (int)((((fixed)Player.Level + 1) * 100.0) * GetCVarFixed("drpg_module_levelfactor")); // Level Up Player.Level++; Player.Payout.Levels++; GiveInventory("DRPGModule", Modules); if (GetCVar("drpg_levelup_heal")) { HealThing(SHIELD_HEALTH); if (Player.EP < 0) Player.EP = 0; else Player.EP = Player.EPMax; } FadeRange(255, 255, 255, 0.5, 255, 255, 255, 0, 2.0); PrintMessage(StrParam("You have reached level %d", Player.Level), LEVELUP_ID, -32); ActivatorSound("misc/levelup", 96); SpawnForced("DRPGLevelUpArrow", GetActorX(0), GetActorY(0), GetActorZ(0) + GetActorPropertyFixed(Player.TID, APROP_Height), 0, 0); } }
// Arena Script NamedScript MapSpecial void ArenaLoop() { int BonusRandomizer, Buttons, OldButtons; bool Ready; ArenaSetEnvironment(AEVENT_NONE); // Arena Loop while (true) { // Stop the script if the Arena is stopped or the Arena activator dies if (!ArenaActive || ClassifyActor(Players(ArenaPlayerNumber).TID) & ACTOR_DEAD) { ArenaStop(); return; } // Arena HUD ArenaDrawHUD(); // Arena Status Handling if (ArenaState == ARENA_INTERMISSION) { BonusRandomizer = Random(-10, ABONUS_MAX - 1); ArenaMod = -1; ArenaGetBonus(BonusRandomizer); ArenaSetEnvironment(AEVENT_NONE); ArenaState = ARENA_WAITING; } else if (ArenaState == ARENA_WAITING) { Buttons = GetPlayerInput(ArenaPlayerNumber, INPUT_BUTTONS); OldButtons = GetPlayerInput(ArenaPlayerNumber, INPUT_OLDBUTTONS); Ready = true; SetHudSize(0, 0, false); SetFont("BIGFONT"); if (ArenaPlayerNumber == PlayerNumber()) { if (!Player.InMenu && !Player.InShop && !Player.OutpostMenu) { HudMessage("Press \Cd%jS\C- to start the next wave\nPress \Cd%jS\C- to exit the Arena", "+use" , "+speed"); EndHudMessage(HUDMSG_PLAIN, 0, "White", 1.5, 0.75, 0.05); } if (Buttons & BT_USE && (!Player.InMenu && !Player.InShop && !Player.OutpostMenu && !Player.CrateOpen) && !Player.MenuBlock) { // Check to see if others are still in the menu for (int i = 0; i < MAX_PLAYERS; i++) if (Players(i).InMenu || Players(i).InShop) Ready = false; if (Ready) { ArenaKeyTimer++; ArenaKeyTimerType = AKTIMER_CONTINUE; if (ArenaKeyTimer > ARENA_HOLDTIME) { // Multiplayer Countdown if (InMultiplayer) { SetFont("BIGFONT"); for (int i = 3; i > 0; i--) { HudMessage("%d", i); EndHudMessageBold(HUDMSG_FADEOUT, 0, "Green", 0.5, 0.5, 0.25, 0.75); Delay(35); } } ArenaWave++; ArenaState = ARENA_READY; } } else { PrintError("Someone is currently in a menu"); ActivatorSound("menu/error", 127); } } else if (Buttons & BT_SPEED && (!Player.InMenu && !Player.InShop && !Player.OutpostMenu && !Player.CrateOpen)) { ArenaKeyTimer++; ArenaKeyTimerType = AKTIMER_STOP; if (ArenaKeyTimer > ARENA_HOLDTIME) { ArenaStop(); return; } } else ArenaKeyTimer = 0; // Reset menu block if (Buttons == 0 && OldButtons == 0) Player.MenuBlock = false; } }