Jump to content

Omnipotent

Members
  • Posts

    71
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Omnipotent

  1. What question do I have to use to replace this one?

    prontera,100,100,4    script    Healer    100,{
    
    
    
        set .@delay, 5 * 60;    // delay (seconds).
    
    
    
        set .@t0, gettimetick ( 2 ) - delay;
    
        set .@t1, .@delay - .@t0;
    
        if ( .@t < .@delay )
    
            mes "You have to wait "+ .@t1 +" seconds before heal again";
    
        else
    
        {
    
            if ( HP + SP == MaxHP + MaxSP )
    
                mes "You do not look like a person in pain.";
    
            else
    
            {
    
                while ( .@i < 3 )
    
                {
    
                    set .@hp, MaxHP - HP;
    
                    set .@sp, ((MaxSP - SP) * BaseLevel) / 5;
    
                    set .@cost, .@hp + .@sp;
    
                    if ( .@hp > 0 )
    
                        mes "Heal price: ^ff0000"+ .@hp +"^000000 z";
    
                    if ( .@sp > 0 )
    
                        mes "SP Restoration price: ^0000ff"+ .@sp +"^000000 z";
    
                    if ( .@cost > .@hp || .@cost > .@sp )
    
                        mes "Both: ^00ff00"+ .@cost +"^000000 z";
    
                    next ;
    
                    set .@i, select ( ( (.@hp > 0) ? ( (.@o & 1) ? "^00ff00" : "^ff0000")Heal" ? "" ) +":"+ ( (.@sp > 0) ? ( (.@o & 2) ? "^00ff00" : "^ff0000")SP Restoration" ? "" ):Heal ("+ ( (zeny < .@c)?"^ff0000":"^0000ff") + .@c +" zeny):Exit");
    
                    set .@o, .@o | .@i;
    
                    set .@c, ((.@o & 1) * .@hp) + ((.@o&2) * .@sp);
    
                }
    
                if ( .@i == 3 )
    
                {
    
                    if ( zeny < .@c )
    
                        mes "You don't have enough zeny";
    
                    else
    
                    {
    
                        percentheal 100 * (.@o & 1), 100 * (.@o & 2);
    
                        set zeny, zeny - .@c;
    
                        set delay, gettimetick ( 2 );
    
                    }
    
                }
    
            }
    
        }
    
        close ;
    
        
    
    }
    
  2. /*
    alter table `char` add column mvp_rank int(11) default 0 after delete_date, add index (mvp_rank);
    */
    prontera,155,188,5	script	jsfkdsfhsk	100,{
    .@nb = query_sql( "select name, mvp_rank from `char` where mvp_rank > 0 order by mvp_rank desc limit 10", .@name$, .@count );
    if ( !.@nb ) {
    	mes "no entry";
    	close;
    }
    for ( .@i = 0; .@i < .@nb; .@i++ )
    	mes ( .@i +1 )+". "+ .@name$ +" -> "+ .@count +" points";
    close;
    OnInit:
    setarray .mvp, 1001, 1002, 1004;
    
    while ( .mvp ) {
    	setd ".mvp"+ .mvp, 1;
    	.@i++;
    }
    end;
    OnNPCKillEvent:
    if ( getd( ".mvp"+ .mvp ) )
    	query_sql "update `char` set mvp_rank = mvp_rank +1 where char_id = "+ getcharid(0);
    end;
    }

    I try another one

    Seems like you forgot killedrid.

    if ( getd( ".mvp"+ killedrid ) )

    And setd ".mvp"+ .mvp[.@i], 1;

    And I think OnInit can be made like (but there will be a lot of loops):

    
    freeloop 1 ;
    set .@max, 2000;
    set .@i, .@max;
    while ( .@max - .@i < 1000 )
    {
    if ( getmonsterinfo ( .@i, MOB_MVPEXP ) )
    {
    set .mvp[.@j], .@i;
    set .@j, .@j + 1;
    }
    set .@i, .@i - 1;
    }
    freeloop 0 ;
    

    • Upvote 1
  3. I made a roulette script last year, it was based on npc mobs (never readed the rules of the real casino's roulette, so I made it "custom".)

    I have it here: removed for now.

    Maybe this can be off-topic... (I'm lazy to translate to english, it's just to show how it works.)

    • Upvote 1
  4. I can hardly believe I am being taught to use ELSE... /...

    that was for educational purpose .... ok we are complicating this topic

    'Cause you will 100% fall in that case if it jumps to that else.

    I like an explanation to this ...

    What's so hard to understand?

    set .@rand, rand( 20+50+60 ) ;

    Will randomize a number from 0 to (20+50+60)-1. Are you fine with this?

    else if ( .@rand < 20+50+60 )

    .@rand is OBVIOUSLY < (20+50+60) because its range goes from

    Will randomize a number from 0 to (20+50+60)-1.

    So you are just using server memory to check something obvious.

    Then, just use else, instead of else if, as there no need to check the obvious.

    Is this really so difficult to understand? O.o

    She already knows it, what she said is that she made it that way to show how it's done.

    • Upvote 2
  5. So, I want to get into this too.

    prontera,100,100,4	script	Converter	100,{
    
    mes "hi there.";
    mes "select which item do you want to exchange.";
    for ( set .@size, getarraysize ( .@items ); .@i < .@size ; set .@i, .@i + 4 )
    {
    	if ( countitem ( .items[.@i] ) )
    	{
    		set .@color$, ( ( countitem ( .items[.@i] ) < .items[.@i + 1] ) ? "^ff0000" : "^00ff00" );
    		set .@menu$, .@color$ + .@menu$ + getitemname ( .items[.@i] ) +":";
    		set .@m$[.@j], "1x"+ .@i;
    		set .@j, .@j + 1;
    	}
    	if ( countitem ( .items[.@i + 2] ) )
    	{
    		set .@color$, ( ( countitem ( .items[.@i + 2] ) < .items[.@i + 3] ) ? "^ff0000" : "^00ff00" );
    		set .@menu$, .@color$ + .@menu$ + getitemname ( .items[.@i + 2] ) +":";
    		set .@m$[.@j], "2x"+ .@i;
    		set .@j, .@j + 1;
    	}
    }
    next ;
    set .@s, select ( .@menu$ ) - 1;
    explode .@array$, .@m$[.@s], "x";
    set .@type, atoi ( .@array$[0] );
    set .@item, atoi ( .@array$[1] );
    if ( countitem ( .items[.@item + (.@type/2)*2] ) < .items[.@item + ((.@type + 1)/3)*3 + .@type%2] )
    	mes "sorry, you don't have the required.";
    else
    {
    	mes "how much?";
    	input .@n;
    	set .@req, .@n * .items[.@item + ((.@type + 1)/3)*3 + .@type%2];
    	if ( .@req > countitem ( .items[.@item + (.@type/2)*2 )
    		set .@n, countitem ( .items[.@item + (.@type/2)*2] ) / .items[.@item + ((.@type + 1)/3)*3 + .@type%2];
    	delitem .items[.@item + (.@type/2)*2], .@req;
    	getitem .items[(.@item + 1)/4 * (.@type % 2)*2], .@n;
    	mes "all done.";
    }
    close;
    
    
    
    OnInit:
    
    setarray .items[0],	 501, 10,	// you can exchange this into v
    			502, 5 ;	// or this into ^
    
    end ;
    

    I didn't test, and as far as I understand this is a:

    x item[amount a] -> y item[amount b]

    y item[amount b] -> x item[amount a]

  6. Credits to ToastOfDoom (if I remember well he used this method before):

    -	script	Sample#checkrefine	-1,{
    OnInit:
    setarray .@map$[0],"payg_cas02","guild_vs1","guild_vs2","guild_vs4";
    
    set .@size, getarraysize( .@map$ );
    for(set .@i,0; .@i < .@size; set .@i,.@i+ 1 ){
    setd ".map_"+ .@map$[.@i], 1;	
    setmapflag .@map$[.@i],mf_loadevent;
    }
    end;
    
    OnPCLoadMapEvent:
    if(getd( ".map_"+ strcharinfo(3) ) ){
    set .@map$,strcharinfo(3);
    while( strcharinfo(3) == .@map$ ){
    	getinventorylist;
    	for(set .@i,0; .@i < @inventorylist_count; set .@i,.@i+ 1 )
    		if( @inventorylist_refine[.@i] >= 10 ){
    			mes "Please remove all Equipment that have Refine +10 or above.";
    			close2;
    			warp "SavePoint",0,0;
    		}
    	sleep2 5000;
    }
    end;
    }
    

  7. Forget 1 line.

    prontera,100,100,4    script    Healer    100,{
    
       if ( BaseLevel < 70 || set ( .@t, gettimetick ( 2 ) - heal_delay ) >= (5 * 60) )
       {
           percentheal 100, 100;
           if ( BaseLevel >= 70 )
               set heal_delay, gettimetick ( 2 );
       }
       else
       {
           set .@t, (5 * 60) - .@t;
           set .@m, .@t / 60;
           set .@s, .@t % 60;
           dispbottom "Please wait for "+ .@m +" min(s) "+ .@s ? .@s +" seconds" : "";
       }
       end ;
    
    }
    
    

    • Upvote 1
  8. prontera,100,100,4    Healer    100,{
    
       if ( BaseLevel < 70 || set ( .@t, gettimetick ( 2 ) - heal_delay ) >= (5 * 60) )
       {
           percentheal 100, 100;
           if ( BaseLevel >= 70 )
               set heal_delay, gettimetick ( 2 );
       }
       else
       {
           set .@m, .@t / 60;
           set .@s, .@t % 60;
           dispbottom "Please wait for "+ .@m +" min(s) "+ .@s ? .@s +" seconds" : "";
       }
       end ;
    
    }
    

  9. I little detail I see in Ruru's script is that everyone can win if they all don't pick any candy, so that would be somewhat exploitable.

    I think a min amount to pick would be somewhat to prevent that exploit :P

    set .@min, 5;
    if ( .@amount > .@highest && .@amount > .@min ) {
    

    • Upvote 1
  10. You will have to set mapflags because a player can get into the room with Warp Portal and then exchange candys.

    Or better solution, make a new item and put a new line in item_trade.txt (because some monsters drops candys), the only way to get that item will be on the event.

    And I dunno, but the items deletion is before the winner check, so he will not have the user amount=maxcandy.

  11. prontera,100,100,4    script    items    100,{
    
       while ( ! .@s || .@s == (.page + 1) )
       {
           set .@index, .@index + 1;
           set .@s, select ( getd ( ".menu"+ .@index +"$" ) );
       }
       set .@item_index, ((.@index - 1) * .@page) + .@s;
       dispbottom getitemname ( .itemsids[.@item_index] );
       close;
    
    
    OnInit:
    
       setarray .itemsids[0],5360,5361,5363,5362,5364;
       set .page, 4;
    
       set .@size, getarraysize ( .itemsids );
       while ( .@i < .@size )
       {
           set .@index, (.@i / .page) + 1;
           setd ".menu"+ .@index +"$", getd ( ".menu"+ .@index +"$" ) + getitemname ( .itemsids[.@i] ) +":";
           if ( ! ( ( .@i + 1 ) % .page ) )
               setd ".menu"+ .@index +"$", getd ( ".menu"+ .@index +"$" ) + "^ff0000Next^000000";
           set .@i, .@i + 1;
       }
    
    }

    • Upvote 2
  12. Kind of off-topic:

    I had that solved by using mapflags (noskill, monster_noteleport and stuff), then removing the equipped items for players (custom mapflag for no equip) and having walls, i.e: they can't attack in range (no bow) nor use skills.

  13. I have a script of this but is in spanish.

    I made the monsters attack each other by using unitattack after setting the gid in vars with bg_monster.

    set .@mvp1, bg_monster ( 1, "prontera", 155, 160, "poring 1", 1002, "monsters::OnDie1" ) ;
    set .@mvp2, bg_monster ( 2, "prontera", 155, 162, "poring 2", 1002, "monsters::OnDie2" ) ;
    sleep 500 ;
    unitattack .@mvp1, .@mvp2 ;
    unitattack .@mvp2, .@mvp1 ;
    

    OnDie1:
    set .@a,1;
    OnDie2:
    set .@a, .@a + 1;
    
    announce "poring "+.@a+" won",0;
    

  14. prontera,155,181,5	script	Sample	757,{
    mes "Wan to be Premium Users for 1 week ?";
    mes "Then give me "+.Amount+" x "+getitemname(.ItemID);
    if( countitem( .ItemID ) >= .Amount ){
    	if( select("YES:NO") == 1 ){
    		delitem .ItemID,.Amount;
    		set #PremiumUser,gettimetick(2) + ( .Day * 3600 * 24 );
    	    doevent "Sample::OnPCLoginEvent";
    		mes "Done. enjoy your Premium Services for 1 Week.";
    	}
    }
    close;
    
    OnPCLoginEvent:
    if( #PremiumUser > gettimetick(2) ){
    	set .@t,#PremiumUser-gettimetick(2);
    	if( .@t >= 3600 ){
    		addtimer 3600000,"Sample::OnPCLoginEvent";
    		set .@d,3600;
    	}
    	else{
    		addtimer .@t * 1000,"Sample::OnPCLoginEvent";
    		set .@d,.@t;
    	}
    	sc_start SC_ITEMBOOST,.@d * 1000,200;
    	sc_start SC_EXPBOOST,.@d * 1000,200;
    }
    end;
    }
    

  15. I'm supporting this too, I just wanted to mark out that detail.

    @KeyWorld:

    But I mean getting the status, and if he's connected the id of a character who is not attached at that moment to the script.

    >if(getcharid(0,"john")) he's online, so attachrid and stuff.

    @Euphy:

    I'm agree on this, only was a detail for some old scripts, but the change required is minimal.

×
×
  • Create New...