Posted by: ZylonBane
« on: 09. June 2024, 15:08:39 »Sarge has previously admitted to being a quicksave addict. It probably makes him feel better about his addiction to believe that everyone is the same way.
Oh deary me, you actually believe this, don't you.You do realise the average player mashes the quicksave key every 5 seconds, right?
Reloading on the other hand resets your inventory, stats, and progress to whatever it was the last time you remembered to save or entered the current deck, requiring you to redo everything you'd done between then and dying. And it breaks immersion.
"If they can always resurrect at any previous QBR it makes things a bit less interesting."
It's not always though. 0 nanites = game over. I will be using the super duper version of your mod for sure.
/*
Super QBRs 0.9
May 24, 2024
by ZylonBane
Enhances QBRs to work across decks and maps. When you die, if there isn't an active
QBR in the current map, you will be resurrected at the closest active QBR. This will
not function in the endgame maps.
This mod cannot be activated mid-game. Can be deactivated mid-game.
*/
// --------------------------------------------------------------------------------
// Script configuration
const SAME_DECK_ONLY = false; // constrains resurrecting to QBR on current deck
// --------------------------------------------------------------------------------
class zbQBR_Base extends SqRootScript {
function mapName() {
local mapRef = string();
Version.GetMap(mapRef);
local map = mapRef.tostring().tolower();
local s = map.find(".mis");
return map.slice(0, s);
}
}
// --------------------------------------------------------------------------------
class zbQBR_ResBtn extends zbQBR_Base {
function OnFrobWorldEnd() {
if (!IsDataSet("Done")) {
Quest.Set("qbr_" + mapName(), 1, eQuestDataType.kQuestDataCampaign);
Property.SetSimple(ObjID("Respawn Marker"), "StartLoc", 8675309);
SetData("Done", true);
};
}
}
// --------------------------------------------------------------------------------
class zbQBR_Player extends zbQBR_Base {
function OnBeginScript() {
if (GetProperty("DestLevel") == mapName()) {
// clear temp data
Property.Remove(self, "DestLevel");
Property.Remove(self, "DestLoc");
// resurrect player
ShockGame.PlayerMode(0);
Damage.Resurrect(self, 0);
ShockGame.StartFadeIn(2000, 0, 0, 0);
Sound.PlaySchemaAmbient(self, "revive");
ShockGame.ShutoffPsi();
ShockGame.OverlayChange(kOverlayRadar, 0);
SetProperty("RadLevel", 0);
SetProperty("RadAmb",0);
ShockGame.OverlayChange(kOverlayRadiation, 0);
SetProperty("Toxin", 0);
ShockGame.OverlayChange(kOverlayPoison, 0);
SetProperty("Hitpoints", GetProperty("MAX_HP") / 3);
}
}
function OnSlain() {
// abort if can respawn on this deck, multiplayer, past point of no return, or immortal
if (Quest.Get("AllowRespawn") || Quest.Get("Difficulty") == 5 || Quest.Get("Note_7_7") == 2 || !ShockGame.AllowDeath()) {
return;
}
local mapList = [
["eng1", 1],
["eng2", 1],
["medsci1", 2],
["medsci2", 2],
["hydro1", 3],
["hydro2", 3],
["hydro3", 3],
["hydro4", 3],
["ops1", 4],
["ops2", 4],
["ops3", 4],
["ops4", 4],
["rec1", 5],
["rec2", 5],
["rec3", 5],
["command1", 6],
["command2", 6],
["rick1", 7],
["rick2", 7],
["rick3", 7]
];
local map, curDeck, qbrDist, qbrMap, spawnOk;
local qbrDistBest = 999;
local curMap = mapName();
// find current deck
foreach (map in mapList) {
if (map[0] == curMap) {
curDeck = map[1];
break;
}
}
if (!curDeck) {
return;
}
// scan for closest activated QBRs
foreach (map in mapList) {
if (Quest.Exists("qbr_" + map[0])) {
qbrDist = abs(curDeck - map[1]);
if (SAME_DECK_ONLY) {
if (qbrDist == 0) {
qbrMap = map[0];
break;
}
}
else if (qbrDist < qbrDistBest) {
qbrDistBest = qbrDist;
qbrMap = map[0];
}
}
}
// active QBR found
if (qbrMap) {
if (Quest.Get("Difficulty") == 1) {
spawnOk = true;
}
else {
if (ShockGame.PayNanites(10) == S_OK) {
spawnOk = true;
ShockGame.AddTranslatableText("ResurrectUsed", "misc", self);
}
else {
spawnOk = false;
ShockGame.AddTranslatableText("ResurrectNeedNanites", "misc", self);
}
}
if (spawnOk) {
SetProperty("DestLevel", qbrMap);
SetProperty("DestLoc", 8675309);
SetOneShotTimer("QBRLeap", 4.9);
}
}
}
function OnTimer() {
if (message().name == "QBRLeap") {
ShockGame.LevelTransport(GetProperty("DestLevel"), GetProperty("DestLoc"), 0);
}
}
}