Jump to content

Rynbef

Members
  • Posts

    509
  • Joined

  • Last visited

  • Days Won

    7

Posts posted by Rynbef

  1. I've changed an if statement. I hope that's the final solution. U can add the same map as often as u want. 

    Spoiler
    /*
    rAthena Script
    Author: @Rynbef
    Create Date: 2021-19-12
    Last Updated: 2022-01-01
    
    Changelogs:
        2022-01-01:
            *changed OnNPCLoadEvent to OnNPCKillEvent
            *added check if killed enemie is player
            *removed space on callfunc after OnNPCKillEvent
            *fixed if statement syntax error
            *fixed if statement getarraysize of integer to getarraysize of specified getarg
            *removed callfunc OnInit
            *added console debugging can be disabled or enabled
            *changed variable types
            *fixed cant get item cause of wrong if statement
            *fixed for loop used array size instead random chance from argument getarg(3)
            *fixed player can't get item if random chance was equals to specified item chance
            *added argument amount to debug message
            *added map notification if player get lucky but not on a listed map. This can disabled or enabled seperat at OnInit below. Debugging needs to be enabled
            *added notification if everything works fine. Can be disabled or enabled on bottom of OnInit. Debugging needs to disabled
            #fixed wrong array output in for loop from getarg(0)[.i] to getelementofarray(getarg(0),.i)
            #changed .retval and .i vsriables to scope variables [email protected] and [email protected]
    
    Feature planned:
        #Player get zeny if he get lucky
        #Player get zeny only if items disabled
        #Player get zeny or item if both enabled
    
    Description:
        Give a specified item getarg(1) of amount getarg(2) on specified map getarg(0) with a percentage of getarg(3) (0.1 to 100 percent) to a player
        
    IMPORTANT:
        All arrays needs to have the same sizes
        It's importent to set all 3 arguments to callfunc
    
    Terms:
        Dont name this as yours
        Dont sell this script
        Dont upload this script on download-/s section or share it otherwise for pay
        Modifications are included from this terms
        Otherwise feel free to edit
    
    Other:
        Don't hestiate to contact me at the forum as pm if u've any error,question,suggestion or want a modification
    
    Script:
    */
    
    -   script  GetItemByMap    -1,{
    
    OnNPCKillEvent:
        set [email protected],callfunc("F_GetItemByMap",[email protected]$,[email protected],[email protected]_amounts,[email protected]_chance);
        if([email protected])
            end;
        if([email protected] == 1)
            debugmes "[F_GetItemByMap]: Works fine! Player get item.";
        else if([email protected] == 2)
            debugmes "[F_GetItemByMap]: Works fine! Player is unlucky and get no item.";
        else if([email protected] == 3 && [email protected])
            debugmes "[F_GetItemByMap]: Player isn't on a listed map. Current map: "+strcharinfo(3);
        else if([email protected] == 4 && [email protected])
            debugmes "[F_GetItemByMap]: Everything works fine!";
        else
            debugmes "[F_GetItemByMap]: Causes in errors. Debug logs on top!";
        end;
    
    OnInit:
        setarray [email protected]$[0],"prontera","alberta","izlude";
        serarray [email protected][0],501,4012,512;
        setarray [email protected]_amounts[0],100,1,5;
        setarray [email protected]_chance[0],1000,500,800;//Chance begins by 0.1 percentage. 1 = 0.1 and 1000 = 100 percent
        set [email protected],1;//0 = disable debugging,1 = enable
        set [email protected],1;//0 = disable map notification,1 = enable
        set [email protected],1;//0 = disable notification if everything works fine,1 = enable
        end;
    }
    
    function    script    F_GetItemByMap    {
    
    if(getargcount() != 4 || getarraysize(getarg(0)) != getarraysize(getarg(1)) || getarraysize(getarg(0)) != getarraysize(getarg(2)) || getarraysize(getarg(0)) != getarraysize(getarg(3))){
        if([email protected]){
            debugmes "[F_GetItemByMap]: An error is occurupted";
            debugmes "[Function arguments]: Function arguments are empty or to short. Arguments: "+getargcount();
            debugmes "[Array sizes]: Maps:"+getarraysize(getarg(0))+" - Items:"+getarraysize(getarg(1))+" - Amounts:"+getarraysize(getarg(2))+" - Chances:"+getarraysize(getarg(3));
            debugmes "[Function arguments]: Maps:"+getarg(0)+" - Items:"+getarg(1)+" - Amounts:"+getarg(2)+" - Chances:"+getarg(3);
        }
        return 0;
    } else {
        for([email protected] = 0; [email protected]<getarraysize(getarg(0)); [email protected]++){
            if(rand(1,1000) < getelementofarray(getarg(3),[email protected]))
                return 2;
            if(strcharinfo(3) == getelementofarray(getarg(0),[email protected])){
                getitem getelementofarray(getarg(1),[email protected]),getelementofarray(getarg(2),[email protected]);
                return 1;
            } else {
                return 3;
            }
        }
        }
        return 4;
        
    OnInit:
        set [email protected],1;//0 = disable debugging,1 = enable
        end;
    }

    Download file below

    getItemByMapFunction v7.txt

     

    Rynbef~

     

    It could looks like:

        setarray [email protected]$[0],"prontera","prontera","prontera";

        serarray [email protected][0],501,4012,512;

        setarray [email protected]_amounts[0],100,1,5;

        setarray [email protected]_chance[0],1000,500,800;

     

    But the player will get only one item. If u set items to 100% he will get everytimes the first listed one. It's a good idea to change. I'll do it soon if everything works yet.

     

    Rynbef~

  2. Just now, worn said:

    ou helped a lot friend, a lot I know you can't test, but you created a base for the other to help me, I'm saying that I can't run your script, just the simplified @sader script

    I've edited a few seconds ago. Maybe it works now. I've forgot to add all arrays to the callfunc.

     

    Best regards,

    Rynbef~

  3. @wornim sorry I'm not able to test the script cause I just have my mobile phone. If it yet won't works I'll give up. I just want to help.

    Spoiler
    /*
    rAthena Script
    Author: @Rynbef
    Create Date: 2021-19-12
    Last Updated: 2022-01-01
    
    Changelogs:
        2022-01-01:
            *changed OnNPCLoadEvent to OnNPCKillEvent
            *added check if killed enemie is player
            *removed space on callfunc after OnNPCKillEvent
            *fixed if statement syntax error
            *fixed if statement getarraysize of integer to getarraysize of specified getarg
            *removed callfunc OnInit
            *added console debugging can be disabled or enabled
            *changed variable types
            *fixed cant get item cause of wrong if statement
            *fixed for loop used array size instead random chance from argument getarg(3)
            *fixed player can't get item if random chance was equals to specified item chance
            *added argument amount to debug message
            *added map notification if player get lucky but not on a listed map. This can disabled or enabled seperat at OnInit below. Debugging needs to be enabled
            *added notification if everything works fine. Can be disabled or enabled on bottom of OnInit. Debugging needs to disabled
            #fixed wrong array output in for loop from getarg(0)[.i] to getelementofarray(getarg(0),.i)
            #changed .retval and .i vsriables to scope variables [email protected] and [email protected]
    
    Feature planned:
        #Player get zeny if he get lucky
        #Player get zeny only if items disabled
        #Player get zeny or item if both enabled
    
    Description:
        Give a specified item getarg(1) of amount getarg(2) on specified map getarg(0) with a percentage of getarg(3) (0.1 to 100 percent) to a player
        
    IMPORTANT:
        All arrays needs to have the same sizes
        It's importent to set all 3 arguments to callfunc
    
    Terms:
        Dont name this as yours
        Dont sell this script
        Dont upload this script on download-/s section or share it otherwise for pay
        Modifications are included from this terms
        Otherwise feel free to edit
    
    Other:
        Don't hestiate to contact me at the forum as pm if u've any error,question,suggestion or want a modification
    
    Script:
    */
    
    -   script  GetItemByMap    -1,{
    
    OnNPCKillEvent:
        if(killedrid >= 150000)
            end;
        set [email protected],callfunc("F_GetItemByMap",[email protected]$,[email protected],[email protected]_amounts,[email protected]_chance);
        if([email protected])
            end;
        if([email protected] == 1)
            debugmes "[F_GetItemByMap]: Works fine! Player get item.";
        else if([email protected] == 2)
            debugmes "[F_GetItemByMap]: Works fine! Player is unlucky and get no item.";
        else if([email protected] == 3 && [email protected])
            debugmes "[F_GetItemByMap]: Player isn't on a listed map. Current map: "+strcharinfo(3);
        else if([email protected] == 4 && [email protected])
            debugmes "[F_GetItemByMap]: Everything works fine!";
        else
            debugmes "[F_GetItemByMap]: Causes in errors. Debug logs on top!";
        end;
    
    OnInit:
        setarray [email protected]$[0],"prontera","alberta","izlude";
        serarray [email protected][0],501,4012,512;
        setarray [email protected]_amounts[0],100,1,5;
        setarray [email protected]_chance[0],1000,500,800;//Chance begins by 0.1 percentage. 1 = 0.1 and 1000 = 100 percent
        set [email protected],1;//0 = disable debugging,1 = enable
        set [email protected],1;//0 = disable map notification,1 = enable
        set [email protected],1;//0 = disable notification if everything works fine,1 = enable
        end;
    }
    
    function    script    F_GetItemByMap    {
    
    if(getarg(0) != "" || !getarg(1) || !getarg(2) || !getarg(3) || getarraysize(getarg(0)) != getarraysize(getarg(1)) || getarraysize(getarg(0)) != getarraysize(getarg(2)) || getarraysize(getarg(0)) != getarraysize(getarg(3))){
        if([email protected]){
            debugmes "[F_GetItemByMap]: An error is occurupted";
            debugmes "[Function arguments]: Function arguments are empty or to short. Arguments: "+getargcount();
            debugmes "[Array sizes]: Maps:"+getarraysize(getarg(0))+" - Items:"+getarraysize(getarg(1))+" - Amounts:"+getarraysize(getarg(2))+" - Chances:"+getarraysize(getarg(3));
            debugmes "[Function arguments]: Maps:"+getarg(0)+" - Items:"+getarg(1)+" - Amounts:"+getarg(2)+" - Chances:"+getarg(3);
        }
        return 0;
    } else {
        for([email protected] = 0; [email protected]<getarraysize(getarg(0)); [email protected]++){
            if(rand(1,1000) < getelementofarray(getarg(3),[email protected]))
                return 2;
            if(strcharinfo(3) == getelementofarray(getarg(0),[email protected])){
                getitem getelementofarray(getarg(1),[email protected]),getelementofarray(getarg(2),[email protected]);
                return 1;
            } else {
                return 3;
            }
        }
        }
        return 4;
        
    OnInit:
        set [email protected],1;//0 = disable debugging,1 = enable
        end;
    }

    Download file below

    getItemByMapFunction v6.txt

     

    Rynbef~

  4. @sader1992I now understand what u mean. I've improved it now. The function is if someone whould call it another way.

    @worn

    Spoiler
    /*
    rAthena Script
    Author: @Rynbef
    Create Date: 2021-19-12
    Last Updated: 2022-01-01
    
    Changelogs:
        2022-01-01:
            *changed OnNPCLoadEvent to OnNPCKillEvent
            *added check if killed enemie is player
            *removed space on callfunc after OnNPCKillEvent
            *fixed if statement syntax error
            *fixed if statement getarraysize of integer to getarraysize of specified getarg
            *removed callfunc OnInit
            *added console debugging can be disabled or enabled
            *changed variable types
            *fixed cant get item cause of wrong if statement
            *fixed for loop used array size instead random chance from argument getarg(3)
            *fixed player can't get item if random chance was equals to specified item chance
            *added argument amount to debug message
            *added map notification if player get lucky but not on a listed map. This can disabled or enabled seperat at OnInit below. Debugging needs to be enabled
            *added notification if everything works fine. Can be disabled or enabled on bottom of OnInit. Debugging needs to disabled
            #fixed wrong array output in for loop from getarg(0)[.i] to getelementofarray(getarg(0),.i)
            #changed .retval and .i vsriables to scope variables [email protected] and [email protected]
    
    Feature planned:
        #Player get zeny if he get lucky
        #Player get zeny only if items disabled
        #Player get zeny or item if both enabled
    
    Description:
        Give a specified item getarg(1) of amount getarg(2) on specified map getarg(0) with a percentage of getarg(3) (0.1 to 100 percent) to a player
        
    IMPORTANT:
        All arrays needs to have the same sizes
        It's importent to set all 3 arguments to callfunc
    
    Terms:
        Dont name this as yours
        Dont sell this script
        Dont upload this script on download-/s section or share it otherwise for pay
        Modifications are included from this terms
        Otherwise feel free to edit
    
    Other:
        Don't hestiate to contact me at the forum as pm if u've any error,question,suggestion or want a modification
    
    Script:
    */
    
    -   script  GetItemByMap    -1,{
    
    OnNPCKillEvent:
        if(killedrid >= 150000)
            end;
        set [email protected],callfunc("F_GetItemByMap",[email protected]$,[email protected],[email protected]_amounts);
        if([email protected])
            end;
        if([email protected] == 1)
            debugmes "[F_GetItemByMap]: Works fine! Player get item.";
        else if([email protected] == 2)
            debugmes "[F_GetItemByMap]: Works fine! Player is unlucky and get no item.";
        else if([email protected] == 3 && [email protected])
            debugmes "[F_GetItemByMap]: Player isn't on a listed map. Current map: "+strcharinfo(3);
        else if([email protected] == 4 && [email protected])
            debugmes "[F_GetItemByMap]: Everything works fine!";
        else
            debugmes "[F_GetItemByMap]: Causes in errors. Debug logs on top!";
        end;
    
    OnInit:
        setarray [email protected]$[0],"prontera","alberta","izlude";
        serarray [email protected][0],501,4012,512;
        setarray [email protected]_amounts[0],100,1,5;
        setarray [email protected]_chance[0],1000,500,800;//Chance begins by 0.1 percentage. 1 = 0.1 and 1000 = 100 percent
        set [email protected],1;//0 = disable debugging,1 = enable
        set [email protected],1;//0 = disable map notification,1 = enable
        set [email protected],1;//0 = disable notification if everything works fine,1 = enable
        end;
    }
    
    function    script    F_GetItemByMap    {
    
    if(!getarg(0) || !getarg(1) || !getarg(2) || !getarg(3) || getarraysize(getarg(0)) != getarraysize(getarg(1)) || getarraysize(getarg(0)) != getarraysize(getarg(2)) || getarraysize(getarg(0)) != getarraysize(getarg(3))){
        if([email protected]){
            debugmes "[F_GetItemByMap]: An error is occurupted";
            debugmes "[Function arguments]: Function arguments are empty or to short. Arguments: "+getargcount();
            debugmes "[Array sizes]: Maps:"+getarraysize(getarg(0))+" - Items:"+getarraysize(getarg(1))+" - Amounts:"+getarraysize(getarg(2))+" - Chances:"+getarraysize(getarg(3));
            debugmes "[Function arguments]: Maps:"+getarg(0)+" - Items:"+getarg(1)+" - Amounts:"+getarg(2)+" - Chances:"+getarg(3);
        }
        return 0;
    } else {
        for([email protected] = 0; [email protected]<getarraysize(getarg(0)); [email protected]++){
            if(rand(1,1000) < getelementofarray(getarg(3),[email protected]))
                return 2;
            if(strcharinfo(3) == getelementofarray(getarg(0),[email protected])){
                getitem getelementofarray(getarg(1),[email protected]),getelementofarray(getarg(2),[email protected]);
                return 1;
            } else {
                return 3;
            }
        }
        }
        return 4;
        
    OnInit:
        set [email protected],1;//0 = disable debugging,1 = enable
        end;
    }

    Download file below

    getItemByMapFunction v5.txt

     

    Rynbef~

  5. @powkdaEvery line will end with a semicolon therefore the 2nd bonus failed. U only able to write bonuses in one line at an item script. 

     

    function    script  F_Excalibur {
    
        if(agitcheck() || agitcheck2() || agitcheck3()){
            bonus bBaseAtk,2600;
        } else {
            bonus bBaseAtk,2600;
            bonus2 bHPDrainRate,1000,100;
        }
        end;
    }
    	

     

    Rynbef~

     

  6. @sader1992I think u means to change to scope variables. Next time I bet u to tell me what u mean.

    Spoiler
    /*
    rAthena Script
    Author: @Rynbef
    Create Date: 2021-19-12
    Last Updated: 2022-01-01
    
    Changelogs:
        2022-01-01:
            *changed OnNPCLoadEvent to OnNPCKillEvent
            *added check if killed enemie is player
            *removed space on callfunc after OnNPCKillEvent
            *fixed if statement syntax error
            *fixed if statement getarraysize of integer to getarraysize of specified getarg
            *removed callfunc OnInit
            *added console debugging can be disabled or enabled
            *changed variable types
            *fixed cant get item cause of wrong if statement
            *fixed for loop used array size instead random chance from argument getarg(3)
            *fixed player can't get item if random chance was equals to specified item chance
            *added argument amount to debug message
            *added map notification if player get lucky but not on a listed map. This can disabled or enabled seperat at OnInit below. Debugging needs to be enabled
            *added notification if everything works fine. Can be disabled or enabled on bottom of OnInit. Debugging needs to disabled
            #fixed wrong array output in for loop from getarg(0)[.i] to getelementofarray(getarg(0),.i)
            #changed .retval and .i vsriables to scope variables [email protected] and [email protected]
    
    Feature planned:
        #Player get zeny if he get lucky
        #Player get zeny only if items disabled
        #Player get zeny or item if both enabled
    
    Description:
        Give a specified item getarg(1) of amount getarg(2) on specified map getarg(0) with a percentage of getarg(3) (0.1 to 100 percent) to a player
        
    IMPORTANT:
        All arrays needs to have the same sizes
        It's importent to set all 3 arguments to callfunc
    
    Terms:
        Dont name this as yours
        Dont sell this script
        Dont upload this script on download-/s section or share it otherwise for pay
        Modifications are included from this terms
        Otherwise feel free to edit
    
    Other:
        Don't hestiate to contact me at the forum as pm if u've any error,question,suggestion or want a modification
    
    Script:
    */
    
    -   script  GetItemByMap    -1,{
    
    OnNPCKillEvent:
        if(killedrid >= 150000)
            end;
        set [email protected],callfunc("F_GetItemByMap",[email protected]$,[email protected],[email protected]_amounts);
        if([email protected])
            end;
        if([email protected] == 1)
            debugmes "[F_GetItemByMap]: Works fine! Player get item.";
        else if([email protected] == 2)
            debugmes "[F_GetItemByMap]: Works fine! Player is unlucky and get no item.";
        else if([email protected] == 3 && [email protected])
            debugmes "[F_GetItemByMap]: Player isn't on a listed map. Current map: "+strcharinfo(3);
        else if([email protected] == 4 && [email protected])
            debugmes "[F_GetItemByMap]: Everything works fine!";
        else
            debugmes "[F_GetItemByMap]: Causes in errors. Debug logs on top!";
        end;
    
    OnInit:
        setarray [email protected]$[0],"prontera","alberta","izlude";
        serarray [email protected][0],501,4012,512;
        setarray [email protected]_amounts[0],100,1,5;
        setarray [email protected]_chance[0],1000,500,800;//Chance begins by 0.1 percentage. 1 = 0.1 and 1000 = 100 percent
        set [email protected],1;//0 = disable debugging,1 = enable
        set [email protected],1;//0 = disable map notification,1 = enable
        set [email protected],1;//0 = disable notification if everything works fine,1 = enable
        end;
    }
    
    function    script    F_GetItemByMap    {
    
    if(!getarg(0) || !getarg(1) || !getarg(2) || !getarg(3) || getarraysize(getarg(0)) != getarraysize(getarg(1)) || getarraysize(getarg(0)) != getarraysize(getarg(2)) || getarraysize(getarg(0)) != getarraysize(getarg(3))){
        if([email protected]){
            debugmes "[F_GetItemByMap]: An error is occurupted";
            debugmes "[Function arguments]: Function arguments are empty or to short. Arguments: "+getargcount();
            debugmes "[Array sizes]: Maps:"+getarraysize(getarg(0))+" - Items:"+getarraysize(getarg(1))+" - Amounts:"+getarraysize(getarg(2))+" - Chances:"+getarraysize(getarg(3));
            debugmes "[Function arguments]: Maps:"+getarg(0)+" - Items:"+getarg(1)+" - Amounts:"+getarg(2)+" - Chances:"+getarg(3);
        }
        return 0;
    } else {
        for([email protected] = 0; [email protected]<getarraysize(getarg(0)); [email protected]++){
            if(rand(1,1000) < getelementofarray(getarg(3),[email protected]))
                return 2;
            if(strcharinfo(3) == getelementofarray(getarg(0),[email protected])){
                getitem getelementofarray(getarg(1),[email protected]),getelementofarray(getarg(2),[email protected]);
                return 1;
            } else if([email protected]){
                return 3;
            }
        }
        }
        return 4;
    }

    Download is attached bellow

     

    getItemByMapFunction v4.txt

     

    Rynbef~

  7. @wornThis should fix the error.

    /*
    rAthena Script
    Author: @Rynbef
    Create Date: 2021-19-12
    Last Updated: 2022-01-01
    
    Changelogs:
        2022-01-01:
            *changed OnNPCLoadEvent to OnNPCKillEvent
            *added check if killed enemie is player
            *removed space on callfunc after OnNPCKillEvent
            *fixed if statement syntax error
            *fixed if statement getarraysize of integer to getarraysize of specified getarg
            *removed callfunc OnInit
            *added console debugging can be disabled or enabled
            *changed variable types
            *fixed cant get item cause of wrong if statement
            *fixed for loop used array size instead random chance from argument getarg(3)
            *fixed player can't get item if random chance was equals to specified item chance
            *added argument amount to debug message
            *added map notification if player get lucky but not on a listed map. This can disabled or enabled seperat at OnInit below. Debugging needs to be enabled
            *added notification if everything works fine. Can be disabled or enabled on bottom of OnInit. Debugging needs to disabled
    
    Feature planned:
        #Player get zeny if he get lucky
        #Player get zeny only if items disabled
        #Player get zeny or item if both enabled
    
    Description:
        Give a specified item getarg(1) of amount getarg(2) on specified map getarg(0) with a percentage of getarg(3) (0.1 to 100 percent) to a player
        
    IMPORTANT:
        All arrays needs to have the same sizes
        It's importent to set all 3 arguments to callfunc
    
    Terms:
        Dont name this as yours
        Dont sell this script
        Dont upload this script on download-/s section or share it otherwise for pay
        Modifications are included from this terms
        Otherwise feel free to edit
    
    Other:
        Don't hestiate to contact me at the forum as pm if u've any error,question,suggestion or want a modification
    
    Script:
    */
    
    -   script  GetItemByMap    -1,{
    
    OnNPCKillEvent:
        if(killedrid >= 150000)
            end;
        set .retval,callfunc("F_GetItemByMap",[email protected]$,[email protected],[email protected]_amounts);
        if([email protected])
            end;
        if(.retval == 1)
            debugmes "[F_GetItemByMap]: Works fine! Player get item.";
        else if(.retval == 2)
            debugmes "[F_GetItemByMap]: Works fine! Player is unlucky and get no item.";
        else if(.retval == 3 && [email protected])
            debugmes "[F_GetItemByMap]: Player isn't on a listed map. Current map: "+strcharinfo(3);
        else if(.retval == 4 && [email protected])
            debugmes "[F_GetItemByMap]: Everything works fine!";
        else
            debugmes "[F_GetItemByMap]: Causes in errors. Debug logs on top!";
        end;
    
    OnInit:
        setarray [email protected]$[0],"prontera","alberta","izlude";
        serarray [email protected][0],501,4012,512;
        setarray [email protected]_amounts[0],100,1,5;
        setarray [email protected]_chance[0],1000,500,800;//Chance begins by 0.1 percentage. 1 = 0.1 and 1000 = 100 percent
        set [email protected],1;//0 = disable debugging,1 = enable
        set [email protected],1;//0 = disable map notification,1 = enable
        set [email protected],1;//0 = disable notification if everything works fine,1 = enable
        end;
    }
    
    function    script    F_GetItemByMap    {
    
    if(!getarg(0) || !getarg(1) || !getarg(2) || !getarg(3) || getarraysize(getarg(0)) != getarraysize(getarg(1)) || getarraysize(getarg(0)) != getarraysize(getarg(2)) || getarraysize(getarg(0)) != getarraysize(getarg(3))){
        if([email protected]){
            debugmes "[F_GetItemByMap]: An error is occurupted";
            debugmes "[Function arguments]: Function arguments are empty or to short. Arguments: "+getargcount();
            debugmes "[Array sizes]: Maps:"+getarraysize(getarg(0))+" - Items:"+getarraysize(getarg(1))+" - Amounts:"+getarraysize(getarg(2))+" - Chances:"+getarraysize(getarg(3));
            debugmes "[Function arguments]: Maps:"+getarg(0)+" - Items:"+getarg(1)+" - Amounts:"+getarg(2)+" - Chances:"+getarg(3);
        }
        return 0;
    } else {
        for(.i = 0; .i<getarraysize(getarg(0)); .i++){
            if(rand(1,1000) < getelementofarray(getarg(3),.i))
                return 2;
            if(strcharinfo(3) == getelementofarray(getarg(0),.i)){
                getitem getelementofarray(getarg(1),.i),getelementofarray(getarg(2),.i);
                return 1;
            } else if([email protected]){
                return 3;
            }
        }
        }
        return 4;
    }

     

    getItemByMapFunction v3.txt

     

    Rynbef~

  8. Just now, worn said:

    in this case it would be for all maps correct? I would like to put on some maps just not all

    example in pay_dun04 I want to drop x item on any monster that is killed on the map native monsters even on the map already in lhz I want another item to drop in all monsters on the map and so on with a percentage at the time of the drop, in addition to gaining the standard mob drops

    @wornthat's exactly what I've scripted.

     

    Rynbef~

  9. I've found a way to check the screenshots. I've updated today and added a changelog. 

    NOTE: U don't need loadevent. U now can/should remove it. 

    Just to say: I've written this script with my smartphone and therefore no way to test it.

    Spoiler
    /*
    rAthena Script
    Author: @Rynbef
    Create Date: 2021-19-12
    Last Updated: 2022-01-01
    
    Changelogs:
        2022-01-01:
            *changed OnNPCLoadEvent to OnNPCKillEvent
            *added check if killed enemie is player
            *removed space on callfunc after OnNPCKillEvent
            *fixed if statement syntax error
            *fixed if statement getarraysize of integer to getarraysize of specified getarg
            *removed callfunc OnInit
            *added console debugging can be disabled or enabled
            *changed variable types
            *fixed cant get item cause of wrong if statement
            *fixed for loop used array size instead random chance from argument getarg(3)
            *fixed player can't get item if random chance was equals to specified item chance
            *added argument amount to debug message
            *added map notification if player get lucky but not on a listed map. This can disabled or enabled seperat at OnInit below. Debugging needs to be enabled
            *added notification if everything works fine. Can be disabled or enabled on bottom of OnInit. Debugging needs to disabled
    
    Feature planned:
        #Player get zeny if he get lucky
        #Player get zeny only if items disabled
        #Player get zeny or item if both enabled
    
    Description:
        Give a specified item getarg(1) of amount getarg(2) on specified map getarg(0) with a percentage of getarg(3) (0.1 to 100 percent) to a player
        
    IMPORTANT:
        All arrays needs to have the same sizes
        It's importent to set all 3 arguments to callfunc
    
    Terms:
        Dont name this as yours
        Dont sell this script
        Dont upload this script on download-/s section or share it otherwise for pay
        Modifications are included from this terms
        Otherwise feel free to edit
    
    Other:
        Don't hestiate to contact me at the forum as pm if u've any error,question,suggestion or want a modification
    
    Script:
    */
    
    -   script  GetItemByMap    -1,{
    
    OnNPCKillEvent:
        if(killedrid >= 150000)
            end;
        set .retval,callfunc("F_GetItemByMap",[email protected]$,[email protected],[email protected]_amounts);
        if([email protected])
            end;
        if(.retval == 1)
            debugmes "[F_GetItemByMap]: Works fine! Player get item.";
        else if(.retval == 2)
            debugmes "[F_GetItemByMap]: Works fine! Player is unlucky and get no item.";
        else if(.retval == 3 && [email protected])
            debugmes "[F_GetItemByMap]: Player isn't on a listed map. Current map: "+strcharinfo(3);
        else if(.retval == 4 && [email protected])
            debugmes "[F_GetItemByMap]: Everything works fine!";
        else
            debugmes "[F_GetItemByMap]: Causes in errors. Debug logs on top!";
        end;
    
    OnInit:
        setarray [email protected]$[0],"prontera","alberta","izlude";
        serarray [email protected][0],501,4012,512;
        setarray [email protected]_amounts[0],100,1,5;
        setarray [email protected]_chance[0],1000,500,800;//Chance begins by 0.1 percentage. 1 = 0.1 and 1000 = 100 percent
        set [email protected],1;//0 = disable debugging,1 = enable
        set [email protected],1;//0 = disable map notification,1 = enable
        set [email protected],1;//0 = disable notification if everything works fine,1 = enable
        end;
    }
    
    function    script    F_GetItemByMap    {
    
    if(!getarg(0) || !getarg(1) || !getarg(2) || !getarg(3) || getarraysize(getarg(0)) != getarraysize(getarg(1)) || getarraysize(getarg(0)) != getarraysize(getarg(2)) || getarraysize(getarg(0)) != getarraysize(getarg(3))){
        if([email protected]){
            debugmes "[F_GetItemByMap]: An error is occurupted";
            debugmes "[Function arguments]: Function arguments are empty or to short. Arguments: "+getargcount();
            debugmes "[Array sizes]: Maps:"+getarraysize(getarg(0))+" - Items:"+getarraysize(getarg(1))+" - Amounts:"+getarraysize(getarg(2))+" - Chances:"+getarraysize(getarg(3));
            debugmes "[Function arguments]: Maps:"+getarg(0)+" - Items:"+getarg(1)+" - Amounts:"+getarg(2)+" - Chances:"+getarg(3);
        }
        return 0;
    } else {
        for(.i = 0; .i<getarraysize(getarg(0)); .i++){
            if(rand(1,1000) < getarg(3)[.i])
                return 2;
            if(strcharinfo(3) == getarg(0)[.i]){
                getitem getarg(1)[.i],getarg(2)[.i];
                return 1;
            } else if([email protected]){
                return 3;
            }
        }
        }
        return 4;
    }

    I'll attach a downloadable file too

    getItemByMapFunction v2.txt

    I hope this helps u and will works fine now.

     

    Rynbef~

  10. I hope I can help u with my script I've written for u. It's a few time ago after I had an own server. The script isn't tested. 

    /*
    rAthena Script
    Author: @Rynbef
    Date: 2021-19-12
    
    Information:
        Dont forget to set "loadevent" mapflag for each map you will use this function
    
    Description:
        Give a specified item (getarg(1)) of amount getarg(2) on specified map getarg(0) with a percentage of getarg(3) (0.1 to 100 percent)
    
    Terms:
        Dont name this as yours
        Dont sell this script
        Dont upload this script on download-/s section
        Otherwise feel free to edit or contact me as pm
    
    Example:
    */
    -   script  GetItemByMap    -1,{
    
    OnNPCLoadEvent:
        set .retval,callfunc ("F_GetItemByMap",$#maps$,$#items,$#item_amounts);
        //You can debug if it causes error or not
        if(.retval == 1)
            debugmes "[F_GetItemByMap]: Works fine! Player get item.";
        else if(.retval == 2)
            debugmes "[F_GetItemByMap]: Works fine! Player is unlucky and get no item.";
        else
            debugmes "[F_GetItemByMap]: Causes in errors. Debug logs below!";
        end;
    
    OnInit:
        setarray $#maps$[0],"prontera","alberta","izlude";
        serarray $#items[0],501,4012,512;
        setarray $#item_amounts[0],100,1,5;
        setarray $#item_chance[0],1000,500,800;//Chance begins by 0.1 percentage. 1 = 0.1 and 1000 = 100 percent
        callfunc($#maps$,$#items,$#item_amounts,$#item_chance);
        end;
    }
    
    function    script    F_GetItemByMap    {
    
    if(((!getarg(0) || !getarg(1) || !getarg(2))) || ((getarraysize(getarg(0)) != getarraysize(getarg(1))) ||(getarraysize(getarg(0)) != getarraysize(2)) || (getarraysize(0)) != getarraysize(3))){
        debugmes "[F_GetItemByMap]: An error is occurupted";
        debugmes "[Function arguments]: Function arguments are empty or to short.";
        debugmes "[Array sizes]: Maps:"+getarraysize(getarg(0))+" - Items:"+getarraysize(getarg(1))+" - Amounts:"+getarraysize(getarg(2))+" - Chances:"+getarg(3);
        debugmes "[Function arguments]: Maps:"+getarg(0)+" - Items:"+getarg(1)+" - Amounts:"+getarg(2)+" - Chances:"+getarg(3);
        return 0;
    } else {
        for([email protected],0; getarraysize(getarg(0); [email protected]++){
            if(rand(1,1000) <= (getarraysize(getarg(3))-1)){
                debugmes "[F_GetItemByMap]: The player doesnt get item because hes an unlucky player";
                if(strcharinfo(3) == getarg(0)[[email protected]])
                    getitem getarg(1)[[email protected]],getarg(2)[[email protected]];
                return 1;
            }
            return 2;
          }
        }
    }
        set .retval,callfunc ("F_GetItemByMap",$#maps$,$#items,$#item_amounts);
        //You can debug if it causes error or not
        if(.retval == 1)
            debugmes "[F_GetItemByMap]: Works fine! Player get item."
        else if(.retval == 2)
            debugmes "[F_GetItemByMap]: Works fine! Player is unlucky and get no item."
        else
            debugmes "[F_GetItemByMap]: Causes in errors. Debug logs below!"
        end;
    
    OnInit:
        setarray $#maps$[0],"prontera","alberta","izlude";
        serarray $#items[0],501,4012,512;
        setarray $#item_amounts[0],100,1,5;
        setarray $#item_chance[0],1000,500,800;//Chance begins by 0.1 percentage. 1 = 0.1 and 1000 = 100 percent
        callfunc($#maps$,$#items,$#item_amounts,$#item_chance);
        end;
    }
    
    function    script    F_GetItemByMap    {
    
    if(((!getarg(0) || !getarg(1) || !getarg(2))) || ((getarraysize(getarg(0)) != getarraysize(getarg(1))) ||(getarraysize(getarg(0)) != getarraysize(2)) || (getarraysize(0)) != getarraysize(3))){
        debugmes "[F_Inarray]: Function arguments are empty or to short.";
        debugmes "[Array sizes]: Maps:"+getarraysize(getarg(0))+" - Items:"+getarraysize(getarg(1))+" - Amounts:"+getarraysize(getarg(2))+" - Chances:"+getarg(3);
        debugmes "[Function arrguments]: Maps:"+getarg(0)+" - Items:"+getarg(1)+" - Amounts:"+getarg(2)+" - Chances:"+getarg(3);
        return 0;
    } else {
        for([email protected],0; getarraysize(getarg(0); [email protected]++){
            if(rand(1,1000) <= (getarraysize(getarg(3))-1)){
                debugmes "[F_GetItemByMap]: The player doesnt get item because hes an unlucky player";
                if(strcharinfo(3) == getarg(0)[[email protected]])
                    getitem getarg(1)[[email protected]],getarg(2)[[email protected]];
                return 1;
            }
            return 2;
          }
        }
    }

     

    Rynbef~

  11. 1 hour ago, pazaway12 said:

    Please help, why context menu doesn't work/show even when i enable it in Setting?

    Im using Windows 10 Pro 21H1 64bit Operating System image.thumb.png.8ce13989f99b1d3d50be1d6ddb81cbe9.png

     

    UPDATE: I did manage to add Context Menu, now it show this error when i try to compress a folder to .grfimage.png.b6e25e9ae8fd34324248b008d2447694.png

    Try to run as administrator

     

    Greetings,

    Rynbef~

  12. Yes it's not really complicated. U can check if the killed mob is a boss monster or a monster of a list/an array. Save the mob ID of the latest monster u've attacked and the dealt damage in an array. Than OnPCKillEvent check if this monster u've killed is the monster u've attacked before. Than u can save ur dealt damage in a database. Later u can sort the damage by "highest first" and u have ur ranking. U can update a database entry which structure is like: "Char ID, Latest Mob ID, Latest Dealt Dmg, Total Dealt Dmg, Create Date, Latest Update Date" or u can use the account ID to combine the Dmg of all characters of an account. 

     

    Rynbef~

  13. Write a DLL File and inject it to ur client. That catch the login Paket sending and change it before u send it. After this u Can use Thread.sleep (C#) to wait like u said 60 sec. After this build a new packet and send it to the server by using the client function. U can easily find out how the structure needs to be. Look at the Doc of ur server.

    If I don't know what u are doing, the guard will easily bypassable.

     

    Rynbef~

  14. Maybe this is what ur looking for:

    *getiteminfo(<item ID<type>)
       
      This function will look up the item with the specified ID number in the database
      and return the info set by TYPE argument.
      It will return -1 if there is no such item.
       
      Valid types are:
      0 - Buy Price
      1 - Sell Price
      2 - Type
      3 - maxchance (max drop chance of this item, e.g. 1 = 0.01%)
      if = 0, then monsters don't drop it at all (rare or a quest item)
      if = 10000, then this item is sold in NPC shops only
      4 - Gender
      5 - Loc
      6 - Weight
      7 - ATK
      8 - DEF
      9 - Range
      10 - Slot
      11 - View
      12 - eLV
      13 - wLV
      14 - SpriteID from 'db/item_avail.txt'
      15 - eLVMax
      16 - matk if RENEWAL is defined
     
×
×
  • Create New...

Important Information

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