diff options
Diffstat (limited to 'world/map/npc/055-1')
-rw-r--r-- | world/map/npc/055-1/_import.txt | 1 | ||||
-rw-r--r-- | world/map/npc/055-1/_mobs.txt | 100 | ||||
-rw-r--r-- | world/map/npc/055-1/_nodes.txt | 16 | ||||
-rw-r--r-- | world/map/npc/055-1/pumpkins.txt | 116 |
4 files changed, 131 insertions, 102 deletions
diff --git a/world/map/npc/055-1/_import.txt b/world/map/npc/055-1/_import.txt index 10c3c13c..8760f125 100644 --- a/world/map/npc/055-1/_import.txt +++ b/world/map/npc/055-1/_import.txt @@ -2,6 +2,7 @@ // This file is generated automatically. All manually added changes will be removed when running the Converter. map: 055-1 npc: npc/055-1/_mobs.txt +npc: npc/055-1/_nodes.txt npc: npc/055-1/_warps.txt npc: npc/055-1/flowerpentagram4.txt npc: npc/055-1/mapflags.txt diff --git a/world/map/npc/055-1/_mobs.txt b/world/map/npc/055-1/_mobs.txt index 35741d32..23eba0b0 100644 --- a/world/map/npc/055-1/_mobs.txt +++ b/world/map/npc/055-1/_mobs.txt @@ -1,86 +1,20 @@ // This file is generated automatically. All manually added changes will be removed when running the Converter. // Woodland Hills mobs -055-1,68,72,22,19|monster|Butterfly|1055,16,10000ms,85000ms,Mob055-1::On1055 -055-1,87,29,55,14|monster|Silkworm|1035,15,10000ms,85000ms,Mob055-1::On1035 -055-1,79,30,84,17|monster|Squirrel|1038,10,10000ms,45000ms,Mob055-1::On1038 -055-1,0,0,0,0|monster|Mouboo|1028,15,10000ms,85000ms,Mob055-1::On1028 -055-1,91,49,6,4|monster|CloverPatch|1037,1,10000ms,180000ms,Mob055-1::On1037 -055-1,103,54,5,3|monster|CloverPatch|1037,1,10000ms,180000ms,Mob055-1::On1037 -055-1,64,75,27,16|monster|CloverPatch|1037,1,10000ms,120000ms,Mob055-1::On1037 -055-1,80,34,82,25|monster|Snail|1041,3,10000ms,85000ms,Mob055-1::On1041 -055-1,70,72,17,24|monster|AlizarinPlant|1032,2,10000ms,60000ms,Mob055-1::On1032 -055-1,81,32,81,22|monster|AlizarinPlant|1032,2,10000ms,60000ms,Mob055-1::On1032 -055-1,0,0,0,0|monster|MauvePlant|1029,7,10000ms,55000ms,Mob055-1::On1029 -055-1,0,0,0,0|monster|CobaltPlant|1030,3,10000ms,60000ms,Mob055-1::On1030 -055-1,0,0,0,0|monster|GambogePlant|1031,2,10000ms,60000ms,Mob055-1::On1031 -055-1,116,60,4,2|monster|PinkFlower|1014,1,10000ms,45000ms,Mob055-1::On1014 -055-1,97,60,4,2|monster|PinkFlower|1014,1,10000ms,45000ms,Mob055-1::On1014 -055-1,64,73,23,17|monster|PinkFlower|1014,1,10000ms,45000ms,Mob055-1::On1014 -055-1,0,0,0,0|monster|SpikyMushroom|1019,7,10000ms,60000ms,Mob055-1::On1019 - - -055-1,0,0,0|script|Mob055-1|32767 -{ - end; - -On1014: - set @mobID, 1014; - callfunc "MobPoints"; - end; - -On1019: - set @mobID, 1019; - callfunc "MobPoints"; - end; - -On1028: - set @mobID, 1028; - callfunc "MobPoints"; - end; - -On1029: - set @mobID, 1029; - callfunc "MobPoints"; - end; - -On1030: - set @mobID, 1030; - callfunc "MobPoints"; - end; - -On1031: - set @mobID, 1031; - callfunc "MobPoints"; - end; - -On1032: - set @mobID, 1032; - callfunc "MobPoints"; - end; - -On1035: - set @mobID, 1035; - callfunc "MobPoints"; - end; - -On1037: - set @mobID, 1037; - callfunc "MobPoints"; - end; - -On1038: - set @mobID, 1038; - callfunc "MobPoints"; - end; - -On1041: - set @mobID, 1041; - callfunc "MobPoints"; - end; - -On1055: - set @mobID, 1055; - callfunc "MobPoints"; - end; -} +055-1,68,72,22,19|monster|Butterfly|1055,16,10000ms,85000ms +055-1,87,29,55,14|monster|Silkworm|1035,15,10000ms,85000ms +055-1,79,30,84,17|monster|Squirrel|1038,10,10000ms,45000ms +055-1,0,0,0,0|monster|Mouboo|1028,15,10000ms,85000ms +055-1,91,49,6,4|monster|CloverPatch|1037,1,10000ms,180000ms +055-1,103,54,5,3|monster|CloverPatch|1037,1,10000ms,180000ms +055-1,64,75,27,16|monster|CloverPatch|1037,1,10000ms,120000ms +055-1,80,34,82,25|monster|Snail|1041,3,10000ms,85000ms +055-1,70,72,17,24|monster|AlizarinPlant|1032,2,10000ms,60000ms +055-1,81,32,81,22|monster|AlizarinPlant|1032,2,10000ms,60000ms +055-1,0,0,0,0|monster|MauvePlant|1029,7,10000ms,55000ms +055-1,0,0,0,0|monster|CobaltPlant|1030,3,10000ms,60000ms +055-1,0,0,0,0|monster|GambogePlant|1031,2,10000ms,60000ms +055-1,116,60,4,2|monster|PinkFlower|1014,1,10000ms,45000ms +055-1,97,60,4,2|monster|PinkFlower|1014,1,10000ms,45000ms +055-1,64,73,23,17|monster|PinkFlower|1014,1,10000ms,45000ms +055-1,0,0,0,0|monster|SpikyMushroom|1019,7,10000ms,60000ms diff --git a/world/map/npc/055-1/_nodes.txt b/world/map/npc/055-1/_nodes.txt new file mode 100644 index 00000000..e6da33ea --- /dev/null +++ b/world/map/npc/055-1/_nodes.txt @@ -0,0 +1,16 @@ +// This file is generated automatically. All manually added changes will be removed when running the Converter. +// Woodland Hills nodes + +055-1,0,0,0|script|Node055-1|32767 +{ + end; +OnInit: + setarray .m$, "_N-Pumpkin", "055-1", "055-1", "055-1"; + setarray .x1, "_N-Pumpkin", 129, 133, 41; + setarray .y1, "_N-Pumpkin", 23, 27, 22; + setarray .x2, "_N-Pumpkin", 135, 139, 47; + setarray .y2, "_N-Pumpkin", 26, 33, 30; + setarray .id, "_N-Pumpkin", 0, 0, 0; + donpcevent "_N-Pumpkin::OnMaybeStart"; + destroy; +} diff --git a/world/map/npc/055-1/pumpkins.txt b/world/map/npc/055-1/pumpkins.txt index 96931e04..64b145c8 100644 --- a/world/map/npc/055-1/pumpkins.txt +++ b/world/map/npc/055-1/pumpkins.txt @@ -1,18 +1,18 @@ -// Pumpkin mobs for the seasonal halloween event with Oscar -055-1,48,25,16,8|monster|Pumpkin|1063,12,10000ms,5000ms,PumpkinMob055-1::On1063 -055-1,139,29,5,7|monster|Pumpkin|1063,7,10000ms,5000ms,PumpkinMob055-1::On1063 -055-1,132,24,6,4|monster|Pumpkin|1063,4,10000ms,5000ms,PumpkinMob055-1::On1063 +055-1,0,0,0|script|_N-Pumpkin|32767 +{ +////////////////////////////////// +// puppet logic below -055-1,0,0,0|script|PumpkinMob055-1|32767 -{ - end; + set @distance_handler, 1; // silent + set @npc_distance, (1-2); // -1 means attack range + callfunc "PCtoNPCRange"; + if (@npc_check) end; -On1063: if (Quest_Halloween != 1 || !(gettime(6) == 11 && (gettime(5) >= 4 && gettime(5) <= 30))) goto L_HeavyPoison; if (@discover_poisonous_pumpkin == 0) - message strcharinfo(0), "Yuke, this pumpkin released some ugly poison gas!"; + message strcharinfo(0), "Pumpkin : Yuke, this pumpkin released some ugly poison gas!"; set @discover_poisonous_pumpkin, 1; misceffect FX_PUMPKIN_EXPLOSION, strcharinfo(0); heal -15, 0; @@ -25,44 +25,122 @@ On1063: set @mobID, 1063; callfunc "MobPoints"; - end; + goto L_Destroy; L_EnoughSeeds: - message strcharinfo(0), $@halloween_num_seeds + " should be enough seeds for Oscar. And this pumpkin gas gets too bad to stand it any longer..."; + message strcharinfo(0), "Pumpkin : " + $@halloween_num_seeds + " should be enough seeds for Oscar. And this pumpkin gas gets too bad to stand it any longer..."; set Quest_Halloween, 2; // Reset this to get the message for the "heavy" poison set @discover_poisonous_pumpkin, 0; - end; + goto L_Destroy; L_HeavyPoison: if (@discover_poisonous_pumpkin == 0) goto L_HeavyPoison0; if (@discover_poisonous_pumpkin == 1) goto L_HeavyPoison1; - if (@discover_poisonous_pumpkin > 1) - goto L_HeavyPoison2; - end; + goto L_HeavyPoison2; L_HeavyPoison0: set @discover_poisonous_pumpkin, @discover_poisonous_pumpkin + 1; - message strcharinfo(0), "Ouch, this pumpkin is totally poisonous! Let's get away from them!"; + message strcharinfo(0), "Pumpkin : Ouch, this pumpkin is totally poisonous! Let's get away from them!"; misceffect FX_PUMPKIN_EXPLOSION, strcharinfo(0); heal -150,0; sc_start sc_poison, 1, 60; - end; + goto L_Destroy; L_HeavyPoison1: set @discover_poisonous_pumpkin, @discover_poisonous_pumpkin + 1; - message strcharinfo(0), "This is really awful! I should not touch them!"; + message strcharinfo(0), "Pumpkin : This is really awful! I should not touch them!"; misceffect FX_PUMPKIN_EXPLOSION, strcharinfo(0); heal -350,0; sc_start sc_poison, 1, 120; - end; + goto L_Destroy; L_HeavyPoison2: set @discover_poisonous_pumpkin, @discover_poisonous_pumpkin + 1; misceffect FX_PUMPKIN_EXPLOSION, strcharinfo(0); heal -Hp, 0; + goto L_Destroy; + +OnAppear: + fakenpcname strnpcinfo(0), strnpcinfo(0), 1063; // switch npc id to 1063 end; +L_Destroy: + set .nodes[.i], get(.nodes[.i], "_N-Pumpkin") - 1, "_N-Pumpkin"; // tell the puppeteer we lost an egg + destroy; + + +////////////////////////////////// +// puppeteer logic below + +S_MakeNode: + set .nID, .nID + 1; // give the node an id + set .@name$, "#_Pkin" + chr(3) + .nID; + goto S_FindXY; + +S_FindXY: + set .@x, rand(.x1[.i], .x2[.i]); + set .@y, rand(.y1[.i], .y2[.i]); + if (iscollision(.m$[.i], .@x, .@y) == 1) + goto S_FindXY; + goto S_ReallySpawn; + +S_ReallySpawn: + set .@p, puppet(.m$[.i], .@x, .@y, .@name$, 32767); // spawn the node + 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 + 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 + return; + +S_IterateObjects: + if (.min_nodes[.i] == 0) + set .min_nodes[.i], (.min * min(1, ((.x2[.i] - .x1[.i]) * (.y2[.i] - .y1[.i])) / .divisor)); + if (.max_nodes[.i] == 0) + set .max_nodes[.i], (.max * max(1, ((.x2[.i] - .x1[.i]) * (.y2[.i] - .y1[.i])) / .divisor)); + + if (.nodes[.i] >= .max_nodes[.i]) + goto S_NextObject; + + set .nodes[.i], .nodes[.i] + 1; + callsub S_MakeNode; + if (.nodes[.i] < if_then_else(.done_initial[.i], .min_nodes[.i], .max_nodes[.i])) + goto S_IterateObjects; + goto S_NextObject; + +S_NextObject: + set .done_initial[.i], 1; + if (.i >= (.count - 1)) + goto S_Return; + set .i, .i + 1; // object iterator++ + goto S_IterateObjects; + +S_Return: + return; + +OnHeartbeat: + set .i, 1; // object iterator + freeloop 1; + callsub S_IterateObjects; + freeloop 0; + addnpctimer .spawn_t, strnpcinfo(0) + "::OnHeartbeat"; // heartbeat + end; + +OnMaybeStart: + if (.x1[1] == 0) + end; + set .min, 0; // relative min number of nodes per object => (min * (((x2 - x1) * (y2 - y1)) / divisor)) + set .max, 5; // relative max number of nodes per object => (max * (((x2 - x1) * (y2 - y1)) / divisor)) + 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 + if (.started) + end; + set .started, 1; + addnpctimer 10000, strnpcinfo(0)+"::OnHeartbeat"; // first heartbeat + end; } |