Jump to content

Magnetix

Members
  • Posts

    446
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Magnetix

  1. create a normal script function and invoke it using callfunc command

      - Id: 99999
        AegisName: Job_Scroll
        Name: Job Scroll
        Type: Usable
        Script: |
          callfunc "F_SelectJob";

    function script

    function	script	F_SelectJob	{
    	// Your job script here.
    	end;
    }

     

  2.  

    -	script	item_bonus_drop	-1,{
    OnInit:
    	// List of Equipments with bonus drop
    	setarray .Equipments,1107,1201,1222;
    	end;
    
    OnNPCKillEvent:
    	// Get the id of the equipped item
    	.@itemid = getequipid(EQI_HAND_R);
    
    	// Medal ID is 35001
    	// End the script if equipment is not equipped and no medal in the inventory
    	if ( inarray(.Equipments, .@itemid) < 0 && countitem(35001) ) end;
    
    	// GID of mob killed (do not touch)
    	.@killedgid = killedgid;
    
    	// Amount to drop (default: 1)
    	.@amount = 1;
    
    	// When a Medal is detected, set drop base on what is equipped
    	// If no medal is detected, the else section will be the default
    	if ( countitem(35001) ) {
    		switch(.@itemid) {
    		case 1107: // Blade [3]
    			.@dropid = 512; // Apple
    			break;
    		case 1201: // Knife [3]
    			.@dropid = 582; // Orange
    			break;
    		default: // Equipping Damascus will drop meat
    			.@dropid = 35002; // Big Meat
    			break;
    		}
    	/*} else if ( countitem(MEDAL_ID_HERE) ) {
    		// Similar to above, modify loots base on whatever medal is detected in your inventory.
    		// You also have to consider the priority if there are multiple medals in the inventory.
    	*/
    	} else {
    		// Default drops for each equipment when Medal is not detected
    		// If not specified, default drop is Meat(517)
    		switch(.@itemid) {
    		case 1107: // Blade [3]
    			.@dropid = 512; // Apple
    			break;
    		case 1201: // Knife [3]
    			.@dropid = 582; // Orange
    			break;
    		default: // Equipping Damascus will drop meat
    			.@dropid = 517; // Meat
    			break;
    		}
    	}
    
    	// Determine player and monster positions, don't touch
    	getunitdata .@killedgid, .@mob;
    	.@mymap$ = strcharinfo(3);
    
    	// Drop randomly around the monster
    	// Check script 'checkcell' on how to check a cell if reachable for the loot(s)
    	makeitem .@dropid, .@amount, .@mymap$, .@mob[UMOB_X] + rand(-1, 1), .@mob[UMOB_Y] + rand(-1, 1);
    
    	end; // End of script
    }

    I've not tested the code so it may contain warnings or errors.

    There are multiple ways to achieve this but i think this is the most basic. Like for example, you can skip the else section when setting drops and just use an array in the beginning to hold the default loots for each equipment only leaving the part where the loot is modified when a medal is detected in the inventory.

  3. Each of the items sold by that NPC is priced at 1z. When a player sell any of these items, the price of the item, when no Sell price is declared in the database, is HALF the buy price declared.

    #   Buy                     Buying price. When not specified, becomes double the sell price. (Default: 0)
    #   Sell                    Selling price. When not specified, becomes half the buy price. (Default: 0)

    Let's take Yggdrasil Berry as an example.

    You have set your script to sell the berry like this

    prontera,145,187,5 loja Utilidades 506,607:1

    ..now check the item_db_usable.yml, berry is declared like this

      - Id: 607
        AegisName: Yggdrasilberry
        Name: Yggdrasil Berry
        Type: Healing
        Buy: 5000
        Weight: 300
        Flags:
          BuyingStore: true
        Delay:
          Duration: 5000
          Status: Reuse_Limit_F
        Script: |
          percentheal 100,100;

    Yggdrasil Berry has a default Buy value of 5000 and no Sell value. This means that when a player tries to sell the item, it will have a sell price of 2500z.

    By selling it at 1z, this creates an opportunity for players to exploit them. They buy them at 1z and sell sell them back for 2500z. That's why the rAthena is warning you.

    If you do intend of selling them for only 1z, you can set the Buy price to 1 and Sell to 0 for each of the item sold in the shop. But if you wish to sell them using their original price, set all prices in the script from :1 to :-1

  4. Won't this breach the privacy of a guild if anyone is allowed to join?

    To answer your question, you shouldn't modify data in the database directly if the char/account/party/guild are loaded by the server. You can, however, do this by modifying the source. I don't know if one exist but you can create a script command that will remotely invoke the normal way of joining a guild and use them in your script.

  5. Simply check again the current location before reviving and warping. If not on the same map, it will be skipped.

    -	script	resspvp	-1,{ 
    OnPCDieEvent:
    	if( strcharinfo(3) == "pvp_map" ) {
    		sleep2 1000;
    
    		if( strcharinfo(3) == "pvp_map" ) {
    			atcommand "@alive "+strcharinfo(0);
    			warp "pvp_map",0,0;
    		}
    	}
    	end;
    }
  6. You receive the error because the character is no longer attached to the script to access its variable after closing the npc. 

    Ignoring implementation of the system and assuming you want to send the cards back at a specific timeframe, there are 2 ways you can access the variables, by using script commands attachrid and/or query_sql.

    You cannot solely use attachrid or query_sql. It will depend on the status of the character character. If it is online, then re-attach the char by using attachrid to access the character variables or modify them directly in the database through query_sql when the character is off.

    If you don't mind, a better implementation would be to save the info in another table instead of character variable. There are multiple benefits with this method:

    • The character's status is irrelevant.
    • The server can resend all the cards back in one wave.
    • You don't have to remove the entries from the table thus it can serve as a log.
  7. Test this first.

    prontera,162,193,5    script    Entrada PvP        943,{
    
        set .@n$, "[ ^cc0000Porteiro PvP^000000 ]";
    INICIO:
        mes .@n$;
        mes "Arena 01 : ^0000FFPVP Arena^000000";
        mes "Arena 02 : ^FF0000PVP Izlude^000000";
        mes "O que você gostaria de fazer ?";
        next;
        switch(select("^3366FFEscolher Arena^000000:^800080Visualizar Ranking^000000:^00FF00Ver Minha Posição^000000:Sair")) {
        case 1:
            mes .@n$;
            mes "Escolha a Arena que gostaria de entrar";
            mes "Arena 01 : ^0000FFPVP Arena^000000";
            mes "Arena 02 : ^FF0000PVP Izlude^000000";
            next;
            switch(select("- ^0000FFArena Fechada^000000 [ "+getmapusers($@map$[1])+" ]:- ^FF0000Arena Izlude^000000 [ "+getmapusers($@map$[2])+" ]:- Nenhuma")) {
            case 1:
                announce ""+strcharinfo(0)+" Entrou no PvP 1!!",bc,0xBAB9B9;
                warp $@map$[1],0,0;
                end;
    
            case 2:
                announce ""+strcharinfo(0)+" Entrou no PvP for All Room !!",bc,0xBAB9B9;
                warp $@map$[2],0,0;
                end;
    
            case 3: close;
            }
    
        case 2:
            mes .@n$;
            mes "Escolha a Arena do Rank:";
            next;
            switch(select("- Rank ^0000FFArena 01^000000:- Rank ^FF0000Arena 02^000000:- Voltar")) {
                case 1: callfunc("PvPS_Func","Ranking_Arena",1);close;
                case 2: callfunc("PvPS_Func","Ranking_Arena",2);close;
                case 3: goto INICIO;end;
            }
    
        case 3:
            mes .@n$;
            mes "Escolha o Tipo de PVP:";
            next;
            switch(select("- ^0000FFArena 01^000000:- ^FF0000Arena 02^000000:- Voltar")) {
                case 1: callfunc("PvPS_Func","MeuRanking",1);close;
                case 2: callfunc("PvPS_Func","MeuRanking",2);close;
                case 3: goto INICIO;end;
            }
    
        case 4: close;
        }
        end; // fallback
    
    }

     

    These are leftovers.

    close;
    }
    }
    }
    warp $@map$[4],0,0;
    end;
    
    case 5:
    if(Class < 4023 || Class > 4045){
    mes .@n$;
    mes "Só babys podem entrar nesse PvP !";
    close;
    }
    warp $@map$[5],128,114;
    end;
    
    case 6:
    close;

     

  8. -	script	Healer	-1,{
    OnTouch:
    	if((getgroupid() < 1)) goto normal_player;
    	if((getgroupid() >= 2)) goto vip_player_ouro;
    	if((getgroupid() >= 1)) goto vip_player_prata;
    	end;

    for this to work, add range or how far from the npc to trigger.


    example, change

    alberta,25,240,6	duplicate(Healer)	Curandeira#alb	936

    to

    alberta,25,240,6	duplicate(Healer)	Curandeira#alb	936,3,3

     

    • Like 1
  9. 1. We advise you to merge the pre-renewal files with the renewal. Doing this will save you the time of fixing the item/skill descriptions, maps and other client changes in renewal.

    2 & 3. You have to match the filenames of the files inside System folder with the Lub files when you patched your client. (See steps 11~14 under [ The kRO Client: Updating, Diffing, Hexing, Translating, and Customizing ])

  10. 1. For entrance

    	if ( agitcheck() || agitcheck2() || agitcheck3() ) {
    		mes "[Entrance Guard]";
    		mes "Woe is currently active can't enter right now"; // NPC message when woe is active
    		close;
    	} else {
    		/*
    		// your code when woe is off
    		*/
    	}

    2. Kick everyone when woe starts (I'm not sure if 'SavePoint' works but if it throws an error, you can change it to specific map/area)

    OnAgitStart:
    OnAgitStart2:
    OnAgitStart3:
    	mapwarp .map$, "SavePoint",0,0;
    	end;
    • Upvote 1
  11. Find

        //Check to see if the items is already +10
        if(getequiprefinerycnt(.@part) >= 10) {
            getitem 542,1;
            dispbottom "I can't refine this any more. This is as refined as it gets!";
            close;
        }

    replace with

        //Check refinement
        if ( getequiprefinerycnt(.@part) < 8 || getequiprefinerycnt(.@part) >= 10 ) {
            getitem 542,1;
            dispbottom "I can only refine +8 and +9 items!";
            close;
        }

     

  12. Please refer to my reply and ignore my suggestion at the bottom. I already mentioned that the script already offers a uid check, you just have to reuse it.

     

    veil,81,134,6	script	Quistis Trepe	10414,{
    	.gui = get_unique_id ();
    	.@nb = query_sql("SELECT `dailybbq` FROM `bloody_branch_uid` WHERE `unique_id` = "+.gui+" LIMIT 1", .@bbq);
    	
    	mes "[Quistis Trepe]";
    	mes "Say... do you want to play the MvP Ladder game? It cost 15 Vote Coins Per person, total of 30 Vote Coins now to get in.";
    	next;
    	switch(select("Yes, let's get it on!:Information.:Show me the best record.:No.")) {
    		case 1:
    			if (.@bbq == 0) {
    				break;
    			} else if (.@bbq >= 1) {
    				mes "You have already completed the Bloody Branch Quest for today. Come back tomorrow after 12:00am server time.";
    				close;
    			}

     

    Here's the line of codes that verify party members' IP

    			//Check party member UniqueID and see if they have completed for the day.
    			if(.@cip == 0 && .@cuid == 1) {
    			set .@done, 1;
    			}
    			// If same IP is on party
    			else if(.@cip == 1 && .@cuid == 0) {
    			set .@dupli, 1;
    			}			
    			else if(.@cip == 0 && .@cuid == 0) {
    				// Add IP to party list for checking
    				.@party_list$ += "|" + .@ipd$ + "|";
    				// Add Unique_ID to party list for checking
    				.@party_list$ += "|" + .@pmbbq$ + "|";
    			}

    After this, all you have to do was to reuse/insert the uid check.

    ...and you already did the first few lines

    			.@pmu = query_sql("SELECT last_unique_id FROM `login` WHERE account_id ="+$@partymemberaid[.@i]+"", .@party_mem_uid$);
    			.@gpmu = query_sql("SELECT `dailybbq` FROM `bloody_branch_uid` WHERE `unique_id` = "+.@party_mem_uid$+" LIMIT 1", .@pmbbq$);

     

  13. 5 hours ago, DR4LUC0N said:

    Oops, should have been more specific, basically it would be to check the party member if they entered before against the sql(bloody_branch) table for the NPC. Because I can do a check at the beginning for the person attached to the NPC, but not the party member. So the party member can use same PC with different IP and get in.

    You can just re-use the check since you're already attaching the party members

    	.gui = get_unique_id();
    	.@nb = query_sql("SELECT `bloodybranch` FROM `bloody_branch` WHERE `unique_id` = "+.gui+" LIMIT 1", .@bbq);
    	if (.@nb) .@dupli = 1;

     

    There's a simpler way, instead of the checking the IPs and unique ID, you can also save their account ids.

  14. You can use SQL query to look for the mvp cards in a player's inventory, an account's storage, vendor's shop, if you have mail enabled include mail attachments and guild storages.

    SELECT SUM(amount) FROM `inventory` WHERE `nameid` = <card_id>"

    The above will only count the specified mvp card id from all of the player's inventory, you have to include other tables (storage, vendings, etc.),

    and you have to do it for ALL mvp cards (loop), and at the end sum everything for the grand total.

    To hasten searches and avoid lagging the server, you may want to alter the table and index columns with `nameid` (this will also increase storage)

    and also instead of pulling the data each time you speak to the npc, better to pull the data at certain time of the day and just include 'As of <datetime>'... something like that

  15. The tombstone tracks the time of the MvP's death. If you want to show MvPs that are alive, here's an idea:

    Save all MvP id or you can query the ids from the database if you're using sql for mob_db.

    setarray $mvp_id, <mvp_id>; // Add the ids you want to track

    Create a script where, when an MvP is killed (OnNPCKillEvent), blacklist its id or skip showing the dead ones.

    OR you can use the tombstone to track if the MvP is dead or alive. You can set your data each time the tombstone is summoned and removed.

×
×
  • Create New...