summaryrefslogtreecommitdiff
path: root/world/map/npc/033-1/kimarr.txt
diff options
context:
space:
mode:
Diffstat (limited to 'world/map/npc/033-1/kimarr.txt')
-rw-r--r--world/map/npc/033-1/kimarr.txt217
1 files changed, 217 insertions, 0 deletions
diff --git a/world/map/npc/033-1/kimarr.txt b/world/map/npc/033-1/kimarr.txt
new file mode 100644
index 00000000..7cdac533
--- /dev/null
+++ b/world/map/npc/033-1/kimarr.txt
@@ -0,0 +1,217 @@
+033-1.gat,74,32,0 script Kimarr 218, {
+
+ set @Q_Barbarians_MASK, NIBBLE_0_MASK;
+ set @Q_Barbarians_SHIFT, NIBBLE_0_SHIFT;
+
+ set @state, ((QUEST_Barbarians & @Q_Barbarians_MASK) >> @Q_Barbarians_SHIFT);
+
+ if (@state >= 3) goto L_Again;
+ if (@state == 2) goto L_Reward;
+ if (@state == 1) goto L_Ask;
+
+ mes "[Barbarian]";
+ mes "\"Greetings, little person.\"";
+ next;
+ mes "\"I am Kimarr, hunter and warrior of the Mangarr.\"";
+ next;
+ mes "\"You are very small, better be careful in this snowy mountains. It is cold and dangerous monsters are here.\"";
+ menu
+ "Hello, my name is " + strcharinfo(0) + " and I'm not small. I'm a great warrior!",-,
+ "I'm " + strcharinfo(0) + ", don't underestimate me. I'm an experienced adventurer!" ,-,
+ "I'm the legendary " + strcharinfo(0) + ", I've fought countless battles.",-;
+
+ mes "Kimarr seems to be amused.";
+ mes "[Kimarr]";
+ mes "\"Really? Do you want to prove it?\"";
+ menu
+ "Sure! What shall I do?", L_Explain,
+ "No, I don't need to prove anything.",L_Close;
+
+L_Explain:
+ mes "[Kimarr]";
+ mes "\"Every young member of our tribe proves his or her worth by hunting monsters.\"";
+ next;
+ mes "\"The first monsters to hunt are fluffies. Fluffies give a good meal for a young person and the fur can be used to make clothes and blankets.\"";
+ next;
+ callsub S_Explain_Game;
+
+ set @state, 1;
+ callsub S_Update_Mask;
+L_Ask:
+ mes "[Kimarr]";
+ mes "\"So, are you going to try?\"";
+ menu
+ "Yeah, let's start",L_Game,
+ "Could you explain again?",-,
+ "Maybe later.",L_Close;
+
+ callsub S_Explain_Game;
+ goto L_Ask;
+
+S_Explain_Game:
+ mes "[Kimarr]";
+ mes "\"In that cave there are living fluffies. They like to eat apples.\"";
+ next;
+ mes "\"I also saw one of them getting excited about one of that sweet things you call 'cake'.\"";
+ next;
+ mes "\"You should be careful, other monsters living here might like the food as well\"";
+ next;
+ mes "\"Go to the cave entrance and throw food on the floor to make them come out.\"";
+ next;
+ mes "\"Then hunt as many fluffies as you can until I tell you to stop.\"";
+ next;
+ mes "\"Drop more food when no fluffies are left.\"";
+ return;
+
+L_Reward:
+ mes "[Kimarr]";
+ mes "\"That was very impressing - now you can call yourself hunter " + strcharinfo(0) +".\"";
+ next;
+ getinventorylist;
+ if (@inventorylist_count == 100) goto L_Full_Inv;
+ mes "\"Take this as a symbol of your strength. You're a member of our tribe now.\"";
+ getitem "YetiSkinShirt", 1;
+ set @state, 3;
+ callsub S_Update_Mask;
+ close;
+
+L_Again:
+ mes "[Kimarr]";
+ mes "\"Does hunter " + strcharinfo(0) + " want to hunt some fluffies again?\"";
+ menu
+ "Yeah!",L_Game,
+ "Can you tell me who were the most successfull fluffy hunters?",-,
+ "Not now.",L_Close;
+ //TODO: give list of best hunters
+ close;
+
+L_Full_Inv:
+ mes "[Kimarr]";
+ mes "\"You are carrying a lot of things. I will give something to you when you have room for it.\"";
+ close;
+
+L_Close:
+ close;
+
+L_Game:
+//REMOVE
+goto L_Reward;
+ if ($@FLUFFY_HUNTING) goto L_Someone_Else;
+ set $@FLUFFY_HUNTING, 1;
+ set $@FLUFFY_COUNTER, 0;
+ set $@FLUFFY_TIME, 0;
+ set $@FLUFFY_LVL, baselevel;
+//TODO: set minimum number of killed fluffies (maybe based on level?)
+ set $@FLUFFY_MIN, 10;
+ warp "033-1.gat", 79, 34;
+ startnpctimer;
+ goto L_Close;
+
+L_Someone_Else:
+ mes "[Kimarr]";
+ mes "\"At the moment someone else is hunting. Let's wait until that hunting has ended.\"";
+ close;
+
+OnTimer1000:
+ setnpctimer 0;
+ if ($@FLUFFY_HUNTING != 0) goto L_Hunting;
+
+L_Hunting:
+ set $@FLUFFY_TIME, $@FLUFFY_TIME + 1;
+ if ($@FLUFFY_TIME > 300) goto L_CleanUp;
+ //TODO: monsterID angry fluffy
+ if (getareausers("033-1.gat", 79, 29, 88, 42) == 0) goto L_CleanUp;
+
+ set $@FLUFFY_REDAPPLES, getareadropitem("033-1.gat", 79, 29, 88, 42, 535, 1);
+ set $@FLUFFY_XMASCAKE, getareadropitem("033-1.gat", 79, 29, 88, 42, 508, 1);
+ set $@FLUFFY_CAKE, getareadropitem("033-1.gat", 79, 29, 88, 42, 513, 1);
+ set $@FLUFFY_GREENAPPLE, getareadropitem("033-1.gat", 79, 29, 88, 42, 719, 1);
+
+//TODO: balance the spawns and maybe add the new monster
+ set $@FLUFFY_SPAWN, $@FLUFFY_REDAPPLES + 5 * $@FLUFFY_XMASCAKE + 3 * $@FLUFFY_CAKE + $@FLUFFY_GREENAPPLE;
+
+//TODO: remove debug messages
+ if ($@FLUFFY_TIME % 10 == 0)
+ mapannounce "033-1.gat", "$@FLUFFY_TIME " + $@FLUFFY_TIME, 0;
+ if ($@FLUFFY_TIME % 10 == 0)
+ mapannounce "033-1.gat", "$@FLUFFY_COUNTER " + $@FLUFFY_COUNTER, 0;
+ areamonster "033-1.gat", 79, 29, 88, 42, "", 1020, $@FLUFFY_SPAWN, "Kimarr::onFluffyDeath";
+ if (($@FLUFFY_SPAWN > 0) && ($@FLUFFY_LVL > 40) && (rand(5 * $@FLUFFY_XMASCAKE + 3 * $@FLUFFY_CAKE + 10 * $@FLUFFY_LVL) > 500)) // Ice Goblin
+ areamonster "033-1.gat", 79, 29, 88, 42, "", 1058, 1, "Kimarr::onPetDeath";
+ if (($@FLUFFY_SPAWN > 0) && ($@FLUFFY_LVL > 60) && (rand(5 * $@FLUFFY_XMASCAKE + 3 * $@FLUFFY_CAKE + 10 * $@FLUFFY_LVL) > 550)) // Santa Slime
+ areamonster "033-1.gat", 79, 29, 88, 42, "", 1015, 1, "Kimarr::onPetDeath";
+ if (($@FLUFFY_SPAWN > 0) && ($@FLUFFY_LVL > 70) && (rand(5 * $@FLUFFY_XMASCAKE + 3 * $@FLUFFY_CAKE + 10 * $@FLUFFY_LVL) > 600)) // Yeti
+ areamonster "033-1.gat", 79, 29, 88, 42, "", 1072, 1, "Kimarr::onPetDeath";
+ set $@FLUFFY_REDAPPLES, 0;
+ set $@FLUFFY_XMASCAKE , 0;
+ set $@FLUFFY_CAKE, 0;
+ set $@FLUFFY_GREENAPPLE, 0;
+ end;
+//onInit:
+// initnpctimer;
+// stopnpctimer;
+
+onFluffyDeath:
+ set $@FLUFFY_COUNTER, $@FLUFFY_COUNTER + 1;
+ mapannounce "033-1.gat", "fluffies killed: " + $@FLUFFY_COUNTER, 0;
+ end;
+
+L_CleanUp:
+ areatimer "033-1.gat", 79, 29, 88, 42, 10, "Kimarr::onReward";
+ set $@FLUFFY_HUNTING, 0;
+ mapannounce "033-1.gat", "You killed " + $@FLUFFY_COUNTER + "Fluffies", 0;
+ set $@FLUFFY_COUNTER, 0;
+ //TODO: save amount of killed fluffies in playervariable (hunting redoable, npc tells the best result)
+ set $@FLUFFY_TIME, 0;
+//TODO: check if that command really only kills the event monsters
+ killmonster "033-1.gat", "All";
+ stopnpctimer;
+ setnpctimer 0;
+ mapannounce "033-1.gat", "clean up", 0;
+ end;
+
+onReward:
+ //TODO: add check for new record
+ warp "033-1.gat", 77, 34;
+ set @place, -1;
+//TODO: prevent that one player can be in that list more than once
+ if ($FLUFFYGAME_PTS[8] < $@FLUFFY_COUNTER) set @place,8;
+ if ($FLUFFYGAME_PTS[7] < $@FLUFFY_COUNTER) set @place,7;
+ if ($FLUFFYGAME_PTS[6] < $@FLUFFY_COUNTER) set @place,6;
+ if ($FLUFFYGAME_PTS[5] < $@FLUFFY_COUNTER) set @place,5;
+ if ($FLUFFYGAME_PTS[4] < $@FLUFFY_COUNTER) set @place,4;
+ if ($FLUFFYGAME_PTS[3] < $@FLUFFY_COUNTER) set @place,3;
+ if ($FLUFFYGAME_PTS[2] < $@FLUFFY_COUNTER) set @place,2;
+ if ($FLUFFYGAME_PTS[1] < $@FLUFFY_COUNTER) set @place,1;
+ if ($FLUFFYGAME_PTS[0] < $@FLUFFY_COUNTER) set @place,0;
+ if (@place != -1) callsub MOVE_NAME;
+
+ if (@state > 1) goto L_Skip;
+ if ($@FLUFFY_COUNTER < $@FLUFFY_MIN) goto L_Skip;
+ set @state, 2;
+ callsub S_Update_Mask;
+L_Skip:
+ end;
+//////
+
+S_MOVE_NAME:
+ set @i,9;
+
+MOVE_NAME_L1:
+ set @i, @i-1;
+ set $FLUFFYGAME_PTS[@i+1], $FLUFFYGAME_PTS[@i];
+ set $FLUFFYGAME_PTS[@i+1], $FLUFFYGAME_PTS[@i];
+ if (@i == @place) goto MOVE_NAME_L2;
+ goto MOVE_NAME_L1;
+
+MOVE_NAME_L2:
+ set $FLUFFYGAME_PTS[@place], $@FLUFFY_COUNTER;
+ set $FLUFFYGAME_NAME[@place], strcharinfo(0);
+ return;
+
+S_Update_Mask:
+ set QUEST_Barbarians,
+ (QUEST_Barbarians & ~(@Q_Barbarians_MASK))
+ | (@state << @Q_Barbarians_SHIFT);
+ return;
+}