From d527e2195f46a4dd7d152cc1b04b0c4892a063b6 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 9 Dec 2021 13:44:48 -0300 Subject: (Theoretically) make moonshrooms at Santa passive. --- npc/081-3/logic.txt | 3 ++- npc/annuals/xmas/2021.txt | 19 ++++++++++++++++--- npc/functions/main.txt | 13 +++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/npc/081-3/logic.txt b/npc/081-3/logic.txt index ad18e529..d4a173b6 100644 --- a/npc/081-3/logic.txt +++ b/npc/081-3/logic.txt @@ -145,11 +145,12 @@ OnTimer40000: OnClean: enablenpc(.name$); killmonsterall(getmapinfo(MAPINFO_NAME)); +OnInstanceInit: + 'LOCKD = false; OnInit: .distance=2; .BC1ID = 0; .CYCLE = 0; - 'LOCKD = false; end; } diff --git a/npc/annuals/xmas/2021.txt b/npc/annuals/xmas/2021.txt index 658588cf..cd74a9de 100644 --- a/npc/annuals/xmas/2021.txt +++ b/npc/annuals/xmas/2021.txt @@ -371,15 +371,25 @@ function script X21_SEEDS { 080-1,0,0,0 script #XMAS21Core NPC_HIDDEN,{ end; -// "#XMAS21Core"::spawn(MonsterID, {Amount=1, {Map=this}}) +// "#XMAS21Core"::spawn(MonsterID, {Amount=1, {Map=this, Normal=true}}) public function spawn { if (playerattached()) .@m$=getarg(2, getmap()); else .@m$=getarg(2); .@n$="#XMAS21Core::On"+getarg(0); - if (mobcount(.@m$, .@n$) < 200) + if (mobcount(.@m$, .@n$) < 200 && getarg(3, true)) { + /* Spawn normally */ areamonster .@m$, 20, 20, getmapinfo(MAPINFO_SIZE_X, .@m$)-20, getmapinfo(MAPINFO_SIZE_Y, .@m$)-20, strmobinfo(1, getarg(0)), getarg(0), getarg(1, 1), .@n$; + } else if (!getarg(3, true)) { + /* Spawn as passive */ + freeloop(true); + for (.@i=0; .@i < getarg(1, 1); .@i++) { + .@m = areamonster(.@m$, 20, 20, getmapinfo(MAPINFO_SIZE_X, .@m$)-20, getmapinfo(MAPINFO_SIZE_Y, .@m$)-20, strmobinfo(1, getarg(0)), getarg(0), 1, .@n$+"B"); + unset_aggro(.@m); + } + freeloop(false); + } /* Aqua Ticket Drops */ if (playerattached()) { @@ -498,6 +508,9 @@ On1162: On1130: spawn(Moonshroom); end; +On1130B: + spawn(Moonshroom, 1, getmap(), false); + end; /* Ice Caves */ On1093: @@ -639,7 +652,7 @@ OnInit: "#XMAS21Core"::spawn(WhiteSlime, 12, "081-1"); "#XMAS21Core"::spawn(SantaSlime, 4, "081-1"); "#XMAS21Core"::spawn(Moggun, 10, "081-1"); - "#XMAS21Core"::spawn(Moonshroom, 7, "081-1"); + "#XMAS21Core"::spawn(Moonshroom, 7, "081-1", false); end; } diff --git a/npc/functions/main.txt b/npc/functions/main.txt index b94aa8ac..c46f04d4 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -528,6 +528,19 @@ function script set_aggro { return; } +// Makes a monster passive +// unset_aggro( monster{, mode=MD_AGGRESSIVE} ) +function script unset_aggro { + .@m=getarg(0); + .@x=getarg(1, MD_AGGRESSIVE); + .@op=getunitdata(.@m, UDT_MODE); + if (.@op & .@x) { + .@op=.@op^.@x; + setunitdata(.@m, UDT_MODE, .@op); + } + return; +} + // Special function which makes a date as a number // numdate( - ) function script numdate { -- cgit v1.2.3-60-g2f50