Jump to content

Z3R0

Members
  • Posts

    615
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Z3R0

  1. What map? How do the players get to the map? If it's viper only then check onpcloadmapevent... then run a loop timer on players that have entered that map and check their status... if expire warp out.
  2. Nevermind. Was looking at the wrong one
  3. sure it's a way to set an array with an unknown array size... when any variable doesn't exist it's value is 0... so getarraysize(.@notset) == 0.... on first iteration... after you set something to it it's array size becomes 1... then 2... then 3... and thus making the array .@notset[0], .@notset[1] .@notset[2] because getarraysize() gives you the TOTAL number of items in teh array... and since arrays start at 0, and when it's first used it doesn't have a size, it creates a proper array...
  4. All you really need is the aid... // don't know if party array clears so I clear it anyways deletearray($@partymemberaid[0], getarraysize($@partymemberaid)); getpartymember(getchardid(1), 2); // type 2 gives u aid... // Immediately copy this array because it's global and can be overwritten copyarray( .@newarray, $@partymemberaid[0], getarraysize($@partymemberaid)); // you don't need $@party member count because getarraysize(.@newarray) will be the same value... // u can attach script to each member looping from 0 to size of newarray // attachrid( .@newarray[.@index] ); Once the script is attached to each player, you can use Class just as you would if they were talking g to the npc... Then store that info into an array set( .classes[getarraysize(.classes)], Class); *** note sorry this isn't in code box... I couldn't find the option via mobile browsing ***
  5. Ah there we go thanks @crazyarashi nice call...
  6. If it's called booking I couldn't find it in the src... for any script command to open that window
  7. That's because instance_mapname () needs two parameters unless it's within the instance itself... which this npc is not... So... Instance_mapname ("instance", @instance_id) assuming the player has it stored on them... should work Both instance_mapname () need to have ID because this event is not attached to the instance itself
  8. Following because I am working with instances right now and will need this
  9. Would have to see what you are actually trying to do then?
  10. right another reason might be, it's easier to store everything as a string because it's always readable, and then only return items as INT if you need to use them as INT... for instance... // Set Character Name / Level setarray(.@var$[0], "Z3R0", "100"); set(.@var$[1], ( atoi(.@var$[1]) + 100 ) + ""); // Here we have taken the numeric value of "100" as 100, added 100, and then converted it back // to string... this keeps all our variables on 1 array, but let's us use them as either STRING or INTEGER :D
  11. Couple of things that jumped out right off the bat... RDMOPT_VAR_AGIAMOUNT = 4 RMDOPT_VAR_MAXHPPERCENT = 1 ... so you are going backwards in your RAND( 4, 1 ) instead of RAND( 1, 4 ) RDMOPT_VAR_SPACCELERATION 12 RDMOPT_VAR_PLUSASPD 15 So rand(12,15) is correct and luck amount is by itself so that is ok... Next, you are giving 3 attributes (X, Y, and luck) however in your options array, you are passing 4 values... so that needs to change to 3... I couldn't figure out what Param Option does, as all random items didn't see to have something for that...
  12. For simplicity without changing a bunch of the script... under the OnComplete: section... change set(quizzer, quizzer^8); to set(quizzer, 0); That should reset the variable and let them do the quiz again (zeny cost and everything)
  13. Why would u want it multiple times? Once they do it right they shouldn't choose a different one? You want it to be repeatable?
  14. Maybe that's the issue..m normal npc timeout in older clients
  15. I see no reason why the menu would disappear without the user doing any actions
  16. ugh, who still uses menu() lol I don't see any close; there, and there is only end; but it's after menu calls... so I don't see why the menu would disappear without the player selecting anything.
  17. That's because those are the wrong constants... 4359,B_Eremes_Card,Assassin Cross Card,6,20,,10,,,,,,,,2,,,,,{ if(Class != JOB_PALADIN && Class != JOB_CHAMPION ) { bonus3 bAutoSpell,378,3,30; }},{},{}
  18. Z3R0

    help code

    Under slot function set .@s$,getitemname(getarg(0)); modify to... set .@s$, "<ITEM>"+getitemname(getarg(0))+"<INFO>"+getatg(0)+"</INFO></ITEM>"; enjoy
  19. o.o @Emistry if the monster is the attachedrid; then you could in fact utilize the warp command on a monster?
  20. Little rough, I'm tired... but it works enjoy //===== Script ========================================================================= //= Quizzer //===== Made by: ======================================================================= //= Z3R0 //===== Current Version: =============================================================== //= Version: 1.0 //===== Description: =================================================================== //= rAthena Script Request //= https://rathena.org/board/topic/112260-quest-npc-w-question-answer //===== Additional Comments: =========================================================== //= version 1.0: Initial Attempt //====================================================================================== prontera,158,173,4 script Quizzer 92,{ doevent "quizzer_core::OnClick"; } - script quizzer_core -1,{ // Function Declarations function MesItem; function ChkItem; function ChkAnswer; OnInit: // --------------------------------- // Configurable Settings // --------------------------------- // NPC Name to Display set(.npc$, "[Quizzer]"); // Fee to Pay to Begin Quiz set(.fee, 5000000); // Show # of Question Player is On and Total number of questions? set(.ShowQuestionProgress, 1); // Number of Answers to Pass Quiz set(.NumRightToPass, 8); // Required Items Array (Pair: Item_ID, Item_Amount) setarray(.required_items[0], 2256, 5); // Here you can setup multiple items in pairs.. (item_id, amount) // Array of Questions (Each question must have a corresponding answer) setarray(.questions$[0], "What is the special source of energy used by ninjas ?", "What is the name of the special eye of the Uchiha clan ?", "What is the name of the secret village of the country of Fire ?", "What is the prefered jutsu of Naruto ?", "How many villages are there in total ?", "What is the name of the 'star looking' weapon of the ninjas ?", "What is the name of the ultimate warrior/ninja in a particular village ?", "What is the name of Kiba's dog ?", "Who is the master of Naruto, Sasuke and Sakura ?", "What is the name of the nine-tailed demon fox ?" ); // Array of Answers (Each Answer must have a corresponding Question) setarray(.answers$[0], "Chakra", "Sharingan", "Konoha", "Kage bunshin no jutsu", "10", "Shuriken", "Kage", "Akamaru", "Kakashi", "Kurama" ); // Array of Reward Item ID's setarray(.rewards[0], 501, 502, 503, 504, 505, 506); setarray(.rewards_effects$[0], "+10 STR HP", "+10 AGI HP", "+10 INT HP", "+10 LUK HP", "+10 VIT HP", "+10 DEX HP"); // STOP!!! DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING!!!! // check .ShowQuestionProgress if (.ShowQuestionProgress > 1) set(.ShowQuestionProgress, 1); // Check .required_items if (getarraysize(.required_items) % 2 != 0) { set(.error, 1); announce(strnpcinfo(0) + ": [ERROR] Invalid Number of Items in .required_items", bc_all, C_YELLOW); end(); } if (getarraysize(.questions$) != getarraysize(.answers$)) { set(.error, 1); announce(strnpcinfo(0) + ": [ERROR] Invalid Number of Questions to Answers", bc_all, C_YELLOW); end(); } if (getarraysize(.rewards) != getarraysize(.rewards_effects$)) { set(.error, 1); announce(strnpcinfo(0) + ": [ERROR] Invalid Number of Rewards to Reward Effects", bc_all, C_YELLOW); end(); } set(.error, 0); end(); // Player clicks the initial NPC OnClick: if (.error) { mes("There was an error loading this script. Please contact your server administrator"); close(); } if (quizzer & 8) { mes("You have already completed this trial."); close(); } else if (quizzer & 4) doevent("quizzer_core::OnComplete"); else if (quizzer & 2) doevent("quizzer_core::OnQuiz"); else if (quizzer & 1) doevent("quizzer_core::OnHunt"); else doevent("quizzer_core::OnStart"); end(); OnStart: mes(.npc$); if (.fee) { mes("You will need " + .fee + " zeny to start this trial."); mes("Are you ready to proceed?"); next(); switch(select("Yes:No")) { case 1: if (Zeny < .fee) { mes("You do not have enough zeny to start this trial."); close(); } set(Zeny, Zeny - .fee); set(quizzer, 1); mes("I need you to gather these items:"); for(.@i = 0; .@i < getarraysize(.required_items); .@i+=2) { mes( MesItem(.required_items, .@i) ); } mes("I await your return"); close(); case 2: default: mes("I knew you weren't capable!"); close(); } } OnHunt: mes(.npc$); // Determine if they have completed all the required items... mes("Checking Requirement Status:"); for(.@i = 0; .@i < getarraysize(.required_items); .@i+=2) { mes(MesItem(.required_items, .@i) + " - " + ChkItem(.required_items[.@i], .required_items[.@i+1])); } if (@quizzer_no_items == 1) { mes("You do not have enough items... You fail!"); set(@quizzer_no_items, 0); close(); } // Passed let's remove the items for(.@i = 0; .@i < getarraysize(.required_items); .@i+=2) { delitem .required_items[.@i], .required_items[.@i+1]; } mes("Success! You may now start the quiz!"); next(); set(quizzer, quizzer^2); doevent("quizzer_core::OnQuiz"); end(); OnQuiz: mes(.npc$); .@num_right = 0; for(.@i = 0; .@i < getarraysize(.questions$); .@i++) { if (.ShowQuestionProgress) { mes("Question #" + (.@i+1) + " / " + getarraysize(.questions$)); } mes(.questions$[.@i]); input .player_answers$[.@i]; // Let's compare the answer :D .@num_right += ChkAnswer(.answers$[.@i], .player_answers$[.@i]); mes("Answer Recorded. Next Question"); next(); } if (.@num_right >= .NumRightToPass) { set(quizzer, quizzer^4); mes("You have passed the quiz!"); next(); doevent("quizzer_core::OnComplete"); end(); } mes("You did not pass the quiz!"); close(); OnComplete: mes(.npc$); mes("Well Done Old Chap!"); mes("Please select from the following rewards"); set(.@menu$, ""); for(.@i = 0; .@i < getarraysize(.rewards); .@i++) { set(.@menu$, .@menu$ + getitemname(.rewards[.@i]) + " (" + .rewards_effects$[.@i] + "):"); } getitem .rewards[select(.@menu$) - 1], 1; set(quizzer, quizzer^8); mes("Thank you for participating"); close(); // getarg(0) = Array // getarg(1) = Index function MesItem { .@item_id = getelementofarray(getarg(0), getarg(1)); .@item_amount = getelementofarray(getarg(0), getarg(1) + 1); return .@item_amount + ( .@item_amount > 1 ? "x" : "") + " " + getitemname(.@item_id); } // getarg(0) = item_id // getarg(1) = amount required function ChkItem { .@has = countitem(getarg(0)); if (.@has >= getarg(1)) { return "^000000" + .@has + "^000000/^000000" + getarg(1) + "^000000"; } set(@quizzer_no_items, 1); return "^FF0000" + .@has + "^000000/^000000" + getarg(1) + "^000000"; } // getarg(0) = Answer // getarg(1) = Player Answer function ChkAnswer { if (getarg(0) == getarg(1)) return 1; else if (strtoupper(getarg(0)) == getarg(1)) return 1; else if (strtolower(getarg(0)) == getarg(1)) return 1; else return 0; } }
  21. I wanna take on this challenge tonight possibly. So we will see who wins haha
  22. similar to what Crazy said, just a little optimized 4359,B_Eremes_Card,Assassin Cross Card,6,20,,10,,,,,,,,2,,,,,{ if(Class != Paladin && Class != Champion) { bonus3 bAutoSpell,378,3,30; },{},{}
  23. lol @ you guys, no one has a test server? If this doens't get finalized soon, I will write it up
×
×
  • Create New...