Jump to content

Z3R0

Members
  • Posts

    615
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Z3R0

  1. 59 minutes ago, Scylla said:

    I've been reading the doc/item_bonus.txt and only thing i see is for magic:

    
    bonus2 bMagicAtkEle,e,x;  		Increases damage of e element magic by x%

    Is there actually a script for physical or a way to make it for physical?

     

    Nevermind. Was looking at the wrong one :D

     

  2. 9 hours ago, Aisha said:

    On the last portion, that is the first time I am seeing set being used like that. I will have to read up on it. Though if you can explain what it is doing, would appreciate it.

    Because from what I can understand, it is counting its own array size, but I am not sure as to where the array itself is initialized, or is that the part where info is being added? Sorry, a bit confused by your example.

     

    sure :D 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...

  3. 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 ***

  4. 7 hours ago, ToiletMaster said:

    Hi Guys,

    i've been trying to figure out this for quite sometime but after searching around and tinkering around i just can't seem to find out where is the issue here.

    this works outside of the instance but within the instance, i get a weird error from the console

    
    (map_mapname2mapid) mapindex_name2id: Map "" not found in index list!

    I'm not sure how it works since it's kinda my first time using OnPcDieEvent in instances. Would appreciate if someone could point me to the right direction! Generally what I'm trying to achieve is that once you go in and die 3 times, your entire party should automatically get warped out.

     

    
    -	script	Controller	-1,{
    	OnPcDieEvent:
    		if(instance_mapname(strcharinfo(3)) != instance_mapname("instance") ){end;}
    		if(.chance == 3){ mapwarp instance_mapname("instance"),"prontera",150,150; end;}
    		
    		.chance++;
    		mapannounce strnpcinfo(4),strcharinfo(0)+" has died! you only have "+(3 - .chance)+" lives remaining.",bc_all;
    		end;
    		}

     

    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 :D

    Both instance_mapname () need to have ID because this event is not attached to the instance itself

  5. 19 minutes ago, ToiletMaster said:

    Hi Guys,

    i've been trying to figure out this for quite sometime but after searching around and tinkering around i just can't seem to find out where is the issue here.

    this works outside of the instance but within the instance, i get a weird error from the console

    
    (map_mapname2mapid) mapindex_name2id: Map "" not found in index list!

    I'm not sure how it works since it's kinda my first time using OnPcDieEvent in instances. Would appreciate if someone could point me to the right direction! Generally what I'm trying to achieve is that once you go in and die 3 times, your entire party should automatically get warped out.

     

    
    -	script	Controller	-1,{
    	OnPcDieEvent:
    		if(instance_mapname(strcharinfo(3)) != instance_mapname("instance") ){end;}
    		if(.chance == 3){ mapwarp instance_mapname("instance"),"prontera",150,150; end;}
    		
    		.chance++;
    		mapannounce strnpcinfo(4),strcharinfo(0)+" has died! you only have "+(3 - .chance)+" lives remaining.",bc_all;
    		end;
    		}

     

    Following because I  am working with instances right now and will need this

  6. 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

     

  7. 4 hours ago, rakuzas said:
    
    Example to get Crimson Weapon with Ghost property:
    	// +9 Crimson Dagger [2]
    	setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
    	setarray .@OptVal[0],0;
    	setarray .@OptParam[0],0;
    	getitem3 28705,1,1,9,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;

    Hello,

    I tried making adding 3 random effect on item.. I already tried many ways to make it random.. But always got no option ID error.. Or sometimes the NPC stuck.. 

    I tried giving random 3 effect to player item.. But always fail.. But I can give up to 5 effect but not random.. It just give the 5 in the first line only.. 
     

    Below is working.. But limit 2 random per effect only.. How to give it more than 2?

    
    	setarray .@OptID[0],rand (RDMOPT_VAR_AGIAMOUNT,RDMOPT_VAR_MAXHPPERCENT),rand (RDMOPT_VAR_SPACCELERATION,RDMOPT_VAR_PLUSASPD),RDMOPT_VAR_LUKAMOUNT;
    	setarray .@OptVal[0],rand (1,3),rand (1,3),rand (1,3),rand (1,3);
    	setarray .@OptParam[0],3;
    	getitem3 28705,1,1,9,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;

     

    Please guide me.. Thanks..

     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...

  8. 48 minutes ago, Z3R0 said:

    That's strange 

     

    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; }},{},{}

     

  9. 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;
    	}
    
    
    }

     

    • Upvote 3
  10. 1 hour ago, crazyarashi said:
    
    4359,B_Eremes_Card,Assassin Cross Card,6,20,,10,,,,,,,,2,,,,,{ if(Class == Paladin || Class == Champion) {} else { bonus3 bAutoSpell,378,3,30; },{},{}

     

     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; },{},{}

     

×
×
  • Create New...