Jump to content

Emistry

Forum Moderator
  • Posts

    9,746
  • Joined

  • Days Won

    305

Posts posted by Emistry

  1. 3 hours ago, kalabasa said:

    the given range slots of NPC that you mentioned or

    range slot, when the server startup it will auto allocate some space to hold the npc view data

    if you assigned too much free slot, you are just wasting ur resources.

    3 hours ago, kalabasa said:

    higher NPC id's ?

    and value shouldn't exceed NPC_RANGE3_END (unless you know exactly what you are trying to do), else no resources will be allocated for the npc view data.

    • Like 1
  2. your script suppose to kick the second or next character who have same IP or unique id.

    But you tested with only one char, which is also an Admin character.

    Test it with 2 normal character instead.

    remove the debug message, since its meant for debug purpose

    debugmes [email protected]$;

     

  3. -	script	Sample	-1,{
    
    OnInit:
    	// 1= if you have gepard 0=if you do not use gepard
    	[email protected]_gepard = 1;
    	
    	setarray .map$,
    		"quiz_00"
    		, "prt_are_in"
    		, "bat_c01"
    		, "guild_vs2"
    		, "ordeal_1-2"
    		, "coliseum"
    		, "ama_test"
    		, "quiz_02"
    		, "safari"
    		, "niflheim"
    		, "que_qsch01"
    		, "[email protected]"
    		, "[email protected]"
    		, "p_track01"
    		, "pvp_n_2-1";
    		
    	[email protected]_size = getarraysize(.map$);
    	for ([email protected] = 0; [email protected] < [email protected]_size; [email protected]++)
    		setmapflag .map$[[email protected]], MF_LOADEVENT;
    		
    	.sql_field$ = ([email protected]_gepard ? "last_unique_id" : "last_ip");
    	end;
    	
    OnPCLoadMapEvent:
    	[email protected]$ = strcharinfo(3);
    	if (inarray(.map$, [email protected]$) == -1) end;
    	
    	[email protected]$ = "SELECT `account_id` FROM `login`";
    	[email protected]$ = [email protected]$ + " WHERE 1=1";
    	[email protected]$ = [email protected]$ + " AND `group_id` < 99";
    	[email protected]$ = [email protected]$ + " AND `account_id` <> "+getcharid(3);
    	[email protected]$ = [email protected]$ + " AND `account_id` NOT IN (SELECT `account_id` FROM `vendings` WHERE `autotrade` > 0)";
    	[email protected]$ = [email protected]$ + " AND `account_id` NOT IN (SELECT `account_id` FROM `buyingstores` WHERE `autotrade` > 0)";
    	[email protected]$ = [email protected]$ + " AND `"+.sql_field$+"` IN (SELECT `"+.sql_field$+"` FROM `login` WHERE `account_id` = "+getcharid(3)+")";
    
    	debugmes [email protected]$;
    	[email protected] = query_sql([email protected]$, [email protected]);
    	[email protected]_aid = getcharid(3);
    	
    	if ([email protected]) {
    		for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
    			if (attachrid([email protected][[email protected]])) {
    				if (strcharinfo(3) == [email protected]$) {
    					attachrid [email protected]_aid;
    					dispbottom "[ BrasilRO ] Me desculpe, mas para evitar abusos, Double Clients não são permitidos nesse mapa.";
    					sleep2 2000;
    					atcommand "@kick " + strcharinfo(0);
    					end;
    				}
    			}
    		}
    	}
    	end;
    }

    please at least try to tell "what" is not working next time, thank you.

  4. may try this

    -	script	Sample	-1,{
    	end;
    
    OnInit:
    	// 1= if you have gepard 0=if you do not use gepard
    	[email protected]_gepard = 1;
    	
    	setarray .map$,
    		"quiz_00"
    		, "prt_are_in"
    		, "bat_c01"
    		, "guild_vs2"
    		, "ordeal_1-2"
    		, "coliseum"
    		, "ama_test"
    		, "quiz_02"
    		, "safari"
    		, "niflheim"
    		, "que_qsch01"
    		, "[email protected]"
    		, "[email protected]"
    		, "p_track01"
    		, "pvp_n_2-1";
    		
    	[email protected]_size = getarraysize(.map$);
    	for ([email protected] = 0; [email protected] < [email protected]_size; [email protected]++)
    		setmapflag .map$[[email protected]], MF_LOADEVENT;
    		
    	.sql_field$ = ([email protected]_gepard ? "last_unique_id" : "last_ip");
    	end;
    	
    OnPCLoadMapEvent:
    	[email protected]$ = strcharinfo(3);
    	if (inarray(.map$, [email protected]$) == -1) end;
    	
    	[email protected]$ = "SELECT `account_id` FROM `login`";
    	[email protected]$ = [email protected]$ + " WHERE `group_id` < 99";
    	[email protected]$ = [email protected]$ + " AND `account_id` <> "+getcharid(3);
    	[email protected]$ = [email protected]$ + " AND `account_id` NOT IN (SELECT `account_id` FROM `vendings` AND `autotrade` > 0)";
    	[email protected]$ = [email protected]$ + " AND `account_id` NOT IN (SELECT `account_id` FROM `buyingstores` AND `autotrade` > 0)";
    	[email protected]$ = [email protected]$ + " AND `"+.sql_field$+"` IN (SELECT `"+.sql_field$+"` FROM `login` WHERE `account_id` = "+getcharid(3)+")";
    
    	[email protected] = query_sql([email protected]$, [email protected]);
    	[email protected]_aid = getcharid(3);
    	
    	if ([email protected]) {
    		for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
    			if (attachrid([email protected][[email protected]])) {
    				if (strcharinfo(3) == [email protected]$) {
    					attachrid [email protected]_aid;
    					dispbottom "[ BrasilRO ] Me desculpe, mas para evitar abusos, Double Clients não são permitidos nesse mapa.";
    					atcommand "@kick " + strcharinfo(0);
    					end;
    				}
    			}
    		}
    	}
    	end;
    }

     

  5. function deleteItem {
    	[email protected]_req_ratio = 1;
    	if (@rebirth_type == 1 && )
    		[email protected]_req_ratio = max(1, (rebirth_no / 20));
    	
    	for ([email protected]=0 ; [email protected] < .size_item; [email protected] += 3 ){
    		if ( !( getarg(0)&(.item_req[[email protected]+2]) ) ){continue;}
    		delitem .item_req[[email protected]], ( .item_req[ [email protected]+1 ] * [email protected]_req_ratio);
    	}
    	return;
    }
    function CheckItemNeed {
    	if ( Weight > 200000 ) {
    		mes "You must reduce your weight to 2000 to do Rebirth.";
    		close;
    	}
    	[email protected]_req_ratio = 1;
    	if (@rebirth_type == 1 && )
    		[email protected]_req_ratio = max(1, (rebirth_no / 20));
    	
    	[email protected] = 0;
    	for ([email protected]=0 ; [email protected] < .size_item; [email protected] += 3 ){
    		if ( !( getarg(0)&(.item_req[[email protected]+2]) ) ){continue;}
    		if ( countitem( .item_req[[email protected]] ) < (.item_req[ [email protected]+1 ] * [email protected]_req_ratio) ) {
    			mes "You Require [^ff0000"+countitem( .item_req[[email protected]] )+" / "+ (.item_req[ [email protected]+1 ] * [email protected]_req_ratio) +"^000000] ^112FD9"+getitemname( .item_req[[email protected]] )+"^000000";
    			[email protected] = 1;
    		}else{
    			mes "You Require [^00ff00"+countitem( .item_req[[email protected]] )+" / "+ (.item_req[ [email protected]+1 ] * [email protected]_req_ratio) +"^000000] ^112FD9"+getitemname( .item_req[[email protected]] )+"^000000";
    		}
    	}
    	if ([email protected] && !getarg(1,0)){close;}
    	
    	return;
    }

    change the both script function that calculate and display then delete the required items.

  6. OnPCLoginEvent:
    	if (#GetCashFree) {
    		dispbottom "You gained 100,000 cashpoint!!! Enjoy!";
    		#CASHPOINTS += 100000;
    		#GetCashFree = 1;
    	}
    	end;

    A permanent global account variable stored by the login server is more than enough, unless ur server support multiple different char-server

  7. if you're running NPC script, use this instead

    *successrefitem <equipment slot>{,<count>{,<char_id>}};
    
    This command will refine an item in the specified equipment slot of the invoking
    character by +1, or a count if given. For a list of equipment slots see 'getequipid'.
    This command will also display a 'refine success' effect on the character and put
    appropriate messages into their chat window. It will also give the character fame
    points if a weapon reached +10 this way, even though these will only take effect for
    blacksmith who will later forge a weapon.
    if (getrefine() >= 6) 
    	successrefitem EQI_ARMOR, 1;

     

  8. On 4/5/2022 at 7:13 AM, Redao said:

    he ghostring monster from pay_fild04, is there any way I can block the DROP of his card "only on this MAP?"

    1.

    instead of removing it, why not just remove the other ghostring from other map ? spawn a clone of ghosting using new mob_id (or existing event mob) that has no item drops.

    2.

    But of course, you could also remove this from payon map, then spawn it using NPC script that run an event label to simulate the item drops if you willing to sacrifice some processing power and do calculation for item drop penalty or bubble gum bonus.

     

    On 4/5/2022 at 7:13 AM, Redao said:

    Is there a way to block the Drop of a certain card in the Endless Tower?

    For example: Blocking the Boss Scene Card drop on the Endless Tower map.

    read point 2 above, by default all instance monster are spawned by NPC script, they run event label when died.

  9. something like this ?

    prontera,155,181,5	script	Sample	757,{
    	mes "You need 20 "+getitemname(501);
    	mes "You need "+F_InsertComma(10000000)+" Zeny";
    	if (select("Confirm", "Cancel") == 1) {
    		if (countitem(501) >= 20 && Zeny >= 10000000) {
    			delitem 501, 20;
    			Zeny -= 10000000;
    			// random assign 200 stats
    			for ([email protected] = 0; [email protected] <= 200; [email protected]++) {
    				[email protected] = rand(bStr, bLuk);
    				[email protected][[email protected] - bStr]++;
    			}
    			// 5% to get 100 stats each.
    			for ([email protected] = bStr; [email protected] <= bLuk; [email protected]++) {
    				if (rand(100) < 5)
    					[email protected][[email protected] - bStr] = 100;
    			}
    			for ([email protected] = bStr; [email protected] <= bLuk; [email protected]++)
    				sc_start (SC_STRFOOD + [email protected] - 1), 1200000, [email protected][[email protected] - bStr];
    		}
    	}
    	close;
    }

     

  10. -	script	Samepl	-1,{
    	
    	OnInit:
    		bindatcmd "test",strnpcinfo(3) + "::OnAtcommand";
    		end;
    		
    	OnAtcommand:
    		if (getmapusers([email protected]_parameters$[0]) != -1) {
    			message strcharinfo(0), "Map not found.";
    			
    		}
    		else if (getmapflag([email protected]_parameters$[0], MF_NOWARPTO) && getgmlevel() < 99) {
    			message strcharinfo(0), "You are not authorized to warp to this map.";
    		}
    		else if (getmapflag([email protected]_parameters$[0], MF_NOWARP) && getgmlevel() < 99) {
    			message strcharinfo(0), "You are not authorized to warp from your current map.";
    		}
    		else {
    			message strcharinfo(0), "Warped to " + [email protected]_parameters$[0];
    			warp [email protected]_parameters$[0], 0, 0;
    		}
    		end;
    }

    just add the mapflag MF_NOWARPTO to any map that you want prevent player to warp into those maps.

     

    or change the warp atcommand to enforce random warp

    https://github.com/rathena/rathena/blob/master/src/map/atcommand.cpp#L600

    mapindex = mapindex_name2idx(map_name, nullptr);
    x = 0;
    y = 0;

     

  11. Super Convex Mirror


    Description :

    The NPC are capable to search for MVP in the whole server or specific maps.

    Back in eAthena, there exists a script command (forgotten the name, perhaps a mobcount(...) with parameter changed) which allow us to check for specific monster id exists in the map or not, but it was removed.

    Then we could use mobcount(...) script command to get similar results, but we need to manually append an NPC event to each monster.

    Now, we could also do the same by using getunits(...)getmapunits(...) script commands.

    Of course there are pro and cons for each version, I'll just leave it to you to decide for yourself whether to use it or not.

    The origin of script came from @Brian

     

    Preview :

    ViPqqMz.jpg

     

    Settings :

    		// Enable player to warp to MVP?
    		// 0 = disabled
    		// 1 = enabled 
    		// 2 = enabled + SC_BOSSMAPINFO
    		.warp_to_mvp = 2;

    Enable this setting if you wish to allow NPC to warp into the monster map.

    		// enable this setting to fully utilize the NPC script. (use at your own risk)
    		// read more info at /conf/battle/monster.conf
    		setbattleflag("dynamic_mobs", 0);

    By default, the dynamic_mobs configuration are set to yes. This help you save some server resources if the maps aren't access by any players recently by saving the monster data into the cache.

    The downside of using dynamic_mobs, monsters are cached, NPC can't search for the monster data if they are cached. FYI, monsters that spawned by NPC scripts aren't cached.

    		// list of MVP map.
    		setarray .map$,
    			// enable this if you want it search whole server. (unable to use warp to mvp option)
    			// "all", 

    Enable this if you wish to enable to NPC to search the whole server, incase you missed what other maps have MVP (including showing mvp from restricted areas, like Guild Dungeon) 

    FYI, searching the whole server would take a longer time, use at your own risk.

     

    Notes :

    The NPC are capable to search any MVP monsters in the map, including monster summoned by Bloody Branch, or Class Change Skill (from Sage's Abracadabra), as long as the monster have MVP EXP.

     

    Why do we need this if we already have Convex Mirror Item?

    I am sure everyone has used Convex Mirror before, but there are few reason that its frustrating to use it:

    • Each convex mirror only can search current map of player.
    • Convex mirror are wasted if the map doesn't have any MVP or killed.
    • Convex mirror can't search for monster that summoned by NPC script.

    This NPC could serve as compensation for player, imagine the use case where you spend a Convex Mirror to know which MVPs are still alive instead of letting it go wasted knowing that the MVP in current map is dead or not found.

     


    • Submitter
    • Submitted
      04/24/2022
    • Category
    • Video
    • Content Author
      Brian, Emistry

     

    • Upvote 2
  12. try

    getinventorylist;
    for([email protected] = @inventorylist_count - 1; [email protected] >= 0; [email protected]) {
    	if (@inventorylist_identify[[email protected]])
    		continue;
    	
    	if (getiteminfo(@inventorylist_id[[email protected]], ITEMINFO_LOCATIONS) != EQP_ARMOR)
    		continue;
    	
    	deletearray [email protected];
    	deletearray [email protected];
    	deletearray [email protected];
    	
    	// first enchant
    	if (rand(100) < 30) {
    		[email protected][0] = 0;
    		[email protected][0], F_rand(3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
    		if ([email protected][0] == 9 || [email protected][0] == 10)
    			[email protected][0] = rand(3, 7);
    		else if([email protected][0] == 11 || [email protected][0] == 12)
    			[email protected][0] = rand(1, 20);
    		else 
    			[email protected][0] = rand(1, 4);
    	}
    	
    	// second enchant
    	if (rand(100) < 30) {
    		[email protected][1] = 1;
    		[email protected][1], F_rand(3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
    		if ([email protected][1] == 9 || [email protected][1] == 10)
    			[email protected][1] = rand(3, 7);
    		else if([email protected][1] == 11 || [email protected][1] == 12)
    			[email protected][1] = rand(1, 20);
    		else 
    			[email protected][1] = rand(1, 4);
    	}
    	
    	delitemidx @inventorylist_idx[[email protected]];
    	getitem3 @inventorylist_id[[email protected]], 1, 1, 0, 0, 0, 0, 0, 0, [email protected], [email protected], [email protected];
    }

     

  13. prontera,181,157,0	warp	prace_warp_portal	1,1,p_track01,52,41
    OnClock2100:
    	//if( gettime(3)%2 ) end;
    	set .access_Prace, 1;
    	announce "Poring Race is now open!",0,0xFFAB54;
    	setnpctimer 100000,"Bidder#prace0";
    	startnpctimer "Bidder#prace0";
    
    	enablenpc "prace_warp_portal";		// <--- ADD THESE
    	sleep 60000;                            // <--- ADD THESE
    	disablenpc "prace_warp_portal";         // <--- ADD THESE
    	end;

    and also

    OnInit:
    	disablenpc "prace_warp_portal";         // <--- ADD THESE
    	end;

     

    • Love 1
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.