Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.
Merged
21 changes: 19 additions & 2 deletions data/src/scripts/npc/scripts/shadow_spider.rs2
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
[ai_opplayer2,shadow_spider]
if (stat(hitpoints) = 0) {
npc_setmode(null);
return;
}
if (%npc_action_delay > map_clock) {
return;
}
if (~npc_can_attack_player = false) {
npc_setmode(null);
return;
}
// https://www.youtube.com/watch?v=qCuX19-3SHc&t=185s
if (~npc_out_of_combat = true) {
~shadow_spider_drain;
}
gosub(npc_default_attack);
~npc_meleeattack;

[proc,shadow_spider_drain]
mes("The spider drains your prayer...");
sound_synth(prayer_drain, 0, 0);
stat_sub(prayer, divide(stat(prayer), 2), 0); // division by 2 round up, thats why percent isn't being used
stat_sub(prayer, divide(stat(prayer), 2), 0); // division by 2 round up, thats why percent isn't being used

[ai_queue2,shadow_spider]
if (~npc_out_of_combat = true & finduid(%npc_aggressive_player) = true) {
~shadow_spider_drain;
}
~npc_default_damage(last_int);
2 changes: 2 additions & 0 deletions data/src/scripts/quests/quest_arthur/scripts/sir_mordred.rs2
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ gosub(npc_default_death);
[ai_queue4,sir_mordred] gosub(npc_default_death);

[label,lefaye_spare_son]
npc_statheal(hitpoints, npc_basestat(hitpoints), 0);

if_close;
if(p_finduid(%npc_aggressive_player) = false) {
return;
Expand Down
32 changes: 0 additions & 32 deletions data/src/scripts/quests/quest_demon/scripts/delrith.rs2
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,6 @@ if (npc_stat(hitpoints) = 0) {
}
}

[apnpc2,delrith]
if (npc_range(coord) > 1)
{
p_aprange(1);
return;
}
@attack_delrith;

[opnpc2,delrith]
@attack_delrith;

[label,attack_delrith]
if (%demon_progress = ^demon_silverlight) {
if (inv_getobj(worn, 3) ! silverlight) {
if (inv_total(inv, silverlight) > 0) {
mes("Maybe I'd better wield silverlight first.");
return;
}

if (inv_total(inv, silverlight) < 1) {
mes("I'd rather not. He looks scary.");
return;
}
}
@player_combat_start;
} else if (%demon_progress = ^demon_complete) {
mes("You've already done that quest.");
}
else{
mes("I'd rather not. He looks scary");
}

[queue,delrith_death]
if_close;
if (npc_find(coord, delrith, 8, 0) = true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ if(inv_total(worn, excalibur) = 0) { // if this was queued we'll need to regain
if(%grail_progress = ^grail_spoken_crone) {
%grail_progress = ^grail_failed_defeat_titan;
}
npc_statheal(hitpoints, npc_basestat(hitpoints), 0);
mes("Maybe you need something more to beat the titan?");
~chatnpc("<p,angry>@red@Puny mortal...|@red@You cannot defeat me...");
~chatnpc("<p,angry>@red@I...|@red@Am...|@red@INVINCIBLE!!!");
Expand Down
8 changes: 5 additions & 3 deletions data/src/scripts/quests/quest_mcannon/scripts/cannon.rs2
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ while ($i < 50) {
return(null);

[opheld1,cannon_base]
if (%mcannon_progress < ^mcannon_complete) {
mes("You can't set up this cannon.");
mes("You need to complete the Dwarf Cannon quest."); // osrs
return;
}
if (%mcannon_coord ! null) {
if (loc_find(%mcannon_coord, cannon) = true) {
// osrs
Expand Down Expand Up @@ -354,9 +359,6 @@ if (%mcannon_ammo < 1) {
if (~npc_is_attackable = false) {
return;
}
if (npc_stat(hitpoints) = 0) {
return;
}
if (~player_in_combat_check = false) { // https://youtu.be/TeQXQDaawO0?t=247
return;
}
Expand Down
63 changes: 29 additions & 34 deletions data/src/scripts/quests/quest_vampire/scripts/count_draynor.rs2
Original file line number Diff line number Diff line change
@@ -1,60 +1,55 @@
[ai_queue3,count_draynor] // do nothing
[ai_queue4,count_draynor] gosub(npc_death);

[opnpc2,count_draynor]
if (~player_in_combat_check = false) {
return;
}
if (%vampire_progress = ^vampire_complete) {
mes("You've done enough vampire slaying.");
return;
}
// osrs wiki says manually casting spells doesnt work but autocast does. So its probably here
// https://youtu.be/67aR5-_INcU
// - seems to be called on npc damage, and on npc hit
// - two calls from 66 hits
[proc,count_draynor_garlic]
if (inv_total(inv, garlic) > 0) {
if (npc_stat(hitpoints) = npc_basestat(hitpoints)) { // osrs https://archive.is/djWKq
npc_statsub(hitpoints, 10, 0);
npc_statsub(attack, 10, 0);
npc_statsub(strength, 10, 0);
npc_statsub(defence, 40, 0);
mes("The vampire seems to weaken.");
} else if (random(16) = 0) {
} else if (random(64) = 0) {
mes("The vampire seems to weaken.");
}
}

@player_combat_start;
[apnpc2,count_draynor]
if (~player_in_combat_check = false) {
[ai_opplayer2,count_draynor]
if (stat(hitpoints) = 0) {
npc_setmode(null);
return;
}
if (%vampire_progress = ^vampire_complete) {
mes("You've done enough vampire slaying.");
if (%npc_action_delay > map_clock) {
return;
}
// osrs wiki says manually casting spells doesnt work but autocast does. So its probably here
if (inv_total(inv, garlic) > 0) {
if (npc_stat(hitpoints) = npc_basestat(hitpoints)) { // osrs https://archive.is/djWKq
npc_statsub(hitpoints, 10, 0);
npc_statsub(attack, 10, 0);
npc_statsub(strength, 10, 0);
npc_statsub(defence, 40, 0);
mes("The vampire seems to weaken.");
} else if (random(16) = 0) {
mes("The vampire seems to weaken.");
}
if (~npc_can_attack_player = false) {
npc_setmode(null);
return;
}
@player_combat_start_ap;
anim(%com_defendanim, 0);
npc_anim(npc_param(attack_anim), 0);
if (npc_param(attack_sound) ! null) {
sound_synth(npc_param(attack_sound), 0, 0);
}
~count_draynor_garlic;
~npc_meleeattack;

[ai_queue2,count_draynor]
if (finduid(%npc_aggressive_player) = true) {
~count_draynor_garlic;
}
~npc_default_damage(last_int);
if (npc_stat(hitpoints) = 0) {
if (npc_findhero = true) {
if (p_finduid(uid) = true) {
@count_draynor_use_stake;
}


[ai_queue3,count_draynor]
if (npc_findhero = true) {
if (p_finduid(uid) = true) {
@count_draynor_use_stake;
}
npc_statheal(hitpoints, 1, 0);
}
npc_statheal(hitpoints, 1, 0);

[label,count_draynor_use_stake]
if (inv_total(inv, stake) = 0) {
Expand Down
42 changes: 41 additions & 1 deletion data/src/scripts/skill_combat/scripts/npc/npc_combat.rs2
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,27 @@ if(npc_type = npc_374 & %damagetype <= ^crush_style & npc_range(coord) <= 1) {
return (false);
}

if (npc_type = delrith) {
if (%demon_progress >= ^demon_complete) {
mes("You've already done that quest.");
return(false);
}
if (inv_getobj(worn, 3) ! silverlight) {
if (inv_total(inv, silverlight) > 0) {
mes("Maybe I'd better wield silverlight first.");
return(false);
}
mes("I'd rather not. He looks scary");
return(false);
}
}
if (npc_type = count_draynor) {
if (%vampire_progress = ^vampire_complete) {
mes("You've done enough vampire slaying.");
return(false);
}
}

if (npc_hasop(2) = true) {
return (true);
}
Expand Down Expand Up @@ -229,7 +250,26 @@ if (%vampire_progress = ^vampire_complete & npc_type = count_draynor) {
mes("You've done enough vampire slaying.");
return(false);
}

if (npc_type = delrith) {
if (%demon_progress >= ^demon_complete) {
mes("You've already done that quest.");
return(false);
}
if (inv_getobj(worn, 3) ! silverlight) {
if (inv_total(inv, silverlight) > 0) {
mes("Maybe I'd better wield silverlight first.");
return(false);
}
mes("I'd rather not. He looks scary");
return(false);
}
}
if (npc_type = count_draynor) {
if (%vampire_progress = ^vampire_complete) {
mes("You've done enough vampire slaying.");
return(false);
}
}
if (npc_hasop(2) = true) {
return (true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,8 @@ if (%damagetype = ^ranged_style) {
@player_ranged_attack;
}
if (~player_autocast_enabled = true) {
def_dbrow $spell_data = ~get_spell_data(%autocast_spell);
if (~check_spell_requirements($spell_data) = true) {
p_stopaction;
p_opnpct(db_getfield($spell_data, magic_spell_table:spellcom, 0));
}
return;
@player_magic_attack;
}

@player_melee_attack;


Expand Down
37 changes: 18 additions & 19 deletions data/src/scripts/skill_combat/scripts/player/player_magic.rs2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
// add it to the spell table in ../configs/magic/magic_combat_spells.dbrow
// create an apnpct trigger for it in this script

[label,player_magic_attack]
if (~npc_is_attackable = false) { // test: wormbrain's special mes shows before if you dont have enough runes to autocast a specific spell
return;
}
def_dbrow $spell_data = ~get_spell_data(%autocast_spell);
if (~check_spell_requirements($spell_data) = false) {
if (%autocast_spell = db_getfield($spell_data, magic_spell_table:spell, 0)) { // matches osrs behavior
%attackstyle_magic = 0;
}
return;
}
p_opnpct(db_getfield($spell_data, magic_spell_table:spellcom, 0));

// osrs's opnpct triggers are unused
[apnpct,magic:wind_strike]
if (%tutorial_progress < ^tutorial_complete) {
Expand Down Expand Up @@ -60,41 +73,27 @@ if (~player_npc_hit_roll(^magic_style) = true) {
~pvm_spell_fail($spell_data, $duration);
}

// no 0 hp check for magic: you can attack slayer npcs when they're at 0 hp
[proc,pvm_combat_spell_checks](dbrow $spell_data)(boolean)
if_close;
p_stopaction;
if(npc_stat(hitpoints) = 0 & (npc_type = sir_mordred | npc_type = black_knight_titan)) {
npc_statheal(hitpoints, npc_basestat(hitpoints), 0);
}
if (npc_stat(hitpoints) = 0) {
return(false); // this means the npc is not avail to fight i.e dead
}
if (map_clock < %action_delay) {
p_opnpct(db_getfield($spell_data, magic_spell_table:spellcom, 0));
return(false);
}
if (~check_spell_requirements($spell_data) = false) {
if (%autocast_spell = db_getfield($spell_data, magic_spell_table:spell, 0)) { // matches osrs behavior
%attackstyle_magic = 0;
}
return(false);
}
if (~player_in_combat_check = false) {
return(false);
}
// check if npc is attackable
if (~npc_is_attackable_opt() = false) {
if (~npc_is_attackable_opt = false) {
return(false);
}
if (npc_type = delrith) {
if (%demon_progress < ^demon_complete) {
if (inv_getobj(worn, 3) ! silverlight) {
return(false);
}
} else {
return(false);
}
}
if (npc_type = shadow_spider & %npc_attacking_uid ! uid & ~npc_out_of_combat = true) {
~shadow_spider_drain;
}
return(true);

[proc,pvm_freeze_allowed](dbrow $spell_data)(boolean)
Expand Down
4 changes: 0 additions & 4 deletions data/src/scripts/skill_combat/scripts/player/player_melee.rs2
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,4 @@ if ($weapon = null) {
%action_delay = add(map_clock, oc_param($weapon, attackrate));
}

if (npc_type = shadow_spider & %npc_attacking_uid ! uid & ~npc_out_of_combat = true) {
~shadow_spider_drain;
}

p_opnpc(2);
Loading