// TMW-2 Script // Author: // Jesusalva // Description: // Homunculus Evolution System 031-6,75,64,0 script Siegfried NPC_RED_OFFICER,{ function attributeText; function attributeTime; mesn; mesq l("My name is Siegfried. Welcome to my humble abode."); if ($GAME_STORYLINE >= 4 && HEC_GetTier() == 1) goto L_Main; if ($GAME_STORYLINE >= 5 && HEC_GetTier() == 2) goto L_Main; // Not unlocked by game storyline mesq l("In future I'll have something to discuss with you, but today is not the day."); close; L_Main: next; mesn; // Not summoned if (!gethominfo(0)) { mesq l("I used to take care of Homunculus a few centuries ago, before it became lost knowledge. A pity that my knowledge is no longer useful to anyone."); close; } // Sleeping if (homstatus()) { mesq l("To be honest, I wouldn't believe anyone claiming to have a homunculus if I don't see for my own eyes. Homunculus creation is, after all, lost knowledge."); close; } // Active mesq l("Oh, what lovely Lv %d %s Homunculus you have here!", gethominfo(6), HEC_GetCName()); if (!gethominfo(5)) mesq l("I don't suppose it have a name yet?"); else mesq l("...\"%s\", hm? That's a fine name for a Homunculus, in my not so humble opinion.", gethominfo(2)); next; .@type = gethominfo(1); .@loya = gethominfo(3) / 100; .@next = HEC_GetTier() * 50; mesn; // Loyalty not yet earned if (.@loya < 900) { mesq l("When it reaches over 900 intimacy, it'll unlock better skills and bonuses to you. Let me know when this happen."); close; // Level not yet reached } else if (gethominfo(6) <= .@next) { mesq l("Once it reaches level %d who knows, something nice might happen.", .@next + 1); close; // No evolution available (yet) } else if (HEC_SimpleEvolve() < 1) { mesq l("And it's so loyal to you... Maybe you should consider requesting the evolution feature soon."); close; // All conditions met } else { mesq l("And it's so loyal to you... You probably could evolve it."); } goto L_Evolution; L_Evolution: next; if (!.@next) end; mesn; mesq l("Now, you have a Tier %d homunculi. The highest the tier, the more difficult to evolve it is. For a simple Tier 2 evolution I can do it myself, whereas a Tier 3 evolution requires an Embryo.", HEC_GetTier()); next; mesn; mesq l("Evolving your Homunculus will drain 900 points of intimacy and %d levels. Homunculus are slightly weak right after evolving, but some healthy exercise will put them in form in no time.", .@next); mesc l("In theory, I could also change it to another type without losing any levels, but I ran out of %s.", b(l("Jesusalva's Magic Debug Powder"))); next; switch (HEC_GetTier()) { case 1: mesn; mesq l("For Tier 2 Evolution, I'll need %s GP, %d %s, a %s and a %s.", 5000, 10, getitemlink(FluoPowder), getitemlink(Trout), getitemlink(Tench)); if (Zeny < 5000) close; if (countitem(FluoPowder) < 10) close; if (!countitem(Trout)) close; if (!countitem(Tench)) close; next; mesc l("Evolve your Homunculus? This is irreversible!"), 1; mesc l("Class after evolution: %s", HEC_GetCName(HEC_SimpleEvolve())); if (askyesnosafe("Yes", "No", "Never") != ASK_YES) { closeclientdialog; close; } // Initiate the Riddle, consume the GP and Intimacy first // Only drain 899 units to give you a "grace" period for the puzzle. Zeny -= 5000; atcommand("@homfriendly "+(gethominfo(3)/100-899)); mesn; mesq l("Alright, for such simple evolution I can do it myself. It'll evolve to a %s Type Homunculus.", b(HEC_GetCName(HEC_SimpleEvolve()))); next; mesn; mesq l("But you'll still need to help me! The homunculus evolve when four aspects evolve: They are %s, %s, %s and %s.", l("%%A Existence"), l("%%D Rationality"), l("%%F Emotionality"), l("%%? Inexistence")); next; mesn; mesq l("I can only evolve two aspects at once. Whenever an aspect evolves, I need to sacrifice an aspect, so to start the process, I'll use the fish to bootstrap a null aspect."); // For tier 3, fish wouldn't be enough. next; mesn; mesq l("Once I finish evolving the two aspects, you'll be able to decide which aspect you'll downgrade to resume the evolution process. However, you only have %s time units to evolve the four aspects!", b("200")); next; mesn; mesq l("If you can't evolve the four aspects in the alloted time, I'll revert the evolution, but all your money and the Homunculus Intimacy will be consumed. So worth noting that if the intimacy drops to zero, it dies."); next; mesn; mesq l("Ready? Let's begin."); .@time=0; .@attr=0; goto L_Evol2Puzzle; default: mesn; mesq l("I don't know how to evolve your homunculus."); } close; L_Evol2Puzzle: // INHERITED: .@time / .@attr clear; mesc l("Time spent: %d/%d", .@time, 200); mes ""; mesc l("Evolved attributes: %s", attributeText(.@attr)); mes ""; mes l("Evolution time:"); mesc ("%%A 10"); mesc ("%%D 20"); mesc ("%%F 90"); mesc ("%%? 120"); // Reset the buffers .@tf=0; .@fa=.@attr; // tf = time buffer; fa = final attribute mes ""; mes l("Which attribute do you wish to evolve first?"); menuint // TODO FIXME: Need menuimage because emotes doesn't work...? WTF? rif(!(.@fa & 1), l("%%A Existence")), 1, rif(!(.@fa & 2), l("%%D Rationality")), 2, rif(!(.@fa & 4), l("%%F Emotionality")), 4, rif(!(.@fa & 8), l("%%? Inexistence")), 8; mes ""; .@fa = .@fa | @menuret; .@tf = max(.@tf, attributeTime(@menuret)); mes ""; mes l("Which attribute do you wish to evolve next?"); menuint rif(!(.@fa & 1), l("%%A Existence")), 1, rif(!(.@fa & 2), l("%%D Rationality")), 2, rif(!(.@fa & 4), l("%%F Emotionality")), 4, rif(!(.@fa & 8), l("%%? Inexistence")), 8, l("None"), 0; mes ""; .@fa = .@fa | @menuret; .@tf = max(.@tf, attributeTime(@menuret)); // Apply the time change .@time += .@tf; .@tf = 0; mes b(l("Time spent: %d/%d", .@time, 200)); // You finished if (.@fa == 15) goto L_Evol2Finish; // Update the display with the temporary data in the making clear; mesc l("Time spent: %d/%d", .@time, 200); mes ""; mesc l("Evolved attributes: %s", attributeText(.@fa)); mes ""; mes l("Evolution time:"); mesc ("%%A 10"); mesc ("%%D 20"); mesc ("%%F 90"); mesc ("%%? 120"); // Revert one attribute mes ""; mesc l("Which attribute do you wish to downgrade?"), 1; menuint rif((.@fa & 1), l("%%A Existence")), 1, rif((.@fa & 2), l("%%D Rationality")), 2, rif((.@fa & 4), l("%%F Emotionality")), 4, rif((.@fa & 8), l("%%? Inexistence")), 8; .@fa = .@fa ^ @menuret; .@attr = .@fa; .@time += attributeTime(@menuret); // Continue the cycle goto L_Evol2Puzzle; L_Evol2Finish: // Validate if you really won if (.@time < 120 || .@time > 200) goto L_Evol2Fail; if (gethominfo(6) <= .@next) goto L_Evol2Fail; if (.@next < 1) Exception("Illegal value for level cost", RB_SPEECH|RB_DEBUGMES|RB_PLEASEREPORT|RB_ISFATAL); // Consume the materials delitem Trout, 1; delitem Tench, 1; delitem FluoPowder, 10; // Perform the Evolution .@evol = sethomunclass(HEC_SimpleEvolve()); if (.@evol) Exception(sprintf("Illegal Homunculus Evolution performed, error %d for type %d.", .@evol, HEC_SimpleEvolve()), RB_IRCBROADCAST|RB_SPEECH|RB_DEBUGMES|RB_PLEASEREPORT|RB_ISFATAL); // Reset the Homunculus level .@level = gethominfo(6) - .@next; sethomunlevel(.@level); // Update player display atcommand("@refresh"); atcommand("@hominfo"); // Finale clear; mesn; mesq l("Congratulations! Your homunculus has just evolved."); close; L_Evol2Fail: clear; mesc l(".:: Failure ::."), 1; mesc l("You took too long."), 1; debugmes "Spent %d time units", .@time; close; function attributeText { .@a$=""; .@a=getarg(0); if (.@a & 1) .@a$+=l("%%A Existence"); .@a$+=" "; if (.@a & 2) .@a$+=l("%%D Rationality"); .@a$+=" "; if (.@a & 4) .@a$+=l("%%F Emotionality"); .@a$+=" "; if (.@a & 8) .@a$+=l("%%? Inexistence"); return .@a$; } function attributeTime { switch (getarg(0)) { case 0: return 0; case 1: return 10; case 2: return 20; case 4: return 90; case 8: return 120; default: Exception("Invalid attribute selected"); return 9999; } } OnInit: .sex = G_MALE; .distance = 5; end; }