From 45ca4be7791975f0e008a8fb60aeadabec2a21c7 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 3 Jun 2019 16:16:45 -0300 Subject: Make traps more flexible, bugfix --- npc/001-4/traps.txt | 7 ++++--- npc/015-8-1/campaign.txt | 22 +++++++++++++++++----- npc/015-8-1/puzzle.txt | 5 ++++- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/npc/001-4/traps.txt b/npc/001-4/traps.txt index 0c00263ef..3d50f34fe 100644 --- a/npc/001-4/traps.txt +++ b/npc/001-4/traps.txt @@ -4,23 +4,24 @@ // Description: // Traps. -// SteelTrap( {damage=80%}, {delay=15s}, {stun=3s} ) +// SteelTrap( {damage=80%}, {delay=15s}, {stun=3s}, {npcname=auto} ) function script SteelTrap { .@dmg=getarg(0, 80); .@delay=getarg(1, 15); .@stun=getarg(2, 3); + .@n$=getarg(3, strnpcinfo(0)); // It was disarmed if (getnpctimer(0) == 0) { initnpctimer; - setnpcdisplay strnpcinfo(0), NPC_TRAP_ONLINE; + setnpcdisplay .@n$, NPC_TRAP_ONLINE; return; } // Fire!! setnpctimer 9000; - setnpcdisplay strnpcinfo(0), NPC_TRAP_TRIGGERED; + setnpcdisplay .@n$, NPC_TRAP_TRIGGERED; // Boom - Hurt players and/or stun monsters // This means you can - and SHOULD - lead Forains into these traps diff --git a/npc/015-8-1/campaign.txt b/npc/015-8-1/campaign.txt index fa3e97b9a..96a943782 100644 --- a/npc/015-8-1/campaign.txt +++ b/npc/015-8-1/campaign.txt @@ -16,6 +16,10 @@ OnBegin: .@m$=getmap(); .@in=getq2(HurnscaldQuest_Sagratha); + //debugmes "Initialized - Inst ID %d", .@in; + //debugmes "Map %s.gat - NPC Name %s", .@m$, .name$; + //debugmes "NPC UUID %s (%s)", instance_npcname(.name$), instance_npcname(.name$, .@in); + setq3 HurnscaldQuest_Sagratha, 1; // We're in an instance, ofc. Here we still have player attached. //npctalk3 l("Open your eyes!"); @@ -28,10 +32,10 @@ OnBegin: monster .@m$, 49, 45, "Real Monster", RedSlime, 1; // max AI id 4. You are in 49,39 - monster .@m$, 49, 41, "AI Tx", RedSlime, 1, instance_npcname(.name$, .@in)+"::OnError", Size_Medium, 2; - monster .@m$, 51, 41, "AI Xt", RedSlime, 1, instance_npcname(.name$, .@in)+"::OnError", Size_Medium, 2; + monster .@m$, 49, 41, "AI Tx", RedSlime, 1, instance_npcname(.name$)+"::OnError", Size_Medium, 2; + monster .@m$, 51, 41, "AI Xt", RedSlime, 1, instance_npcname(.name$)+"::OnError", Size_Medium, 2; - addtimer(5000, instance_npcname(.name$, .@in)+"::OnError"); + addtimer(5000, instance_npcname(.name$)+"::OnError"); end; // Assassin, HoodedNinja, HoodedAssassin (boss) @@ -52,13 +56,21 @@ OnInit: // Dummy NPC to fire #SaggyDungeonCore when you get close to battle scene 015-8-1,49,39,0 script #SaggyDungeonFire NPC_HIDDEN,1,0,{ end; + OnTouch: if (instance_id() < 0) end; - if (!getq3(HurnscaldQuest_Sagratha)) - doevent "#SaggyDungeonCore::OnBegin"; + if (!getq3(HurnscaldQuest_Sagratha)) { + .@in=getq2(HurnscaldQuest_Sagratha); + doevent(instance_npcname("#SaggyDungeonCore", .@in)+"::OnBegin"); + } + end; + +OnInit: + .distance=0; end; + } diff --git a/npc/015-8-1/puzzle.txt b/npc/015-8-1/puzzle.txt index 2cd158e10..f0827c2cf 100644 --- a/npc/015-8-1/puzzle.txt +++ b/npc/015-8-1/puzzle.txt @@ -32,7 +32,10 @@ OnTouch: OnTouchNPC: OnTouch: // instance_id() - SteelTrap(rand2(10, 40), 5, any(0,0,0,1)); + if (instance_id() >= 0) + SteelTrap(rand2(10, 40), 5, any(0,0,0,1), instance_npcname(.name$)); + else + SteelTrap(rand2(10, 40), 5, any(0,0,0,1)); end; OnTimer10000: -- cgit v1.2.3-60-g2f50