diff options
author | mekolat <mekolat@users.noreply.github.com> | 2016-04-13 14:30:57 -0400 |
---|---|---|
committer | mekolat <mekolat@users.noreply.github.com> | 2016-04-15 10:30:14 -0400 |
commit | c935422ac345e341724e2c543ff9b86b84ca591f (patch) | |
tree | 837ad63c8ad8f1c875efaeef0e5d8e42a7be3a57 | |
parent | dc9c6ac482b353fe9a4b1e1628f691c487a517fc (diff) | |
download | serverdata-c935422ac345e341724e2c543ff9b86b84ca591f.tar.gz serverdata-c935422ac345e341724e2c543ff9b86b84ca591f.tar.bz2 serverdata-c935422ac345e341724e2c543ff9b86b84ca591f.tar.xz serverdata-c935422ac345e341724e2c543ff9b86b84ca591f.zip |
add despawn timer to pumpkins
-rw-r--r-- | world/map/npc/055-1/pumpkins.txt | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/world/map/npc/055-1/pumpkins.txt b/world/map/npc/055-1/pumpkins.txt index eff97b2e..1c2535f7 100644 --- a/world/map/npc/055-1/pumpkins.txt +++ b/world/map/npc/055-1/pumpkins.txt @@ -64,10 +64,15 @@ L_HeavyPoison2: goto L_Destroy; OnAppear: - fakenpcname strnpcinfo(0), strnpcinfo(0), 1063; // switch npc id to 1063 + fakenpcname strnpcinfo(0), strnpcinfo(0), 1063; // set the sprite (implies enablenpc) end; L_Destroy: + disablenpc strnpcinfo(0); // makes the npc invisible, unclickable + addnpctimer .death_t, strnpcinfo(0) + "::OnReallyDestroy"; // schedule a respawn + end; + +OnReallyDestroy: set .nodes[.i], get(.nodes[.i], "_N-Pumpkin") - 1, "_N-Pumpkin"; // tell the puppeteer we lost an egg destroy; @@ -88,9 +93,11 @@ S_FindXY: goto S_ReallySpawn; S_ReallySpawn: - set .@p, puppet(.m$[.i], .@x, .@y, .@name$, 32767); // spawn the node + set .@p, puppet(.m$[.i], .@x, .@y, .@name$, 32767); // spawn the node (but not on map, because 32767) + disablenpc .@name$; // make sure it can't be clicked by guessing the being id set .i, .i, .@p; // tell the puppet what object contains it - set .@timer, if_then_else(.done_initial[.i], rand(.death_t/2, .death_t), 0); // timer depends on if first spawn or if respawned after death + set .death_t, rand(.death_t/2, .death_t), .@p; // tell the puppet when to die + set .@timer, if_then_else(.done_initial[.i], rand(.appear_t/2, .appear_t), 0); // timer depends on if first spawn or if respawned after death addnpctimer .@timer, .@name$+"::OnAppear"; // we spawn the node instantly but it only appears after the timer if (.nID == 2147483647) set .nID, 0; // start over if id = 0x7FFFFFFF @@ -137,7 +144,8 @@ OnMaybeStart: set .divisor, 32; // see .min & .max ^ set .count, getarraysize(.x1); // number of nodes objects in TSX set .spawn_t, 18000; // heartbeat rate - set .death_t, 40000; // rand(timer/2, timer) before a node appears + set .death_t, 1000; // rand(timer/2, timer) before a node triggers respawn after death + set .appear_t, 40000; // rand(timer/2, timer) before a node becomes visible after spawn if (.started) end; set .started, 1; |