Jump to content

Z3R0

Members
  • Posts

    615
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Z3R0

  1. On 8/20/2022 at 8:51 AM, Emistry said:
    prontera,155,181,5	script	Sample	757,{
    	mes "Give me Red Potion.";
    	if (select("Enter", "Cancel") == 1) {
    		if (!countitem(501)) {
    			mes "You dont have it.";
    		}
    		else {
    			TIME_LEFT = gettimetick(2) + (3 * 3600);
    			addtimer (3 * 3600 * 1000), strnpcinfo(3)+"::OnExpire";
    			warp "prt_fild01", 0, 0;
    		}
    	}
    	close;
    	
    	OnPCLoginEvent:
    		.@time_left = TIME_LEFT - gettimetick(2);
    		if (.@time_left > 0) {
    			addtimer (.@time_left * 1000), strnpcinfo(3)+"::OnExpire";
    		}
    		end;
    	
    	OnExpire:
    		TIME_LEFT = 0;
    		warp "prontera", 155, 181;
    		end;
    }

     

    Forgot to delitem the redpot ?

    • Like 1
  2. 
    -	script	Sample	-1,{
    	OnInit:
    		set .amount, 40; // amount of item to shower
    		set .item_id, 7227; // item id to shower
    		set .item_id2, 1234; // next item id to shower
    		bindatcmd "itemshower",strnpcinfo(3)+"::OnShower";
    		end;
    	OnShower:
    
    		getmapxy .@map$, .@x, .@y, UNITTYPE_PC;
    
    		while ( .count < .amount ) {
    			do {
    				.@x_diff = .@x + rand(1,5);
    				.@y_diff = .@y + rand(1,5);
    			} while (!checkcell(.@map$,.@x_diff,.@y_diff,cell_chkpass));
    			.@var = rand(2);
    			makeitem .@var?.item_id:.item_id2,1,.@map$,.@x_diff,.@y_diff;
    			set .count, .count + 1;
    		}
    		set .count, 0;
    		end;
    
    This will make the command @itemshow  ... start with the characters position, then it will consider a differential between 1 and 5 from their X,Y coordinates to "shower" around them...

     

    • Upvote 1
  3. -	script	Sample	-1,{
    	OnInit:
    		set .amount, 40; // amount of item to shower
    		set .item_id, 7227; // item id to shower
    		set .item_id2, 1234; // next item id to shower
    		bindatcmd "itemshower",strnpcinfo(3)+"::OnShower";
    		end;
    	OnShower:
    
    		getmapxy .@map$, .@x, .@y, UNITTYPE_PC;
    
    		while ( .count < .amount ) {
    			do {
    				.@x_diff = .@x + rand(1,5);
    				.@y_diff = .@y + rand(1,5);
    			} while (!checkcell(.@map$,.@x_diff,.@y_diff,cell_chkpass));
    			.@var = rand(2);
    			makeitem .@var?.item_id:.item_id2,1,.map$,.@x,.@y;
    			set .count, .count + 1;
    		}
    		set .count, 0;
    		end;

    This will make the command @itemshow  ... start with the characters position, then it will consider a differential between 1 and 5 from their X,Y coordinates to "shower" around them...

  4. Untested, but makes for easy updating without a bunch of repetition...

    harboro1,128,200,6	script	Platinum Skill Pusher	779,{
    
    				function SetSkills;
    				function SetJobLevel;
    				function Validate;
    
            mes "[Platinum Skill Pusher]";
            mes "Pssst, ehy you!";
            mes "Hand me ^0000FF100.000 zeny^000000 and you'll avoid a boring training, none will know!";
            mes "Man, there's no refund... are you sure you want it?";
            next;
            if (select("Yes Please:No") == 2) {
                    mes "[Platinum Skill Pusher]";
                    mes "Have a nice day... dude!";
                    close;
            }
    
            if( Zeny < .@zeny ) {
              mes "...ehy dude, you need ^0000FF100.000 zeny^000000,";
              mes "ask them to mom!";
              close;
            }
    
            Validate();
            
            set Zeny,Zeny -100000;
            callfunc "F_GetPlatinumSkills";
            mes "[Platinum Skill Pusher]";
            mes "Dehee thanks man...lazy people like you makes me rich buahah!";
            close;	      
    
    
        OnInit:
        	
        	SetSkills(Job_Swordman, 144, 145, 146);
        	SetJobLevel(Job_Swordman, 35);
    
        	SetSkills(Job_Mage, 157);
        	SetSkills(Job_Archer, 147, 148);
        	SetSkills(Job_Acolyte, 156);
        	SetSkills(Job_Merchant, 153, 154, 155);
        	SetSkills(Job_Thief, 149, 150, 151, 152);
        	SetSkills(Job_Knight, 1001);
        	SetSkills(Job_Wizard, 1006);
        	SetSkills(Job_Hunter, 1009);
        	SetSkills(Job_Priest, 1014);
        	SetSkills(Job_Blacksmith, 1012, 1013);
        	SetSkills(Job_Assassin, 1003, 1004);
        	SetSkills(Job_Crusader, 1002);
        	SetSkills(Job_Sage, 1007, 1008, 1017, 1018, 1019);
        	SetSkills(Job_Bard, 1010);
        	SetSkills(Job_Dancer, 1011);
        	SetSkills(Job_Monk, 1015, 1016);
        	SetSkills(Job_Alchemist, 238);
        	SetSkills(Job_Rogue, 238);
    
        	set .@zeny, 100000;
        	end;
    
        // getarg(0) = Class ID
        // getarg(1+) = Skill ID
        function SetSkills {
    
        	// Skip 0 because that's Class ID, not a Skill ID
        	for(.@i = 1; .@i <= getargcount(); .@i++) {
        		setd(".job_" + getarg(0) + "_skills["+(.@i - 1)+"]", getarg(.@i)); // .job_ClassID[0] = SkillID 1, [1] = SKill ID2 etc...
        	}
        	return;
        }
    
        // getarg(0) = Class ID
        // getarg(1) = Job Level
        function SetJobLevel {
        	for(.@i = 1; .@i <= getargcount(); .@i++) {
        		setd("job_" + getarg(0) + "_level", getarg(1));
        	}
        	return;
        }
    
        function Validate {
    
        	if (getd(".job_" + Class + "_level")) {
        		if (JobLevel < getd(".job_" + Class + "_level")) {
        			mes "You do not meet the Job Level Requirements";
        			close;
        		}
        	}
    
        	for(.@i = 0; .@i < getarraysize(getd(".job_" + Class + "_skills")); .@i++) {
        		if (getskilllv(getd(".job_" + Class + "_skills["+.@i+"]"))) {
        			mes "You have already received your skills";
        			close;
        		}
        	}
    
        	return;
    
        }
    
    	      
    }

     

  5. Correct it will continue down to the next else if if the first if fails... so it just tiers downwards...

     

    so if it never falls between X number then it doesn't work... the difference, is the more "chance" you want to give, the higher the initial value needs to be...

    especially when dealing with multiple cases... for instance in that case he went from 1 to 555... he could have gone from 1 to 100, but that would lower the chances between the items since you only have 100 total options, and have to split them among X number of items... so by increasing the base number from 100 to 555, he increased the chance range between goods so that they have a higher chance of hitting...

     

  6. Well, kinda... that makes it almost 50% chance...

     

    36/60... where as ALL 60 #'s would be 100%

    so 36/60 would be 60/100 = 36/X   .... so cross multiply / divide ==.... 100  * 36 / 60 = 60% chance refine rate... it would have been the same as doing... 1 outta 5... and only accept 1,2,3 and not accepting 4,5 ...

    The issue, is that you have to break it down to the common denominator... since you want a 1% chance you will most likely need to do it out of a full 100....

    set .@chance, rand(1,100);

    if (.@chance == 1) { // The 1% chance is successful! }
    elseif (.@chance <= 10) { // 10% chance }
    elseif (.@chance <= 30) { // 30% chance }
    elseif (.@chance <= 75) { // 75% chance }
    else {
      mes "Failed"; close;
    }

  7. no reason to set a needless variable when you can just determine if they have the skills or not

    43 minutes ago, Poring King said:

    create a set script commands and add a conditional statement

    example:
     

    set "addparameter here"plat,0;

    if ($plat == 1)  goto "proceedhere"

    "proceed here if not";

    set $plat,1;

    proceedhere:

    mes"you already take plat";

    close;

     

     

     

  8. Trying again...

    // Trades tokens
    // getarg(0) - number of tokens to be traded
    function	script	thqs_trade_token	{
    
    	// getarg(0) == Token Option
    	.@index = getarg(0);
    
    	// Number of Tokens
    	.@token_count[0], 1, 10, 100;
    	.@zeny_amt[0],5000000,50000000,500000000;
    
    	// If Nevermind was selected
    	if (.@index == 3) { close; }
    
    	if (#Treasure_Token < .@token_count[.@index]) {
    		mes "You don't have enough tokens!";
    		close;
    	}
    
    	if ( ( Zeny == MAX_ZENY ) || ( ( Zeny + .@zeny_amt[.@index] ) > MAX_ZENY) {
    		mes "You are already at max Zeny or this trade will go over max zeny";
    		close;
    	}
    
    	Zeny += .@zeny_amt[.@index];
    	#Treasure_Token -= .@token_amount[.@index];
    	close;
    }
    
    // Main script
    prt_in,164,174,1	script	Treasure Hunter's Shop	1_M_YOUNGKNIGHT,{
    	mes "[Ash]";
    	mes "Ahh, "+strcharinfo(PC_NAME)+"! Welcome to the Offical Treasure Hunter's Guild Shop.";
    	mes "You currently have ^FF0000"+#Treasure_Token+"^000000 treasure tokens!!!";
    	next;
    	switch( select("How does this place work?","What do you have in stock?","Nevermind") ) {
    		case 1:
    			mes "[Ash]";
    			mes "Well you see here you can exchange your treasure hunter tokens for zeny or rare weapons forged by our blacksmiths.";
    			mes " ";
    			mes "Everything has its own price value and the only way you can get the tokens is by completing quests assigned to you,the system normally works like this.";
    			mes " ";
    			mes "The harder the mission the more Tokens you will earn. All red quests are worth 4-8 Tokens, and the rest are worth 1-5.";
    			mes " ";
    			mes "Hope that solves your problem and questions.";
    			close;
    		case 2:
    			break;
    		case 3:
    			close;
    	}
    
    	mes "[Ash]";
    	mes "Ok here is our Big list of goods.";
    	mes " ";
    	mes "(Note T stands for a Treasure Token.)";
    	next;
    	mes "[Ash]";
    	mes "This is what we have to offer.";
    	next;
    	switch( select("Trade for zeny", "Trade for Weapons", "Trade for Cards", "Nevermind") ) {
    		case 1:
    			// Subtract 1 from the choice (Select Options are 1 to X) but arrays are 0 - X so we subtract 1... start at 0... and send to function
    			.@choice = select("5,000,000z - 1T","50,000,000z - 10T","500,00,000z - 100T","Nevermind") - 1;
    			thqs_trade_token(.@choice);
    		case 2:
    			mes "[Ash]";
    			mes "This is what we have to offer.";
    			next;
    			.@choice = select("Axe's","1 Handed Swords","2 Handed Swords","Book's","Bow's","Katar's","Knuckle's","Mace's","Whips","Wands","Nevermind");
    			ths_menu_weapons(.@choice);
    		case 3:
    			mes "[Ash]";
    			mes "This is what we have to offer.";
    			next;
    			thqs_menu_buy("$THQS_menu_cards","$THQS_menu_price");
    		case 4:
    			close;
    	}
    	end;
    }
     
    

     

  9. Here you go

     

    // Trades tokens
    // getarg(0) - number of tokens to be traded
    function	script	thqs_trade_token	{
    
    	// getarg(0) == Token Option
    	.@index = getarg(0);
    
    	// Number of Tokens
    	.@token_count[0], 1, 10, 100;
    	.@zeny_amt[0],5000000,50000000,500000000;
    
    	// If Nevermind was selected
    	if (.@index == 3) { close; }
    
    	if (#Treasure_Token < .@token_count[.@index]) {
    		mes "You don't have enough tokens!";
    		close;
    	}
    
    	if ( ( Zeny == MAX_ZENY ) || ( ( Zeny + .@zeny_amt[.@index] ) > MAX_ZENY) {
    		mes "You are already at max Zeny or this trade will go over max zeny";
    		close;
    	}
    
    	Zeny += .@zeny_amt[.@index];
    	#Treasure_Token -= .@token_amount[.@index];
    	close;
    }
    
    // Main script
    prt_in,164,174,1	script	Treasure Hunter's Shop	1_M_YOUNGKNIGHT,{
    	mes "[Ash]";
    	mes "Ahh, "+strcharinfo(PC_NAME)+"! Welcome to the Offical Treasure Hunter's Guild Shop.";
    	mes "You currently have ^FF0000"+#Treasure_Token+"^000000 treasure tokens!!!";
    	next;
    	switch( select("How does this place work?","What do you have in stock?","Nevermind") ) {
    		case 1:
    			mes "[Ash]";
    			mes "Well you see here you can exchange your treasure hunter tokens for zeny or rare weapons forged by our blacksmiths.";
    			mes " ";
    			mes "Everything has its own price value and the only way you can get the tokens is by completing quests assigned to you,the system normally works like this.";
    			mes " ";
    			mes "The harder the mission the more Tokens you will earn. All red quests are worth 4-8 Tokens, and the rest are worth 1-5.";
    			mes " ";
    			mes "Hope that solves your problem and questions.";
    			close;
    		case 2:
    			break;
    		case 3:
    			close;
    	}
    
    	mes "[Ash]";
    	mes "Ok here is our Big list of goods.";
    	mes " ";
    	mes "(Note T stands for a Treasure Token.)";
    	next;
    	mes "[Ash]";
    	mes "This is what we have to offer.";
    	next;
    	switch( select("Trade for zeny", "Trade for Weapons", "Trade for Cards", "Nevermind") ) {
    		case 1:
    			// Subtract 1 from the choice (Select Options are 1 to X) but arrays are 0 - X so we subtract 1... start at 0... and send to function
    			.@choice = select("5,000,000z - 1T","50,000,000z - 10T","500,00,000z - 100T","Nevermind") - 1;
    			thqs_trade_token(.@choice);
    		case 2:
    			mes "[Ash]";
    			mes "This is what we have to offer.";
    			next;
    			.@choice = select("Axe's","1 Handed Swords","2 Handed Swords","Book's","Bow's","Katar's","Knuckle's","Mace's","Whips","Wands","Nevermind");
    			ths_menu_weapons(.@choice);
    		case 3:
    			mes "[Ash]";
    			mes "This is what we have to offer.";
    			next;
    			thqs_menu_buy("$THQS_menu_cards","$THQS_menu_price");
    		case 4:
    			close;
    	}
    	end;
    }
     
    

     

×
×
  • Create New...