Jump to content

Patskie

Members
  • Posts

    1702
  • Joined

  • Last visited

  • Days Won

    18

Posts posted by Patskie

  1. -	script	Ecall	-1,{
    	OnEcall:
    		if (!getcharid(2) || getguildmasterid(getcharid(2)) != getcharid(0)) end;
    		message strcharinfo(0), "Emergency Call!";
    		progressbar "000000", 5;
    		addrid(3, 0, getcharid(2));
    		if (getguildmasterid(getcharid(2)) == getcharid(0)) end;
    		getmapxy .@map$, .@x, .@y, BL_PC, getguildmaster(getcharid(2));
    		warp .@map$, .@x, .@y;
    		end;
    	OnInit:
    		bindatcmd "guildec", strnpcinfo(1) + "::OnEcall";
    		end;
    }

     

  2. The function i created will loop over each character of the string and check if that character is a letter or a number. If there is a number then always return 1 else 0.

    You can return anything from a function you can leave it empty as well for any reason. I just use 0 and 1 because any !var means 0 and var means something else. 

  3. prontera,150,150,6	script	Sample	112,{
    	do {
    		input .@string$;
    	} while (callfunc("ValidateInput", .@string$));
    	mes "You pick " + .@string$;
    	close;
    }
    
    function	script	ValidateInput	{
    	.@str$ = getarg(0, "");
    	.@size = getstrlen(.@str$);
    	for (.@i = 0; .@i < .@size; .@i++) {
    		if (charat(.@str$, .@i) != " ") {
    			if (!charisalpha(.@str$, .@i))
    				return 1;
    		}
    	}
    	return 0;
    }

     

  4. Try below

    prontera,150,150,6	script	Zeny Roulette	4_F_KAFRA1,{
    	function Roll;
    	cutin "1s_1", 3;
    	mes .npc$;
    	mes "Hi " + strcharinfo(0) + ", So do you want to play zeny roulette?";
    	next;
    	
    	if (select("~ Yes:~ No") & 2) {
    		mes .npc$;
    		mes "Alright!";
    		close2;
    		cutin "", 255;
    		end;
    	}
    	
    	mes .npc$;
    	mes "Let's go!";
    	next;
    	
    	@level = 1;
    	
    	while(1) {
    		switch(select("~ Play:~ Exit")) {
    			case 1: 
    				.@str$ = Roll(@level);
    				if (.@str$ == "NZ") {
    					mes .npc$;
    					mes "You need " + callfunc("F_InsertComma", .zeny_amt_need) + " in order to participate in the roulette.";
    					.@a = 1;
    					break;
    				}
    				if (.@str$ == "NA") {
    					mes .npc$;
    					mes "Seems not your lucky day " + strcharinfo(0);
    					if (@level > 1)
    						@level--;
    					next;
    					break;
    				}
    				.@index = inarray(.item_cutin$, .@str$);
    				mes .npc$;
    				mes "Congratulations! You won ^FF8000" + getitemname(.item_reward[.@index]) + "^000000!";
    				getitem .item_reward[.@index], 1;
    				specialeffect 10;
    				// Jackpot
    				if (.@str$ == "7s_2") {
    					announce strcharinfo(0) + " just won the jackpot prize " + getitemname(.item_reward[.@index]) + " at Zeny Roulette, get yours now!", 0;
    					@level = 1;
    					.@a = 1;
    					break;
    				}
    				@level++;
    				next;
    				break;
    			case 2:
    			default:
    				.@a = 1;
    				break;
    		}
    		
    		if (.@a) { .@a = 0; break; }
    	}
    	
    	close2;
    	cutin "", 255;
    	end;
    	
    	function Roll {
    		if (.zeny_required && .zeny_amt_need > Zeny)
    			return "NZ";
    		Zeny -= .zeny_amt_need;
    		.@i = getarg(0, 1);
    		while(1) {
    			.@done = 0;
    			for (.@j = 1; .@j <= (10 - .@i); .@j++) {
    				cutin .@i + "s_" + .@j, 3;
    				if (5 > rand(100)) {
    					.@done = 1;
    					.@award_cutin$ = .@i + "s_" + .@j;
    					if (.@j == 1 || .@j == (10 - .@i))
    						.@award_cutin$ = "NA";
    					break;
    				}
    				sleep2 100;
    			}
    			
    			if (.@done)
    				break;
    		}
    		return .@award_cutin$;
    	}
    	
    	OnInit:
    		.npc$ = "[^808080 " + strnpcinfo(1) + " ^000000]";
    		.zeny_required = 1; // 1 = yes / 0 = no
    		.zeny_amt_need = 100000; // zeny amount needed
    		setarray .item_cutin$[0], "1s_2", "1s_3", "1s_4", "1s_5", "1s_6", "1s_7", "1s_8", "2s_2", "2s_3", "2s_4", "2s_5", "2s_6", "2s_7", "3s_2", "3s_3", "3s_4", "3s_5", "3s_6", "4s_2", "4s_3", "4s_4", "4s_5", "5s_2", "5s_3", "5s_4", "6s_2", "6s_3", "7s_2";	
    		setarray .item_reward[0], 501, 502, 503, 504, 505, 506, 507, 501, 502, 503, 504, 505, 506, 507, 501, 502, 503, 504, 505, 506, 507, 501, 502, 503, 504, 505, 506, 507;
    		end;
    }

    You have to set the rewards properly

    setarray .item_cutin$[0], "1s_2", "1s_3", "1s_4", "1s_5", "1s_6", "1s_7", "1s_8", "2s_2", "2s_3", "2s_4", "2s_5", "2s_6", "2s_7", "3s_2", "3s_3", "3s_4", "3s_5", "3s_6", "4s_2", "4s_3", "4s_4", "4s_5", "5s_2", "5s_3", "5s_4", "6s_2", "6s_3", "7s_2";	
    setarray .item_reward[0], 501, 502, 503, 504, 505, 506, 507, 501, 502, 503, 504, 505, 506, 507, 501, 502, 503, 504, 505, 506, 507, 501, 502, 503, 504, 505, 506, 507;

     

    • Upvote 1
  5. brasilis,253,355,5	script	Deletador de personagem NÃO FALE	811,{
    
    OnPCDieEvent:
    	message strcharinfo(0),"Game Over";
    	atcommand "@dropall 0"+strcharinfo(0);
    	addtimer 60000, strnpcinfo(3) + "::OnCharDelete";
    	end;
    
    OnCharDelete:
    	if (Hp) end;
    	set .@deadplayer,getcharid(0);
    	set .@j, getarraysize( .char_delete$ );
    	for (.@i = 0; .@i < .@j; .@i++) {
    		query_sql("DELETE FROM `"+ .char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    	}
    	query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    	end;
    
    OnInit:
    	setarray .char_delete$[0],"bonus_script","char","storage","cart_inventory","elemental","friends","char_reg_str","char_reg_num","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    	end;

    This will delete the character after 1 minute when they die. But they can bypass the timer if they logout

  6. Under OnInit label put below

    setarray .s_exclude_jobs[0], Job_Champion, Job_Professor, Job_Stalker;

    and then change below

    callsub Hourly_Rewads;

    to 

    if (inarray(.s_exclude_jobs, Class) == -1)
    	callsub Hourly_Rewads;

     

  7. I think there is something wrong with setmapflag for MF_SKILL_DAMAGE. It's causing error always -> map_setmapflag: Skill damage adjustment without casting type for map <map_name> because the caster is not set in script.cpp

    Anyway back to topic

    1. Apply the diff attached

    2. Try below sample npc. -100 (means no damage)

    prontera,150,150,6	script	Instance Create	100,{
    	.@instance_name$ = "Old Glast Heim";
    	if (instance_create(.@instance_name$, IM_CHAR, getcharid(0)) < 0 ) {
    		message strcharinfo(0), "Failed to create instance";
    		end;
    	}
    	instance_enter(.@instance_name$, 150, 20, getcharid(0), instance_id(IM_CHAR));
    	doevent strnpcinfo(3) + "::OnEnter";
    	end;
    	
    	OnEnter:
    		.@map$ = instance_mapname("1@gl_k", instance_id(IM_CHAR));
    		if (!getmapflag(.@map$, MF_SKILL_DAMAGE, SKILLDMG_MOB))
    			setmapflag .@map$, MF_SKILL_DAMAGE, -100, SKILLDMG_MOB;
    		monster .@map$, 150, 20, "Poring", 1002, 10;
    		end;
    }
    
    prontera,153,153,6	script	Instance Destroy	100,{
    	instance_destroy instance_id(IM_CHAR);
    	end;
    }

     

     

    skill_damage.patch

×
×
  • Create New...