From 41b8b307dadcfc99b1c8ad382bf6943be438ed90 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sun, 4 Aug 2019 02:33:57 -0300 Subject: COD - Optimize getitem script to avoid crashes --- npc/001-10/scripts.txt | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'npc') diff --git a/npc/001-10/scripts.txt b/npc/001-10/scripts.txt index f06a6abb8..305b29887 100644 --- a/npc/001-10/scripts.txt +++ b/npc/001-10/scripts.txt @@ -72,44 +72,58 @@ OnTouch: // Death handlers OnWLDeath: - if (rand(0,1000) <= 20) - getitem BottledDust, 1; + if (playerattached()) { + if (rand2(0,1000) <= 20) + getitem BottledDust, 1; + } spawner("#CODMASTER::OnWLDeath", 0, 0, 200, 150, 1, 1); end; OnNDeath: - if (rand(0,1000) <= 40) - getitem BottledDust, 1; + if (playerattached()) { + if (rand2(0,1000) <= 40) + getitem BottledDust, 1; + } spawner("#CODMASTER::OnNDeath", 0, 10, 200, 25); end; OnSDeath: - if (rand(0,1000) <= 40) - getitem BottledDust, 1; + if (playerattached()) { + if (rand2(0,1000) <= 40) + getitem BottledDust, 1; + } spawner("#CODMASTER::OnSDeath", 0, 129, 200, 150); end; OnCDeath: - if (rand(0,1000) <= 40) - getitem BottledDust, 1; + if (playerattached()) { + if (rand2(0,1000) <= 40) + getitem BottledDust, 1; + } spawner("#CODMASTER::OnCDeath", 73, 45, 132, 86); end; OnWDeath: - if (rand(0,1000) <= 40) - getitem BottledDust, 1; + if (playerattached()) { + if (rand2(0,1000) <= 40) + getitem BottledDust, 1; + } spawner("#CODMASTER::OnWDeath", 10, 25, 72, 122); end; OnEDeath: - if (rand(0,1000) <= 40) - getitem BottledDust, 1; + if (playerattached()) { + if (rand2(0,1000) <= 40) + getitem BottledDust, 1; + } spawner("#CODMASTER::OnEDeath", 160, 45, 190, 130); end; OnDeath: - if (rand(0,1000) <= 40) - getitem BottledDust, 1; + if (playerattached()) { + if (rand2(0,1000) <= 40) + getitem BottledDust, 1; + } spawner("#CODMASTER::OnDeath"); end; -- cgit v1.2.3-60-g2f50