Jump to content
  • 0

Know / modify the win rate


Question

Posted (edited)

Hello !

I use npc on my server and i would like to know and modify the rate of winning an item please. 
Thanks you 

z_agit,16,108,6    script    PC Machine#machine1    563,{
    callfunc "function-ckj";
    end;
OnInit:
    setarray $@SPgr,7773,25;
    setarray $@Swnm,20506,19602,19603,19604,24196,24208,24210,24212,0,0,0,0,0,0,0,0,0,0,0,0;
    setarray $@Swnn,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0;
    setarray $@SRT,100,100,100,100,100,100,100,100,0,0,0,0,0,0,0,0,0,0,0,0;
    setarray $@Slg$,"-A","-B","-C","-D","-E","-F","-G","-H","-I","-J","-K","-L","-M","-N","-O","-P","-Q","-R","-S","-T";
    end;
}
function    script    function-ckj    {
    function ckz {
        for(;.@i<getarraysize($@SRT);set .@i,.@i+1){
            set .@sum,.@sum + $@SRT[.@i];
        }
        set .@rnd,rand(1,.@sum);
        for(;.@rnd>0;set .@l,.@l+1) set .@rnd,.@rnd-$@SRT[.@l];
        return $@Slg$[.@l-1];
    }
    function ss {
        for(set .@i,getarg(0);.@i>0;set .@i,.@i-1)set .@h$,.@h$+getarg(1);
        return .@h$;
    }
    function    semes    {
        function RandColor {
            function Zui {
                for(set .@i,getarg(0);.@i;set .@i,.@i-1)set .@h$,.@h$+getarg(1);
                return .@h$;
            }
            function itoax {
                if(!getarg(0))return "";
                setarray .@fgd$[10],"A","B","C","D","E";
                return itoax(getarg(0)/16)+(set(.@ty,getarg(0)%16)<10?.@ty:(.@fgd$[.@ty]==""?"F":.@fgd$[.@ty]));
            }
            return Zui(2-getstrlen(itoax(set(.@R,rand(getarg(0,0)%256,getarg(1,255)%256)))),"0")+itoax(.@R)+Zui(2-getstrlen(itoax(set(.@G,rand(getarg(2,0)%256,getarg(3,255)%256)))),"0")+itoax(.@G)+Zui(2-getstrlen(itoax(set(.@B,rand(getarg(4,0)%256,getarg(5,255)%256)))),"0")+itoax(.@B);
        }
        set .@p$,"^" +RandColor();
        set .@p2$,.@p$+ "========================";
        set .@p3$,(@pc3?"^FF0000":"^FFFFFF");
        set .@p5$,.@p$ +"==^000000";
        mes .@p2$;
        mes .@p5$+"____________________" +.@p$+"==";
        mes .@p5$+"|(   v    v    v  )|" +.@p$+"==";
        mes .@p5$+"|> ^66CCFF" + @game_1$ + "^000000 | ^66CCFF" + @game_2$ + "^000000 | ^66CCFF" + @game_3$ + "^000000   <|" +.@p$+"==";
        mes .@p5$+"|(   ^    ^    ^  )|" +.@p$+"==";
        mes .@p5$+"____________________" +.@p$+"==";
        mes .@p2$;
    }
    mes "Need^FF0000 " + getitemname($@SPgr[0]) + "^000000 x ^000088" + $@SPgr[1] + "^000000";
    mes "Reward(list)";
    for(set .@i,0; .@i < getarraysize($@Swnm); set .@i,.@i + 1){
        mes " ^993300"+getitemname($@Swnm[.@i])+ss((15-getstrlen(getitemname($@Swnm[.@i]))),"")+"^000000 x ^000088"+$@Swnn[.@i];
    }
    next;
    switch(select("^0000FFJoin","^00FF00Leave")){
        case 1:
            goto game;
        case 2:
            close;
        }

    game:
        next;
        if(countitem($@SPgr[0])<$@SPgr[1]){ dispbottom "You don't have "+getitemname($@SPgr[0])+"x"+$@SPgr[1]; close; }
        delitem $@SPgr[0],$@SPgr[1];
        set @game_1$,"  ";
        set @game_2$,"  ";
        set @game_3$,"  ";
        set @pc3,0;
        set .@h$,"";
        set .@sum,0;
        semes();
        next;
        select("[Trolley]");
        set .@qc,0;
        while(.@qc<3){
            set .@qc,.@qc+1;
            setd "@game_"+.@qc+"$",ckz();
            if(.@qc>1&&getd("@game_"+.@qc+"$")!=getd("@game_"+(.@qc-1)+"$")){setd "@game_"+.@qc+"$",ckz();}
            semes();
            next;
        }
        set .@p3,0;
        if(@game_1$==@game_2$&&@game_1$==@game_3$){set @pc3,1;}
        semes();
        if(@pc3){
            for(set .@i,0;.@i<getarraysize($@Swnm);set .@i,.@i+1){
                if(@game_1$==$@Slg$[.@i]&&$@Swnm[.@i]){
                    getitem $@Swnm[.@i],$@Swnn[.@i];
                }
            }
        }
        if(select("Again","Leave")==1) goto game;
        close;
}


 

Edited by Emistry
codebox

1 answer to this question

Recommended Posts

  • 0
Posted
setarray $@SRT,100,100,100,100,100,100,100,100,0,0,0,0,0,0,0,0,0,0,0,0;

increase/decrease the value ..... 

(value / sum_of_value * 100%) = your rate

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...