mirror of
https://github.com/bdnugget/rs-sdk.git
synced 2026-11-07 09:07:30 +00:00
feat(content): pvp death mark keeps respawn at 1hp for 5 minutes
A pvp death now sets %pvp_death_mark (repurposed unused varp 358 so the client cache CRC is unchanged) for 1000 ticks. Any death while marked respawns at 1hp, so suiciding on an npc right after losing a fight no longer shortcuts back to full health. The mark persists across logout using the same remaining-ticks scheme as pk_skull, and expires on its own; npc deaths while marked do not refresh it. Adds ::pvpmark / ::checkpvpmark debug cheats. Verified locally: unmarked npc death respawns at full hp, marked npc death (mark injected via .sav, exercising the login path) respawns at 1hp. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9afd6d9613
commit
a868401408
9 files changed
+52
-4
No files matched your search
@@ -356,4 +356,4 @@
|
||||
355=boardgames_varbit
|
||||
356=boardgames_varbit2
|
||||
357=varp_357
|
||||
358=varp_358
|
||||
358=pvp_death_mark
|
||||
@@ -7,6 +7,13 @@ mes("map_clock: <tostring(map_clock)>, %pk_skull: <tostring(%pk_skull)>");
|
||||
[debugproc,clearskull]
|
||||
~clear_pk_skull;
|
||||
|
||||
[debugproc,pvpmark]
|
||||
~set_pvp_death_mark;
|
||||
mes("pvp death mark set: map_clock <tostring(map_clock)>, expires <tostring(%pvp_death_mark)>");
|
||||
|
||||
[debugproc,checkpvpmark]
|
||||
mes("map_clock: <tostring(map_clock)>, %pvp_death_mark: <tostring(%pvp_death_mark)>");
|
||||
|
||||
[debugproc,singles]
|
||||
def_string $pk_preyname;
|
||||
def_string $pk_predatorname;
|
||||
|
||||
@@ -6,5 +6,4 @@
|
||||
|
||||
[varp_357]
|
||||
|
||||
[varp_358]
|
||||
|
||||
@@ -52,6 +52,8 @@ queue(macro_event_login, 0, 0);
|
||||
~macro_cube_login;
|
||||
// so pk skulls persist after logging back in
|
||||
~set_pk_skull_login;
|
||||
// so the pvp 1hp-respawn mark persists after logging back in
|
||||
~set_pvp_death_mark_login;
|
||||
// so antifire persists after logging back in
|
||||
~set_antifire_login;
|
||||
// if player is in a duel, they are removed from the duel
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// TODO: Change compiler to remove return value
|
||||
[logout,_]()(boolean)
|
||||
~set_pk_skull_logout;
|
||||
~set_pvp_death_mark_logout;
|
||||
~set_antifire_logout; // TODO: should be timer
|
||||
~follower_logout;
|
||||
~duel_arena_logout;
|
||||
|
||||
@@ -38,9 +38,13 @@ buildappearance(worn);
|
||||
anim(null, 0);
|
||||
p_stopaction;
|
||||
|
||||
~stat_reset_all;
|
||||
if ($pvp_death = true) {
|
||||
// deaths to another player respawn at 1hp instead of full
|
||||
~set_pvp_death_mark;
|
||||
}
|
||||
~stat_reset_all;
|
||||
// deaths to another player respawn at 1hp instead of full, and the mark
|
||||
// keeps any death at 1hp for a while so an npc suicide can't undo it
|
||||
if ($pvp_death = true | ~has_pvp_death_mark = true) {
|
||||
stat_sub(hitpoints, calc(stat(hitpoints) - 1), 0);
|
||||
}
|
||||
healenergy(10000);
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
^pk_skull_duration = 2000
|
||||
// 5 minutes at the 300ms prod tickrate
|
||||
^pvp_death_mark_duration = 1000
|
||||
@@ -0,0 +1,3 @@
|
||||
[pvp_death_mark]
|
||||
protect=no
|
||||
scope=perm
|
||||
@@ -0,0 +1,30 @@
|
||||
// %pvp_death_mark holds the map_clock tick at which the mark expires.
|
||||
// While marked, every death respawns at 1hp so players can't suicide on an
|
||||
// npc right after a pvp death to shortcut back to full health.
|
||||
|
||||
// requires active_player
|
||||
[proc,set_pvp_death_mark]
|
||||
%pvp_death_mark = add(map_clock, ^pvp_death_mark_duration);
|
||||
|
||||
[proc,has_pvp_death_mark]()(boolean)
|
||||
if (map_clock < %pvp_death_mark) {
|
||||
return(true);
|
||||
}
|
||||
return(false);
|
||||
|
||||
// stored as remaining ticks while offline, same scheme as pk_skull
|
||||
[proc,set_pvp_death_mark_logout]
|
||||
if (%pvp_death_mark < 1) {
|
||||
return;
|
||||
}
|
||||
%pvp_death_mark = sub(%pvp_death_mark, map_clock);
|
||||
|
||||
[proc,set_pvp_death_mark_login]
|
||||
if (%pvp_death_mark < 1) {
|
||||
%pvp_death_mark = 0;
|
||||
return;
|
||||
}
|
||||
if (%pvp_death_mark > ^pvp_death_mark_duration) {
|
||||
%pvp_death_mark = ^pvp_death_mark_duration;
|
||||
}
|
||||
%pvp_death_mark = add(map_clock, %pvp_death_mark);
|
||||
Reference in new issue
Block a user